Skip site navigation (1) Skip section navigation (2)

Re: Hard-coded PUBLIC in pg_dump

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Nicolai Tufar <ntufar(at)apb(dot)com(dot)tr>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Hard-coded PUBLIC in pg_dump
Date: 2002-12-01 04:53:33
Message-ID: 15516.1038718413@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-advocacypgsql-generalpgsql-hackers
Nicolai Tufar <ntufar(at)apb(dot)com(dot)tr> writes:
> src/bin/pg_dump/pg_dump.c happen to have hard-coded PUBLIC role name.

As it should.  I think the real problem here is the hack in gram.y:

grantee:    ColId
                {
                    PrivGrantee *n = makeNode(PrivGrantee);
                    /* This hack lets us avoid reserving PUBLIC as a keyword*/
                    if (strcmp($1, "public") == 0)
                        n->username = NULL;
                    else
                        n->username = $1;
                    n->groupname = NULL;
                    $$ = (Node *)n;
                }

If the parser treated PUBLIC as an actual keyword, you'd not be having
this problem, because keywords are case-folded on an ASCII-only basis
(which is consistent with the SQL99 spec, amazingly enough).

We put in the above hack after someone complained that PUBLIC didn't use
to be a reserved word ... but considering that SQL92 clearly lists it as
a reserved word, there's not a lot of ground for that complaint to stand
on.

I'd prefer shifting PUBLIC back to the true-keyword category over any
of the other workarounds you've suggested ...

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2002-12-01 04:57:26
Subject: Re: Segmentation fault while COPY in 7.3
Previous:From: Paul RamseyDate: 2002-12-01 04:45:28
Subject: Re: 7.4 To Do

pgsql-advocacy by date

Next:From: Tom LaneDate: 2002-12-01 04:57:26
Subject: Re: Segmentation fault while COPY in 7.3
Previous:From: David WheelerDate: 2002-12-01 04:24:17
Subject: Re: 7.4 Wishlist

pgsql-general by date

Next:From: Tom LaneDate: 2002-12-01 04:57:26
Subject: Re: Segmentation fault while COPY in 7.3
Previous:From: Tom LaneDate: 2002-12-01 04:39:42
Subject: Re: returning CHAR from C function

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group