From: knut.suebert@web.de
To: pgsql-php@postgresql.org
Subject: Re: how to get the field types of a(n empty) table?
Date: Fri, 26 Oct 2001 19:28:20 +0200
Message-ID: <20011026192820.A2091@cascal.vtb> (raw)
In-Reply-To: <007f01c15b12$7ea3fda0$01fdfea9@jaguar>
References: <20011020195903.A8147@cascal.vtb>
<007f01c15b12$7ea3fda0$01fdfea9@jaguar>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: knut.suebert@web.de
Subject: Re: how to get the field types of a(n empty) table?
In-Reply-To: <20011026192820.A2091@cascal.vtb>
References: <20011020195903.A8147@cascal.vtb> <007f01c15b12$7ea3fda0$01fdfea9@jaguar> <20011026192820.A2091@cascal.vtb>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox