Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4C38147627D for ; Mon, 2 Sep 2002 15:52:42 -0400 (EDT) Received: from mailout08.sul.t-online.com (mailout08.sul.t-online.com [194.25.134.20]) by postgresql.org (Postfix) with ESMTP id B632547627B for ; Mon, 2 Sep 2002 15:52:41 -0400 (EDT) Received: from fwd10.sul.t-online.de by mailout08.sul.t-online.com with smtp id 17lxFZ-0004l8-08; Mon, 02 Sep 2002 21:52:41 +0200 Received: from fraxinus.reticulum (520013531845-0001@[217.225.154.119]) by fmrl10.sul.t-online.com with esmtp id 17lxFR-0DK2uuC; Mon, 2 Sep 2002 21:52:33 +0200 Received: from ks by fraxinus.reticulum with local (Exim 3.35 #1 (Debian)) id 17lx7O-0000FY-00 for ; Mon, 02 Sep 2002 21:44:14 +0200 Date: Mon, 2 Sep 2002 21:44:13 +0200 From: knut.suebert@web.de To: "pgsql-php@postgresql.org" Subject: Re: How can I get metadate of a table in PHP3? Message-ID: <20020902194412.GA657@fraxinus.reticulum> References: <3D71AF16.E4216C05@cs.nmsu.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3D71AF16.E4216C05@cs.nmsu.edu> User-Agent: Mutt/1.4i X-No-Archive: yes X-Sender: 520013531845-0001@t-dialin.net X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/6 X-Sequence-Number: 1461 Zhidian Du schrieb: > How can I get metadate of a table in PHP3? If you think about things like the output of "\d tablename", turn on the logging of queries, do a "\d tablename" and watch the logfiles. Somewhere I need the fieldtypes of a table named $this->table, the query is $q = "SELECT a.attname, format_type(a.atttypid, a.atttypmod) FROM pg_class c, pg_attribute a WHERE c.relname = '".$this->table."' AND a.attnum > 0 AND a.attrelid = c.oid ORDER BY a.attnum"; which is stolen from the logs - I'll never understand it ;) Greetings, Knut Sübert