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 D3991D1EFF4 for ; Sun, 16 May 2004 20:18:49 -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 74198-01 for ; Sun, 16 May 2004 20:18:29 -0300 (ADT) Received: from ms-smtp-03.tampabay.rr.com (ms-smtp-03-smtplb.tampabay.rr.com [65.32.5.133]) by svr1.postgresql.org (Postfix) with ESMTP id A8A05D1EBB2 for ; Sun, 16 May 2004 20:18:25 -0300 (ADT) Received: from joiner (155.14.33.65.cfl.rr.com [65.33.14.155]) by ms-smtp-03.tampabay.rr.com (8.12.10/8.12.7) with ESMTP id i4GNIQuI000566 for ; Sun, 16 May 2004 19:18:27 -0400 (EDT) Subject: table column information From: "Scot L. Harris" To: pgsql-php@postgresql.org Content-Type: text/plain Message-Id: <1084749506.2056.148.camel@lathe> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 Date: Sun, 16 May 2004 19:18:26 -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.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200405/25 X-Sequence-Number: 2744 Currently using Postgresql 7.2.4-5.80 with php 4.2.2.-8.0.8 on a redhat 8.0 system. I am writing some php scripts where I want to generate a list of the column names in a particular table that the user selects. I could take the brute force method and hard code the column names but then every time I add a new table or modify an existing one I would have to modify the code. What I want is to have a generic function that given the table name it will pull the column names for my use. I need to get the table column names for several tables I have setup. I know if I do a select * from tablename I can then use the pg_fieldname function to pull the column names for all columns. But I don't think I want to select the entire contents of the table every time I want to get the names of the columns. I know this will work but I think performance will be very poor. Trying to find something the equivalent of doing a \d tablename in psql. I did see a function to pull meta data but that is in a 4.3 version of php. I have also been trying to track down some information on the pga_layout table. This appears to be a system table that might contain the information I want but it does not list every table I have created. Not sure what that is. The books I have do not say much if anything about such system tables. Any help or pointers would be appreciated. -- Scot L. Harris