Thread: BUG #1248: pg_dump produces grants with concatonated elements

BUG #1248: pg_dump produces grants with concatonated elements

From
"PostgreSQL Bugs List"
Date:
The following bug has been logged online:

Bug reference:      1248
Logged by:          Timothy LoGrasso

Email address:      timlograsso@yahoo.com

PostgreSQL version: 7.3.5

Operating system:   SunOS 5.9

Description:        pg_dump produces grants with concatonated elements

Details:

pg_dump produces the following grants:
GRANT INSERTSELECTUPDATE ON TABLE camp_score TO mn;

Obviously there are no commas or spaces seperating the different privs.  I'm
actually running the following version: PostgreSQL 7.3.6 on
i386-pc-solaris2.8, compiled by cc -fast -xarch=386 -Xa

Attached is the ddl to create the table and grant permissions.

CREATE USER mn PASSWORD 'mn';
CREATE USER mnview PASSWORD 'mnview';
CREATE USER mgr PASSWORD 'mgr';
CREATE USER mndb PASSWORD 'mndb';

CREATE TABLE camp_score (
    ipr_number character varying(15) NOT NULL,
    performed_by character(6),
    score_date date,
    hs_comp smallint,
    hs_tech smallint,
    hs_hyg smallint,
    hs_safe smallint,
    hs_fire smallint,
    hs_hp smallint,
    hs_crit smallint,
    hs_infr smallint,
    ew_comp smallint,
    ew_tech smallint,
    ew_liq smallint,
    ew_sol smallint,
    ew_air smallint,
    ew_min smallint,
    ew_rest smallint,
    ew_corr smallint,
    ew_infr smallint,
    ss_comp smallint,
    ss_tech smallint,
    ss_snm_acc smallint,
    ss_snm_prot smallint,
    ss_class_prot smallint,
    ss_prop_prot smallint,
    ss_hostile_prot smallint,
    ss_infr smallint,
    mi_comp smallint,
    mi_tech smallint,
    mi_bb smallint,
    mi_mission smallint,
    mi_asset smallint,
    mi_natl smallint,
    mi_infr smallint
);


--
-- TOC entry 8 (OID 37311)
-- Name: camp_score; Type: ACL; Schema: public; Owner: postgres
--

REVOKE ALL ON TABLE camp_score FROM PUBLIC;
GRANT INSERT, SELECT, UPDATE ON TABLE camp_score TO mn;
GRANT ALL ON TABLE camp_score TO mndb;
GRANT SELECT ON TABLE camp_score TO mgr;
GRANT INSERT, SELECT, UPDATE ON TABLE camp_score TO mnview;

Re: BUG #1248: pg_dump produces grants with concatonated elements

From
Tom Lane
Date:
"PostgreSQL Bugs List" <pgsql-bugs@postgresql.org> writes:
> pg_dump produces the following grants:
> GRANT INSERTSELECTUPDATE ON TABLE camp_score TO mn;

Doesn't happen for anybody else...

> Obviously there are no commas or spaces seperating the different privs.  I'm
> actually running the following version: PostgreSQL 7.3.6 on
> i386-pc-solaris2.8, compiled by cc -fast -xarch=386 -Xa

I'm wondering about a buggy compiler.  The code involved is much too
simple to be broken: it's repeated calls to this:

static void
AddAcl(char *aclbuf, const char *keyword)
{
    if (*aclbuf)
        strcat(aclbuf, ",");
    strcat(aclbuf, keyword);
}

If *aclbuf contains zero on entry, then why isn't the strcat overwriting
instead of appending?  Looks like a compiler bug to me.  What is "-fast"
and does the problem go away if you don't use it?

            regards, tom lane