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

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 (view raw or flat)
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

pgsql-hackers by date

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

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