Skip site navigation (1) Skip section navigation (2)

Re: information_schema.referential_constraints permissions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Lodewijk Voege" <lvoege(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: information_schema.referential_constraints permissions
Date: 2008-04-28 23:14:58
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
"Lodewijk Voege" <lvoege(at)gmail(dot)com> writes:
> I have some code that gets foreign key information from
> information_schema.referential_constraints. I was puzzled about why it wasn't
> returning anything for a while, until I read the information_schema.sql file
> and the documentation carefully: it has a pg_has_role(c.relowner, 'USAGE') in
> it and the documentation states "The view referential_constraints contains all
> referential integrity (foreign key) constraints in the current database that
> belong to a table owned by a currently enabled role".

> Fair enough. But then I read the public draft of SQL 2003 and 200n on this
> view, and it speaks only of "tables in this catalog that are accessible to a
> given user or role", rather than ownership. the user I was working with most
> definately had access.

The SQL committee changed that recently --- SQL92 and SQL99 define the
view as

         Identify the referential constraints defined in this catalog that
         are owned by a given user.

I don't think we've gotten around to trying to sync information_schema
with SQL2003.  (The whole concept that information_schema might be a
moving target is pretty disturbing :-()

			regards, tom lane

In response to

pgsql-sql by date

Next:From: Gurjeet SinghDate: 2008-04-29 01:24:22
Subject: Re: Truncate table at a certain size.
Previous:From: Dana Huggard - NavarikDate: 2008-04-28 22:35:04
Subject: Truncate table at a certain size.

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group