Re: [HACKERS] Can pg_dump make use of CURRENT/SESSION_USER

2015-09-03 Thread Fabrízio de Royes Mello
On Thu, Sep 3, 2015 at 8:16 AM, Andres Freund wrote: > > On 2015-08-25 22:01:51 +0900, Michael Paquier wrote: > > Seeing no activity in the last couple of months for this patch that > > had reviews, it is now marked as returned with feedback. > > Fabrizio, you after the above moved the patch to ne

Re: [HACKERS] Can pg_dump make use of CURRENT/SESSION_USER

2015-09-03 Thread Andres Freund
On 2015-08-25 22:01:51 +0900, Michael Paquier wrote: > Seeing no activity in the last couple of months for this patch that > had reviews, it is now marked as returned with feedback. Fabrizio, you after the above moved the patch to next commitfest, without a new patch or a additional discussion. Wh

Re: [HACKERS] Can pg_dump make use of CURRENT/SESSION_USER

2015-08-25 Thread Michael Paquier
On Thu, Apr 30, 2015 at 2:04 AM, Alvaro Herrera wrote: > Fabrízio de Royes Mello wrote: > >> I have this idea: >> >> 1) Add an ObjectAddress field to CommentStmt struct an set it in gram.y >> >> 2) In the CommentObject check if CommentStmt->address is >> InvalidObjectAddress then call get_object_a

Re: [HACKERS] Can pg_dump make use of CURRENT/SESSION_USER

2015-04-29 Thread Alvaro Herrera
Fabrízio de Royes Mello wrote: > I have this idea: > > 1) Add an ObjectAddress field to CommentStmt struct an set it in gram.y > > 2) In the CommentObject check if CommentStmt->address is > InvalidObjectAddress then call get_object_address else use it For DDL deparsing purposes, it seems import

Re: [HACKERS] Can pg_dump make use of CURRENT/SESSION_USER

2015-04-29 Thread Fabrízio de Royes Mello
On Wed, Apr 29, 2015 at 1:14 PM, Alvaro Herrera wrote: > > Fabrízio de Royes Mello wrote: > > > > Looking at the patch again I realize the code is very ugly, so I'll rework > > the patch. > > Yes, I think get_object_address should figure out what to do with the > representation of CURRENT DATABASE

Re: [HACKERS] Can pg_dump make use of CURRENT/SESSION_USER

2015-04-29 Thread Alvaro Herrera
Fabrízio de Royes Mello wrote: > > Looking at the patch again I realize the code is very ugly, so I'll rework > the patch. Yes, I think get_object_address should figure out what to do with the representation of CURRENT DATABASE directly, rather than having the COMMENT code morph from that into a

Re: [HACKERS] Can pg_dump make use of CURRENT/SESSION_USER

2015-04-28 Thread Fabrízio de Royes Mello
On Tue, Apr 28, 2015 at 1:07 PM, Fabrízio de Royes Mello < fabriziome...@gmail.com> wrote: > > > On Tue, Apr 28, 2015 at 9:38 AM, Robert Haas wrote: > > > > On Sat, Apr 25, 2015 at 8:05 AM, Fabrízio de Royes Mello > > wrote: > > >> >> > If we ever implement something like > > >> >> > > > >> >> >

Re: [HACKERS] Can pg_dump make use of CURRENT/SESSION_USER

2015-04-28 Thread Fabrízio de Royes Mello
On Tue, Apr 28, 2015 at 9:38 AM, Robert Haas wrote: > > On Sat, Apr 25, 2015 at 8:05 AM, Fabrízio de Royes Mello > wrote: > >> >> > If we ever implement something like > >> >> > > >> >> > COMMENT ON CURRENT_DATABASE IS ... > >> >> > > >> >> > it will be useful, because you will be able to restore

Re: [HACKERS] Can pg_dump make use of CURRENT/SESSION_USER

2015-04-28 Thread Robert Haas
On Sat, Apr 25, 2015 at 8:05 AM, Fabrízio de Royes Mello wrote: >> >> > If we ever implement something like >> >> > >> >> > COMMENT ON CURRENT_DATABASE IS ... >> >> > >> >> > it will be useful, because you will be able to restore a dump into >> >> > another database and have the comment apply to t

Re: [HACKERS] Can pg_dump make use of CURRENT/SESSION_USER

2015-04-25 Thread Fabrízio de Royes Mello
On Wed, Mar 18, 2015 at 2:24 PM, Robert Haas wrote: > > On Wed, Mar 18, 2015 at 1:23 PM, Fabrízio de Royes Mello > wrote: > >> > If we ever implement something like > >> > > >> > COMMENT ON CURRENT_DATABASE IS ... > >> > > >> > it will be useful, because you will be able to restore a dump into >

Re: [HACKERS] Can pg_dump make use of CURRENT/SESSION_USER

