Some more information_schema issues

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Some more information_schema issues
Date: 2003-10-16 23:48:10
Message-ID: 16713.1066348090@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I looked through all the information_schema stuff, and found a few more
nits.

The CHECK_CONSTRAINTS view should use pg_get_constraintdef() function
rather than consrc, for the same reasons as psql should (I haven't fixed
the latter yet, but will soon).

There are several views that display pg_type.typname directly. I wonder
whether any of these ought to be using format_type() instead. It won't
matter for the views that only show domains, but several could
potentially show standard types. Don't we want the output to be
"character" rather than "bpchar"?

It would be a small efficiency boost to use UNION ALL rather than UNION
where possible.

"READ COMMITED" should be "READ COMMITTED" in sql_implementation_info.

In sql_sizing, MAXIMUM COLUMNS IN SELECT should be 1664
(MaxTupleAttributeNumber).

Several views get fixed pg_class OIDs like this:
AND d.refclassid = (SELECT oid FROM pg_class WHERE relname = 'pg_class')
This is unsafe --- suppose a user creates a table named pg_class in one
of his own schemas? The SELECT would return multiple rows, causing a
runtime error. What I would recommend is coding these like
AND d.refclassid = 'pg_catalog.pg_class'::regclass
which is schema-safe and also rather more efficient, since the planner
will see this as a simple constant instead of a sub-query.

The ELEMENT_TYPES view doesn't work --- it returns zero rows. After
some fooling around I think it's a simple typo: the line
AND (n.nspname, x.objname, x.objtype, x.objtypeid) IN
should be
AND (n.nspname, x.objname, x.objtype, x.objdtdid) IN

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Anthony W. Youngman 2003-10-16 23:50:58 Re: Dreaming About Redesigning SQL
Previous Message Josh Berkus 2003-10-16 23:43:54 Re: Bison 1.875 for SuSE Linux 8.1?