[SQL] 'show databases' in psql way?

2004-11-01 Thread Erik Wasser
Hi list, how can I list the databases in a postgresish way? I know about the '-l' switch of 'psql' but is there a DBI/SQL-query way? I don't want to call an external program only to list the databases. I've googled about this problem but I only found the '-l'-way to this this. Ideas? Solutions

Re: [SQL] 'show databases' in psql way?

2004-11-01 Thread Frank Bax
At 07:13 AM 11/1/04, Erik Wasser wrote: how can I list the databases in a postgresish way? I know about the '-l' switch of 'psql' but is there a DBI/SQL-query way? I don't want to call an external program only to list the databases. I've googled about this problem but I only found the '-l'-way to t

Re: [SQL] 'show databases' in psql way?

2004-11-01 Thread Ian Barwick
On Mon, 1 Nov 2004 13:13:10 +0100, Erik Wasser <[EMAIL PROTECTED]> wrote: > Hi list, > > how can I list the databases in a postgresish way? I know about the '-l' > switch of 'psql' but is there a DBI/SQL-query way? I don't want to call > an external program only to list the databases. I've googled

Re: [SQL] 'show databases' in psql way?

2004-11-01 Thread Erik Wasser
On Monday 01 November 2004 13:26, Ian Barwick wrote: > Start psql with the -E switch, and it shows the SQL used to generate > the output from psql's slash commands. Thanks for the quick answer. I will remember this switch! B-) -- So long... Fuzz ---(end of broadcast)---

[SQL] Join Table

2004-11-01 Thread T E Schmitz
Hello, I have created the following join table: the two FKs are the PK of the table. Typically, I will need to select rows for a given ITEM_FK. Question: is it necessary/advisable to create an index for the ITEM_FK column? Or is this redundantbecause this column is already one of the PK columns

Re: [SQL] Join Table

2004-11-01 Thread Michael Fuhr
On Mon, Nov 01, 2004 at 04:34:32PM +, T E Schmitz wrote: > > I have created the following join table: the two FKs are the PK of the > table. Typically, I will need to select rows for a given ITEM_FK. > > Question: is it necessary/advisable to create an index for the ITEM_FK > column? Or is

Re: [SQL] Join Table

2004-11-01 Thread Tom Lane
T E Schmitz <[EMAIL PROTECTED]> writes: > CREATE TABLE SUPPLY > ( > ITEM_FK integer NOT NULL, > CONTACT_FK integer NOT NULL, > COST numeric (7,2), > PRIMARY KEY (ITEM_FK,CONTACT_FK) > ); > Question: is it necessary/advisable to create an index for the ITEM_FK > column? Or is this redundantbecause

Re: [SQL] Join Table

2004-11-01 Thread Richard Huxton
T E Schmitz wrote: Hello, I have created the following join table: the two FKs are the PK of the table. Typically, I will need to select rows for a given ITEM_FK. Question: is it necessary/advisable to create an index for the ITEM_FK column? Or is this redundantbecause this column is already one

Re: [SQL] Join Table

2004-11-01 Thread T E Schmitz
Hello Mike/Tom/Richard, Thank you for your replies. Michael Fuhr wrote: On Mon, Nov 01, 2004 at 04:34:32PM +, T E Schmitz wrote: Question: is it necessary/advisable to create an index for the ITEM_FK column? Or is this redundantbecause this column is already one of the PK columns? However, r

Re: [SQL] 'show databases' in psql way?

2004-11-01 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > how can I list the databases in a postgresish way? I know > about the '-l' switch of 'psql' but is there a DBI/SQL-query way? Yes, the DBI way is to use the "data_sources" function. Works just fine for Postgres: my @dbs = DBI->data_sources(

Re: [SQL] Join Table

2004-11-01 Thread Michael Fuhr
On Mon, Nov 01, 2004 at 06:12:02PM +, T E Schmitz wrote: > I see. If using a multi-column PK, the order matters. > So, if I want to access the table both via the 1st and 2nd PK column, I > would have to define an index for the 2nd column to avoid a full table scan. If you want to use an inde