2015-03-18 Thread Fabrízio de Royes Mello
On Wed, Mar 18, 2015 at 3:13 PM, Tom Lane wrote: > > =?UTF-8?Q?Fabr=C3=ADzio_de_Royes_Mello?= writes: > > Just one last doubt. Do we expose a new function called "current_database" > > like "current_catalog", "current_user", ... ? > > There already is one. But that would have nothing to do with

Re: [HACKERS] Can pg_dump make use of CURRENT/SESSION_USER

2015-03-18 Thread Fabrízio de Royes Mello
On Wed, Mar 18, 2015 at 3:13 PM, Robert Haas wrote: > > On Wed, Mar 18, 2015 at 2:09 PM, Fabrízio de Royes Mello > wrote: > > Just one last doubt. Do we expose a new function called "current_database" > > like "current_catalog", "current_user", ... ? > > Why would we do that? > We don't need it.

Re: [HACKERS] Can pg_dump make use of CURRENT/SESSION_USER

2015-03-18 Thread Tom Lane
=?UTF-8?Q?Fabr=C3=ADzio_de_Royes_Mello?= writes: > Just one last doubt. Do we expose a new function called "current_database" > like "current_catalog", "current_user", ... ? There already is one. But that would have nothing to do with the proposed patch anyway, because the bits of syntax in ques

Re: [HACKERS] Can pg_dump make use of CURRENT/SESSION_USER

2015-03-18 Thread Robert Haas
On Wed, Mar 18, 2015 at 2:09 PM, Fabrízio de Royes Mello wrote: > Just one last doubt. Do we expose a new function called "current_database" > like "current_catalog", "current_user", ... ? Why would we do that? -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL C

Re: [HACKERS] Can pg_dump make use of CURRENT/SESSION_USER

2015-03-18 Thread Fabrízio de Royes Mello
On Wed, Mar 18, 2015 at 2:42 PM, Fabrízio de Royes Mello < fabriziome...@gmail.com> wrote: > > > > On Wed, Mar 18, 2015 at 2:24 PM, Robert Haas wrote: > > > > On Wed, Mar 18, 2015 at 1:23 PM, Fabrízio de Royes Mello > > wrote: > > >> > If we ever implement something like > > >> > > > >> > COMMENT

Re: [HACKERS] Can pg_dump make use of CURRENT/SESSION_USER

2015-03-18 Thread Fabrízio de Royes Mello
On Wed, Mar 18, 2015 at 2:24 PM, Robert Haas wrote: > > On Wed, Mar 18, 2015 at 1:23 PM, Fabrízio de Royes Mello > wrote: > >> > If we ever implement something like > >> > > >> > COMMENT ON CURRENT_DATABASE IS ... > >> > > >> > it will be useful, because you will be able to restore a dump into >

Re: [HACKERS] Can pg_dump make use of CURRENT/SESSION_USER

2015-03-18 Thread Robert Haas
On Wed, Mar 18, 2015 at 1:23 PM, Fabrízio de Royes Mello wrote: >> > If we ever implement something like >> > >> > COMMENT ON CURRENT_DATABASE IS ... >> > >> > it will be useful, because you will be able to restore a dump into >> > another database and have the comment apply to the target database

Re: [HACKERS] Can pg_dump make use of CURRENT/SESSION_USER

2015-03-18 Thread Fabrízio de Royes Mello
On Wed, Mar 18, 2015 at 1:24 PM, Robert Haas wrote: > > On Tue, Mar 17, 2015 at 1:24 PM, Alvaro Herrera > wrote: > > If we ever implement something like > > > > COMMENT ON CURRENT_DATABASE IS ... > > > > it will be useful, because you will be able to restore a dump into > > another database and h

Re: [HACKERS] Can pg_dump make use of CURRENT/SESSION_USER

2015-03-18 Thread Robert Haas
On Tue, Mar 17, 2015 at 1:24 PM, Alvaro Herrera wrote: > If we ever implement something like > > COMMENT ON CURRENT_DATABASE IS ... > > it will be useful, because you will be able to restore a dump into > another database and have the comment apply to the target database. > (Also, I wonder about >

Re: [HACKERS] Can pg_dump make use of CURRENT/SESSION_USER

2015-03-17 Thread Alvaro Herrera
Bruce Momjian wrote: > > Are there any use-cases for pg_dump to use CURRENT/SESSION_USER in its > output, so that restores will not be hard-coded to the dump user? I > didn't see any cases of that, but wanted to ask. Good question. I don't know, probably not. If we ever implement something lik

[HACKERS] Can pg_dump make use of CURRENT/SESSION_USER

2015-03-17 Thread Bruce Momjian
Are there any use-cases for pg_dump to use CURRENT/SESSION_USER in its output, so that restores will not be hard-coded to the dump user? I didn't see any cases of that, but wanted to ask. pg_dump doesn't have to restore into old clusters so there isn't a problem with backward compatibility. ---