SELECT
A.attname,
pg_catalog.format_type(a.atttypid, a.atttypmod) AS typeName
FROM
pg_class C,
pg_attribute A,
pg_type T
WHERE
C.relname ILIKE '<TABLE NAME>' AND
(C.oid=A.attrelid) AND
(T.oid=A.atttypid) AND
(A.attnum>0) AND
(NOT A.attisdropped)
ORDER BY
A.attnum;
Does anyone know if the ansi sql standard defines any way to do this?
I've seen the DESCRIBE TABLE/INDEX/... or SHOW TABLE/INDEX/... commands in other databases, but I don't really know if they are extensions or not.
On Fri, 2004-02-06 at 11:10, Aaron Bratcher wrote:
Is there no way I can do it with a standard select command in a different client? I don't need the indexes, just the column names/types. -- Aaron Bratcher ab DataTools http://www.abDataTools.com On Feb 6, 2004, at 8:12 AM, Harald Fuchs wrote: > In article <[EMAIL PROTECTED]>, > "Joshua D. Drake" <[EMAIL PROTECTED]> writes: > >> Aaron Bratcher wrote: >>> What command can I use to get the structure of a given table? >>> > > >> If psql is client > >> \d tablename > > Without psql you can use > > pg_dump -s DBNAME -t TBLNAME > > from your shell prompt. ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings
signature.asc
Description: This is a digitally signed message part