Re: how to get the field types of a(n empty) table?

From: knut(dot)suebert(at)web(dot)de
To: pgsql-php(at)postgresql(dot)org
Subject: Re: how to get the field types of a(n empty) table?
Date: 2001-10-26 17:28:20
Message-ID: 20011026192820.A2091@cascal.vtb
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

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

In response to

Browse pgsql-php by date

  From Date Subject
Next Message Edward Smirnov 2001-11-02 06:46:07 PostgresDAC ver.1.8: Delphi/C++Builder BDE replacement
Previous Message Papp Gyozo 2001-10-26 16:15:09 Re: PostgreSQL encoding and PHP