What's the CURRENT schema ? 
Author Message
 What's the CURRENT schema ?

Quote:

> I can see the content of yamada.vs1 by the command
>   select * from vs1
> but there seems to be no way to see the content of
> public.vs1.

PUBLIC is a reserved keyword, so you have to do something like
        select * from "public".vs1;
if there is a vs1 hiding it in an earlier namespace in the search
path.

I've been vacillating about whether to choose another name for the
public namespace to avoid the need for quotes here.  I can't think
of another good name :-(

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command



Mon, 20 Sep 2004 12:21:10 GMT
 What's the CURRENT schema ?

Quote:

> PUBLIC is a reserved keyword, so you have to do something like
>    select * from "public".vs1;
> if there is a vs1 hiding it in an earlier namespace in the search
> path.

> I've been vacillating about whether to choose another name for the
> public namespace to avoid the need for quotes here.  I can't think
> of another good name :-(

What about shared.vs1 or common.vs1?

Joe

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate

message can get through to the mailing list cleanly



Mon, 20 Sep 2004 12:54:15 GMT
 What's the CURRENT schema ?

Quote:


> > I can see the content of yamada.vs1 by the command
> >   select * from vs1
> > but there seems to be no way to see the content of
> > public.vs1.

> PUBLIC is a reserved keyword, so you have to do something like
>         select * from "public".vs1;
> if there is a vs1 hiding it in an earlier namespace in the search
> path.

I see. However my main problem is that the schema of unqualified
vs1 is affected by the existence of yamada.vs1. I don't think
it's a useful behavior.

regards,
Hiroshi Inoue

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate

message can get through to the mailing list cleanly



Mon, 20 Sep 2004 12:54:15 GMT
 What's the CURRENT schema ?

Quote:
Tom Lane writes:
> PUBLIC is a reserved keyword, so you have to do something like
>    select * from "public".vs1;
> if there is a vs1 hiding it in an earlier namespace in the search
> path.

PUBLIC can be made less reserved easily.  See patch below.

Quote:
> I've been vacillating about whether to choose another name for the
> public namespace to avoid the need for quotes here.  I can't think
> of another good name :-(

PUBLIC is a good name.  Oracle uses it, I think.

diff -u -r2.299 gram.y
--- gram.y  1 Apr 2002 04:35:38 -0000   2.299

                    n->groupname = NULL;
                    $$ = (Node *)n;
                }
-       | GROUP ColId
+       | GROUP UserId
                {
                    PrivGrantee *n = makeNode(PrivGrantee);
                    n->username = NULL;
                    n->groupname = $2;
                    $$ = (Node *)n;
                }
-       | ColId
+       | UserId
                {
                    PrivGrantee *n = makeNode(PrivGrantee);

 Iconst:  ICONST                            { $$ = $1; };
 Sconst:  SCONST                            { $$ = $1; };
-UserId:  ColId                         { $$ = $1; };

 /*

 /* Column identifier --- names that can be column, table, etc names.
  */
 ColId:  IDENT                          { $$ = $1; }
+       | unreserved_keyword            { $$ = $1; }
+       | col_name_keyword              { $$ = $1; }
+       | PUBLIC                        { $$ = "public"; }
+       ;
+
+/* User identifier */
+UserId:  IDENT                         { $$ = $1; }
        | unreserved_keyword            { $$ = $1; }
        | col_name_keyword              { $$ = $1; }
        ;

--

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate

message can get through to the mailing list cleanly



Mon, 20 Sep 2004 13:14:29 GMT
 What's the CURRENT schema ?

Quote:

> I've been vacillating about whether to choose another name for the
> public namespace to avoid the need for quotes here.  I can't think
> of another good name :-(

For the special schemas, we have pg_catalog, (pg_temp, pg_toast ?),
so pg_public could do the trick.

--
Fernando Nasser

2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster



Tue, 21 Sep 2004 04:21:03 GMT
 What's the CURRENT schema ?

Quote:


>> I've been vacillating about whether to choose another name for the
>> public namespace to avoid the need for quotes here.  I can't think
>> of another good name :-(
> For the special schemas, we have pg_catalog, (pg_temp, pg_toast ?),
> so pg_public could do the trick.

Actually that was my initial choice of name, but I changed my mind
later.  The reason is that the dbadmin should be able to restrict or
even delete the public namespace if his usage plans for the database
don't allow any shared objects.  If we call it pg_public then the system
will think it is a reserved namespace, and we'd have to put in a special
case to allow it to be deleted (not to mention recreated again, should
the DBA change his mind later).
The public namespace isn't really special and so it should not be named
like a system-reserved namespace.  IMHO anyway...

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate

message can get through to the mailing list cleanly



Tue, 21 Sep 2004 04:29:52 GMT
 What's the CURRENT schema ?

Quote:


>> Actually that was my initial choice of name, but I changed my mind
>> later.  The reason is that the dbadmin should be able to restrict or
>> even delete the public namespace if his usage plans for the database
>> don't allow any shared objects.
> Can't we prevent creation in there by (un)setting permissions?

That was what I was referring to by "restrict" ... but ISTM we should
allow dropping the namespace too.  Why waste cycles searching it if
you don't want to use it?

Quote:
> There should be a more practical way of making it empty than having to
> drop
> each object individually (DROP will drop the contents but refuse to
> delete
> the schema itself as it is a pg_ one?).

I'd expect DROP on a reserved namespace to error out, and thus do
nothing at all.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command



Tue, 21 Sep 2004 04:47:00 GMT
 What's the CURRENT schema ?

Quote:



> >> Actually that was my initial choice of name, but I changed my mind
> >> later.  The reason is that the dbadmin should be able to restrict or
> >> even delete the public namespace if his usage plans for the database
> >> don't allow any shared objects.

> > Can't we prevent creation in there by (un)setting permissions?

> That was what I was referring to by "restrict" ... but ISTM we should
> allow dropping the namespace too.  Why waste cycles searching it if
> you don't want to use it?

I don't know how the search will be implemented, but it should cost
very few instructions (one isnt checks that a list head is zero and
another gets the next pointer for the next namespace).  And, as we now
transform things and keep them as Oids, it will be even cheaper.

Quote:
> > There should be a more practical way of making it empty than having to
> > drop
> > each object individually (DROP will drop the contents but refuse to
> > delete
> > the schema itself as it is a pg_ one?).

> I'd expect DROP on a reserved namespace to error out, and thus do
> nothing at all.

But we could have:

DROP SCHEMA pg_public CONTENTS;

or something of a sort (an extension, but a public schema is an
extension).
And this sintax can come handy for DBAs in general.

--
Fernando Nasser

2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9

---------------------------(end of broadcast)---------------------------



Tue, 21 Sep 2004 05:11:04 GMT
 What's the CURRENT schema ?

Quote:
> -----Original Message-----


> > I see. However my main problem is that the schema of unqualified
> > vs1 is affected by the existence of yamada.vs1. I don't think
> > it's a useful behavior.

> Well, if you don't like it, you could set the search_path to be just
> public,

Yes I don't like it and probably I would do it for myself but
I couldn't force other people to do so. Well for example,
how could psqlodbc driver know the CURRENT schema ?

Quote:
> or public and then the user's personal namespace.

The order isn't the problem at all. Would the *public*
be the CURRENT schema then ? If I recognize correctly,
neither is the CURRENT schema in the current spec.

regards,
Hiroshi Inoue

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate

message can get through to the mailing list cleanly



Tue, 21 Sep 2004 05:50:14 GMT
 What's the CURRENT schema ?

Quote:

> Well for example,
> how could psqlodbc driver know the CURRENT schema ?

What "CURRENT" schema?  If you have a search path more than one entry
long, there is no unique notion of a CURRENT schema.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------



Tue, 21 Sep 2004 06:35:26 GMT
 What's the CURRENT schema ?

Quote:


> > Well for example,
> > how could psqlodbc driver know the CURRENT schema ?

> What "CURRENT" schema?  If you have a search path more than one entry
> long, there is no unique notion of a CURRENT schema.

Oh I see but I think using the search SCHEMA path for
table name resolution is harmful.

regards,
Hiroshi Inoue

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command



Tue, 21 Sep 2004 07:41:44 GMT
 
 [ 11 post ] 

 Relevant Pages 

1. What's the CURRENT schema ?

2. Copying schema objects from one user's schema to anothers

3. Set current-schema and granting

4. "set current schema" and commit

5. CURRENT SCHEMA - used in interactive SELECT statement?

6. CURRENT SCHEMA and priviledges question.....(more riddles for SERGE as per request...:)))))

7. Table and schema current size.

8. set current schema

9. Garbage in 'Current Database'

10. 'Current Activity' on SQL 6.5

11. What is the current 'SET'?

12. 'No current record'


 
Powered by phpBB® Forum Software