From: | Fernando Nasser <fnasser(at)redhat(dot)com> |
---|---|
To: | Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: What's the CURRENT schema ? |
Date: | 2002-04-06 00:08:02 |
Message-ID: | 3CAE3C62.E170D71E@redhat.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hiroshi Inoue wrote:
>
> > We can't do that. Accordingly to the SQL if you are user HIROSHI
> > and write "SELECT * FROM a;" the table is actually "HIROSHI.a".
> >
> > This must work for people who are using SQL-schemas in their databases
> > or we would have a non-conforming implementation of SCHEMAS (would make
> > the whole exercise pointless IMO).
>
> Schema name isn't necessarily a user id since SQL-92
> though SQL-86 and SQL-89 had and probably Oracle still
> has the limitation. As far as I see PostgreSQL's schema
> support wouldn't have the limitation. Probably I wouldn't
> create the schema HIROSHI using PostgreSQL. When
> I used Oracle I really disliked the limitation.
>
You misunderstood what I've said. You may have how many schemas
you please. But you will have to refer to their objects specifying
the schema name explicitly. The only cases where you can omit the
schema name are (accordingly to the SQL'99 standard):
1) The statement is part of a CREATE SCHEMA statement that is
creating the object, so the schema being created is assumed
(and that is what you want).
2) Your schema has the same name as your user id, your statement
is not inside a CREATE SCHEMA and it runs on a session with that
authorization id. A schema name equal to the sessuin user id is
assumed (which is what you want in this specific case).
Otherwise you have to specify the schema explicitly.
So, if you name your schema "APPLE", and not HIROSHI, except
for inside the CREATE SCHEMA APPLE statement elements, you will
have to keep refering to tables with the "APPLE." prefix.
PostgreSQL will be smarter and try to relax 2) for you, looking
for the table in a public schema as well (if one exists), so old
style (non-schema) databases can still be used and people who have
schemas with names that are not their user id can save some typing. ;-)
--
Fernando Nasser
Red Hat Canada Ltd. E-Mail: fnasser(at)redhat(dot)com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9
From | Date | Subject | |
---|---|---|---|
Next Message | Tatsuo Ishii | 2002-04-06 00:43:08 | Re: PQescapeBytea is not multibyte aware |
Previous Message | Josh Berkus | 2002-04-05 23:51:35 | Re: 16 parameter limit |