Re: pg_dump roles support

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Benedek László <laci(at)benedekl(dot)tvnetwork(dot)hu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_dump roles support
Date: 2008-11-07 20:20:00
Message-ID: 20081107202000.GG5507@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Benedek László wrote:

Hi,

> 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)

> - sgml documentation of this feature

The SGML patch seems to contain unnecessary whitespace changes; please
clean that up.

> + /* 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 ' ?

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Martin Pihlak 2008-11-07 20:23:09 Re: auto_explain contrib moudle
Previous Message Zdenek Kotala 2008-11-07 20:19:09 Re: [WIP] In-place upgrade