From: | Benedek László <laci(at)benedekl(dot)tvnetwork(dot)hu> |
---|---|
To: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: pg_dump roles support |
Date: | 2008-11-08 08:25:26 |
Message-ID: | 49154CF6.9070506@benedekl.tvnetwork.hu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
Thank you for your review.
On 2008-11-07 21:20, Alvaro Herrera wrote:
>> The patch contains the following things:
>>
>>
>> - pg_dump and pg_dumpall accepts the --role=rolename parameter, and
>> sends a SET ROLE command on their connections
>>
>
> Minor comment -- I think you need to quote the role name in the SET
> command. Otherwise roles with funny names will fail (try a role with a
> space for example)
>
>
Of course you need to quote the role names with special characters in it.
I tested it this way (from bash):
$ src/bin/pg_dump/pg_dump -h localhost -p 4003 --role "asd ' \" qwe" test
Note the bash style escaping of the string [asd ' " qwe].
It created a dump file with SET role = "asd ' "" qwe"; line in it. Seems
fine for me.
> The SGML patch seems to contain unnecessary whitespace changes; please
> clean that up.
>
Maybe you missed an updated version of the patch? Available here:
http://archives.postgresql.org/pgsql-hackers/2008-11/msg00391.php
>> + /* te->defn should have the form SET role = 'foo'; */
>> + char *defn = strdup(te->defn);
>> + char *ptr1;
>> + char *ptr2 = NULL;
>> +
>> + ptr1 = strchr(defn, '\'');
>> + if (ptr1)
>> + ptr2 = strchr(++ptr1, '\'');
>>
>
> Does this work if the role name contains a ' ?
>
Right, this one fails with ' in the role name. An update coming soon closing this issue.
Regards,
Benedek Laszlo
From | Date | Subject | |
---|---|---|---|
Next Message | Simon Riggs | 2008-11-08 09:23:24 | Re: Updates of SE-PostgreSQL 8.4devel patches (r1197) |
Previous Message | Pavan Deolasee | 2008-11-08 07:35:27 | Re: restore PD_PAGE_FULL on WAL update replay |