dbTalk Databases Forums  

[BUGS] BUG #2850: Cannot select from information_schema.schemat

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #2850: Cannot select from information_schema.schemat in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Tony Marston
 
Posts: n/a

Default [BUGS] BUG #2850: Cannot select from information_schema.schemat - 12-21-2006 , 05:47 AM







The following bug has been logged online:

Bug reference: 2850
Logged by: Tony Marston
Email address: tony (AT) marston-home (DOT) demon.co.uk
PostgreSQL version: 8.2
Operating system: Windows XP
Description: Cannot select from information_schema.schemat
Details:

If I am logged on as a user other than 'postgres' and I try the query

SELECT * FROM information_schema.schemata

I get no results. Yet if I try the equivalent query

SELECT * FROM pg_namespace

I can see all the available schema names.

Why is there a difference when the two queries are supposed to provide the
same results?

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] BUG #2850: Cannot select from information_schema.schemat - 12-21-2006 , 09:04 AM






"Tony Marston" <tony (AT) marston-home (DOT) demon.co.uk> writes:
Quote:
If I am logged on as a user other than 'postgres' and I try the query
SELECT * FROM information_schema.schemata
I get no results. Yet if I try the equivalent query
SELECT * FROM pg_namespace
I can see all the available schema names.

Why is there a difference when the two queries are supposed to provide the
same results?
They're not "supposed to provide the same results". Per SQL99, the
schemata view is supposed to

Identify the schemata in a catalog that are owned by a given user.

and the SQL definition in the spec makes it clear that it only shows
schemas owned by CURRENT_USER or a role that CURRENT_USER is a member
of.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match


Reply With Quote
  #3  
Old   
Bernd Helmle
 
Posts: n/a

Default Re: [BUGS] BUG #2850: Cannot select from information_schema.schemat - 12-21-2006 , 03:17 PM



--On Donnerstag, Dezember 21, 2006 15:47:40 +0000 Tony Marston
<tony (AT) marston-home (DOT) demon.co.uk> wrote:

Quote:
The fact that the SQL standard says that the schemata view is supposed to
"Identify the schemata in a catalog that are owned by a given user" does
not automatically mean that the information can *ONLY* be accessed by the
owner. Any user should be able to see the schema to which they have
access, owner or not.
The standard doesn't specify any given user, it specifies CURRENT_USER. Only
if CURRENT_USER is the owner of a schema (or CURRENT_USER inherits
ownership by membership) you are able (and allowed) to see the schema. While
I admit that this makes it hard to identify catalog schemata by an DBA via
the information_schema, the standard is quite clear here. I don't see any
ambiguity here....

If you need to go beyond what the standard allows, you have to use the
system
catalog.

--
Thanks

Bernd

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.