Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 00A032E0033 for ; Mon, 28 Apr 2008 20:15:03 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 95759-01 for ; Mon, 28 Apr 2008 20:15:01 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by developer.postgresql.org (Postfix) with ESMTP id 051362E002D for ; Mon, 28 Apr 2008 20:15:00 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id m3SNEwVW019207; Mon, 28 Apr 2008 19:14:58 -0400 (EDT) To: "Lodewijk Voege" cc: pgsql-sql@postgresql.org Subject: Re: information_schema.referential_constraints permissions In-reply-to: <2d734e2f0804281447l5de57868na1a5415b0a95ee28@mail.gmail.com> References: <2d734e2f0804281447l5de57868na1a5415b0a95ee28@mail.gmail.com> Comments: In-reply-to "Lodewijk Voege" message dated "Mon, 28 Apr 2008 17:47:59 -0400" Date: Mon, 28 Apr 2008 19:14:58 -0400 Message-ID: <19206.1209424498@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200804/217 X-Sequence-Number: 30756 "Lodewijk Voege" 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