Обсуждение: General Bug Report: Correction: pg_dump sets quotes wrong when dumping groups-acls.

Поиск
Список
Период
Сортировка

General Bug Report: Correction: pg_dump sets quotes wrong when dumping groups-acls.

От
Unprivileged user
Дата:
============================================================================
                        POSTGRESQL BUG REPORT TEMPLATE
============================================================================


Your name               : Bernhard Weisshuhn
Your email address      : bkw@weisshuhn.de

Category                : runtime: front-end
Severity                : serious

Summary: Correction: pg_dump sets quotes wrong when dumping groups-acls.

System Configuration
--------------------
  Operating System   : Linux 2.0.36 ELF

  PostgreSQL version : 6.4.2

  Compiler used      : gcc 2.7.2.3

Hardware:
---------
Redhat 5.2, custom-built postgresql (no RPM)

Versions of other tools:
------------------------
n/a

--------------------------------------------------------------------------

Problem Description:
--------------------
Aaaargh! Sorry, I forgot to clean up my example, so it must
have looked quite incomprehendable. Here it is again, with the right groupname:

When executing
% pg_dump -z somedatabase
and a database contains acl-permissions like
=> "GRANT ALL on sometable to group somegroup"
pg_dump incorrectly generates the line:
  GRANT ALL on "sometable" to "group somegroup";
instead of
  GRANT ALL on "sometable" to group "somegroup";

Note the quotes.

The incorrect output generates errors when restoring
databases from the dump and fails to set the correct
permissions.

--------------------------------------------------------------------------

Test Case:
----------
createdb grouptestdb;
psql grouptestdb -c "insert into pg_group (groname,grosysid,grolist) VALUES ('testgroup',1000,'{500}');"
psql grouptestdb -c "create table dummy (foobar int4);"
psql grouptestdb -c "grant ALL on dummy to group testgroup;"
pg_dump -z -s -t dummy grouptestdb



--------------------------------------------------------------------------

Solution:
---------
Obviously, pg_dump does not seem to know about groups at all,
so it treats "group testgroup" as a user.
Sorry, this one is too hard for me to fix the right way,
maybe we could just check, if the userstring begins with
'group ' and alter the quotes accordingly, but this does
not look like a clean solution to me.

--------------------------------------------------------------------------


I have fixed this bug in the 6.5 beta release.  The fix was to just
modify pg_dump to look for a leading "group ".  There is no simpler way.


>
> ============================================================================
>                         POSTGRESQL BUG REPORT TEMPLATE
> ============================================================================
>
>
> Your name               : Bernhard Weisshuhn
> Your email address      : bkw@weisshuhn.de
>
> Category                : runtime: front-end
> Severity                : serious
>
> Summary: Correction: pg_dump sets quotes wrong when dumping groups-acls.
>
> System Configuration
> --------------------
>   Operating System   : Linux 2.0.36 ELF
>
>   PostgreSQL version : 6.4.2
>
>   Compiler used      : gcc 2.7.2.3
>
> Hardware:
> ---------
> Redhat 5.2, custom-built postgresql (no RPM)
>
> Versions of other tools:
> ------------------------
> n/a
>
> --------------------------------------------------------------------------
>
> Problem Description:
> --------------------
> Aaaargh! Sorry, I forgot to clean up my example, so it must
> have looked quite incomprehendable. Here it is again, with the right groupname:
>
> When executing
> % pg_dump -z somedatabase
> and a database contains acl-permissions like
> => "GRANT ALL on sometable to group somegroup"
> pg_dump incorrectly generates the line:
>   GRANT ALL on "sometable" to "group somegroup";
> instead of
>   GRANT ALL on "sometable" to group "somegroup";
>
> Note the quotes.
>
> The incorrect output generates errors when restoring
> databases from the dump and fails to set the correct
> permissions.
>
> --------------------------------------------------------------------------
>
> Test Case:
> ----------
> createdb grouptestdb;
> psql grouptestdb -c "insert into pg_group (groname,grosysid,grolist) VALUES ('testgroup',1000,'{500}');"
> psql grouptestdb -c "create table dummy (foobar int4);"
> psql grouptestdb -c "grant ALL on dummy to group testgroup;"
> pg_dump -z -s -t dummy grouptestdb
>
>
>
> --------------------------------------------------------------------------
>
> Solution:
> ---------
> Obviously, pg_dump does not seem to know about groups at all,
> so it treats "group testgroup" as a user.
> Sorry, this one is too hard for me to fix the right way,
> maybe we could just check, if the userstring begins with
> 'group ' and alter the quotes accordingly, but this does
> not look like a clean solution to me.
>
> --------------------------------------------------------------------------
>
>
>


--
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026