metadata and views

Started by Ripabout 24 years ago2 messagesgeneral
Jump to latest
#1Rip
rip@onlineinfo.net

Hi all,
I trying to extract the metadata from a view and getting spotty results.
Using the following:

SELECT a.attnum, a.attname, t.typname, a.attlen, a.atttypmod, a.attnotnull,
a.atthasdef FROM pg_class as c, pg_attribute a, pg_type t WHERE a.attnum >
0 and a.attrelid = c.oid and c.relname = 'users' and a.atttypid = t.oid
order by a.attnum

I get correct results on a table for a.attnum, a.attname, t.typname,
a.attlen, a.atttypmod, a.attnotnull and a.atthasdef, but for a view
a.attnotnull and a.atthasdef return nothing.

Any clues anyone?

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Rip (#1)
Re: metadata and views

Rip <rip@onlineinfo.net> writes:

I get correct results on a table for a.attnum, a.attname, t.typname,
a.attlen, a.atttypmod, a.attnotnull and a.atthasdef, but for a view
a.attnotnull and a.atthasdef return nothing.

What were you expecting? A view doesn't have constraints, nor default
values for columns.

regards, tom lane