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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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


[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux