pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
information_schema.referential_constraints permissions
2+ messages / 2 participants
[nested] [flat]

* information_schema.referential_constraints permissions
@ 2008-04-28 21:47 Lodewijk Voege <lvoege@gmail.com>
  2008-04-28 23:14 ` Re: information_schema.referential_constraints permissions Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Lodewijk Voege @ 2008-04-28 21:47 UTC (permalink / raw)
  To: pgsql-sql

hello,

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. it could also read the pg_* system catalog, such that
if I copy/paste the view definition without the pg_has_role() line in it (and
massage it a bit to remove the CASTs to sql_identifier and character_data)
that user got just what I was expecting.

so, is that restriction correct?

Lodewijk



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: information_schema.referential_constraints permissions
  2008-04-28 21:47 information_schema.referential_constraints permissions Lodewijk Voege <lvoege@gmail.com>
@ 2008-04-28 23:14 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2008-04-28 23:14 UTC (permalink / raw)
  To: Lodewijk Voege <lvoege@gmail.com>; +Cc: pgsql-sql

"Lodewijk Voege" <lvoege@gmail.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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2008-04-28 23:14 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-04-28 21:47 information_schema.referential_constraints permissions Lodewijk Voege <lvoege@gmail.com>
2008-04-28 23:14 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox