Received: from Net-One.de ([195.50.164.1]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f9QHYrP64114 for ; Fri, 26 Oct 2001 13:34:54 -0400 (EDT) (envelope-from knut.suebert@web.de) Received: from cascal.vtb (root@localhost [127.0.0.1]) by localhost (8.11.3/8.11.3/Debian 8.11.2-1) with ESMTP id f9QHdxI03211 for ; Fri, 26 Oct 2001 19:39:59 +0200 Received: from ksueber by cascal.vtb with local (Exim 3.32 #1 (Debian)) id 15xAmK-0000x1-00 for ; Fri, 26 Oct 2001 19:28:20 +0200 Date: Fri, 26 Oct 2001 19:28:20 +0200 From: knut.suebert@web.de To: pgsql-php@postgresql.org Subject: Re: how to get the field types of a(n empty) table? Message-ID: <20011026192820.A2091@cascal.vtb> References: <20011020195903.A8147@cascal.vtb> <007f01c15b12$7ea3fda0$01fdfea9@jaguar> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <007f01c15b12$7ea3fda0$01fdfea9@jaguar> User-Agent: Mutt/1.3.18i X-No-Archive: yes X-Archive-Number: 200110/93 X-Sequence-Number: 646 Papp Gyozo schrieb: > If you runs psql with -E option, then psql reveals the SQL equivalent of its > magical metacommands starting with a backslash ie.: \dv \d and so on. > Use those queries to get the columns' types! That doesn't work from php (at least with the settings here) -- but turning on the debug mode and reading the syslog put me on the way to SELECT a.attname, format_type(a.atttypid, a.atttypmod) FROM pg_class c, pg_attribute a WHERE c.relname = 'tabname' AND a.attnum > 0 AND a.attrelid = c.oid ORDER BY a.attnum Thanks, Knut Sübert