X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id DEAFDD1B170 for ; Mon, 17 May 2004 18:32:11 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 95501-06 for ; Mon, 17 May 2004 18:31:53 -0300 (ADT) Received: from ms-smtp-02.tampabay.rr.com (ms-smtp-02-smtplb.tampabay.rr.com [65.32.5.132]) by svr1.postgresql.org (Postfix) with ESMTP id B6BA7D1B169 for ; Mon, 17 May 2004 18:31:50 -0300 (ADT) Received: from joiner (155.14.33.65.cfl.rr.com [65.33.14.155]) by ms-smtp-02.tampabay.rr.com (8.12.10/8.12.7) with ESMTP id i4HLVi82010183; Mon, 17 May 2004 17:31:45 -0400 (EDT) Subject: Re: table column information From: "Scot L. Harris" To: Andrew McMillan Cc: pgsql-php@postgresql.org In-Reply-To: <1084789582.27913.7.camel@lamb.mcmillan.net.nz> References: <1084749506.2056.148.camel@lathe> <1084762532.4822.36.camel@lamb.mcmillan.net.nz> <1084763775.2058.173.camel@lathe> <1084789582.27913.7.camel@lamb.mcmillan.net.nz> Content-Type: text/plain Message-Id: <1084829504.2059.187.camel@lathe> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 Date: Mon, 17 May 2004 17:31:44 -0400 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Symantec AntiVirus Scan Engine X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.3 tagged_above=0.0 required=5.0 tests=HTML_MESSAGE, HTML_TAG_BALANCE_TABLE, RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200405/33 X-Sequence-Number: 2752 On Mon, 2004-05-17 at 06:26, Andrew McMillan wrote: > On Sun, 2004-05-16 at 23:16 -0400, Scot L. Harris wrote: > > > > > > You can also select the column names from the database metadata > > > directly: > > > > > > SELECT attname > > > FROM pg_class c join pg_attribute a on c.oid = a.attrelid > > > WHERE c.relname = '' > > > AND a.attnum >= 0; > > > > > > This approach won't get killed by the efficiency problems above. > > > > > > Cheers, > > > Andrew. > > > When I want to figure out something like this I tend to use "psql -E" so > that all queries are echoed before being sent to the backend. Then I do > something like "\d " and see what SQL psql generates internally. > > Also, dig here for detailed information on the postgresql data > dictionary tables: > > http://www.postgresql.org/docs/7.4/interactive/catalogs.html > > the most useful ones are pg_class and pg_attribute usually (for obvious > reasons :-). With 7.4 I also find myself looking at the > pg_stat_activity view from time to time as well. > > Cheers, > Andrew. Thanks to everyone that responded to my question. I have my application working as I wanted. I really appreciate all the help that was provided. -- Scot L. Harris