Re: pg_restore multiple --function options

Lists: pgsql-hackers
From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: pg_restore multiple --function options
Date: 2013-08-26 19:29:06
Message-ID: 521BAC82.2000400@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

While looking at the pg_restore code, I noticed that while it supports
specifying multiple --table options to restore several tables, it does
not support multiple --function options. Or --index, --schema, or --trigger.

The support for multiple --table options was added in 9.3, in January.
See
http://www.postgresql.org/message-id/CAK3UJRG+yV1mK5twLfKVMCwXH4f6PnJou6Rn=ecabyfQH1vVHg@mail.gmail.com.
Was there a particular reason for only doing it for --table, or was it
just an oversight or lack of interest? No doubt that --table is the most
interesting one, but IMHO the other options should behave the same, for
the sake of consistency.

- Heikki


From: David Fetter <david(at)fetter(dot)org>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: Josh Kupershmidt <schmiddy(at)gmail(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: pg_restore multiple --function options
Date: 2013-08-26 20:17:34
Message-ID: 20130826201734.GD16776@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, Aug 26, 2013 at 10:29:06PM +0300, Heikki Linnakangas wrote:
> Hi,
>
> While looking at the pg_restore code, I noticed that while it
> supports specifying multiple --table options to restore several
> tables, it does not support multiple --function options. Or --index,
> --schema, or --trigger.
>
> The support for multiple --table options was added in 9.3, in
> January. See http://www.postgresql.org/message-id/CAK3UJRG+yV1mK5twLfKVMCwXH4f6PnJou6Rn=ecabyfQH1vVHg@mail.gmail.com.
> Was there a particular reason for only doing it for --table, or was
> it just an oversight or lack of interest? No doubt that --table is
> the most interesting one, but IMHO the other options should behave
> the same, for the sake of consistency.

+1 for making them consistent. There will also be an improvement in
usability.

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: David Fetter <david(at)fetter(dot)org>
Cc: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Josh Kupershmidt <schmiddy(at)gmail(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_restore multiple --function options
Date: 2013-08-27 00:26:29
Message-ID: CAB7nPqRKJu7V9etahdiKpPe37Khv8NsmKSM9aoFVwtr237K_tA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Aug 27, 2013 at 5:17 AM, David Fetter <david(at)fetter(dot)org> wrote:
> On Mon, Aug 26, 2013 at 10:29:06PM +0300, Heikki Linnakangas wrote:
>> Hi,
>>
>> While looking at the pg_restore code, I noticed that while it
>> supports specifying multiple --table options to restore several
>> tables, it does not support multiple --function options. Or --index,
>> --schema, or --trigger.
>>
>> The support for multiple --table options was added in 9.3, in
>> January. See http://www.postgresql.org/message-id/CAK3UJRG+yV1mK5twLfKVMCwXH4f6PnJou6Rn=ecabyfQH1vVHg@mail.gmail.com.
>> Was there a particular reason for only doing it for --table, or was
>> it just an oversight or lack of interest? No doubt that --table is
>> the most interesting one, but IMHO the other options should behave
>> the same, for the sake of consistency.
>
> +1 for making them consistent. There will also be an improvement in
> usability.
+1. It would be good to have consistency there for all the objects.
--
Michael


From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, David Fetter <david(at)fetter(dot)org>, Josh Kupershmidt <schmiddy(at)gmail(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: pg_restore multiple --function options
Date: 2013-08-27 17:14:32
Message-ID: 521CDE78.3050208@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 27.08.2013 03:26, Michael Paquier wrote:
> On Tue, Aug 27, 2013 at 5:17 AM, David Fetter<david(at)fetter(dot)org> wrote:
>> On Mon, Aug 26, 2013 at 10:29:06PM +0300, Heikki Linnakangas wrote:
>>> While looking at the pg_restore code, I noticed that while it
>>> supports specifying multiple --table options to restore several
>>> tables, it does not support multiple --function options. Or --index,
>>> --schema, or --trigger.
>>>
>>> The support for multiple --table options was added in 9.3, in
>>> January. See http://www.postgresql.org/message-id/CAK3UJRG+yV1mK5twLfKVMCwXH4f6PnJou6Rn=ecabyfQH1vVHg@mail.gmail.com.
>>> Was there a particular reason for only doing it for --table, or was
>>> it just an oversight or lack of interest? No doubt that --table is
>>> the most interesting one, but IMHO the other options should behave
>>> the same, for the sake of consistency.
>>
>> +1 for making them consistent. There will also be an improvement in
>> usability.
> +1. It would be good to have consistency there for all the objects.

Would anyone object to backpatching that change to 9.3 ? The risk seems
very small, and it would be good to do the other options in the same
release as --table. It was an oversight to only do it for --table in 9.3.

Assuming no objections, I'll apply the attached patch to 9.3 and master
later tonight.

- Heikki

Attachment Content-Type Size
multiple-pg_restore-options-1.patch text/x-diff 5.3 KB

From: David Fetter <david(at)fetter(dot)org>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Josh Kupershmidt <schmiddy(at)gmail(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: pg_restore multiple --function options
Date: 2013-08-27 18:05:49
Message-ID: 20130827180549.GA18575@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Aug 27, 2013 at 08:14:32PM +0300, Heikki Linnakangas wrote:
> On 27.08.2013 03:26, Michael Paquier wrote:
> >On Tue, Aug 27, 2013 at 5:17 AM, David Fetter<david(at)fetter(dot)org> wrote:
> >>On Mon, Aug 26, 2013 at 10:29:06PM +0300, Heikki Linnakangas wrote:
> >>>While looking at the pg_restore code, I noticed that while it
> >>>supports specifying multiple --table options to restore several
> >>>tables, it does not support multiple --function options. Or --index,
> >>>--schema, or --trigger.
> >>>
> >>>The support for multiple --table options was added in 9.3, in
> >>>January. See http://www.postgresql.org/message-id/CAK3UJRG+yV1mK5twLfKVMCwXH4f6PnJou6Rn=ecabyfQH1vVHg@mail.gmail.com.
> >>>Was there a particular reason for only doing it for --table, or was
> >>>it just an oversight or lack of interest? No doubt that --table is
> >>>the most interesting one, but IMHO the other options should behave
> >>>the same, for the sake of consistency.
> >>
> >>+1 for making them consistent. There will also be an improvement in
> >>usability.
> >+1. It would be good to have consistency there for all the objects.
>
> Would anyone object to backpatching that change to 9.3 ?

I'm sure someone will, but I'm not that someone. It's not as though
the added syntax could have produced anything but a runtime error if
someone had it deployed, and the improvements both in usefulness and
consistency are compelling.

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, David Fetter <david(at)fetter(dot)org>, Josh Kupershmidt <schmiddy(at)gmail(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: pg_restore multiple --function options
Date: 2013-08-27 18:56:54
Message-ID: 19656.1377629814@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Heikki Linnakangas <hlinnakangas(at)vmware(dot)com> writes:
> On 27.08.2013 03:26, Michael Paquier wrote:
>> On Tue, Aug 27, 2013 at 5:17 AM, David Fetter<david(at)fetter(dot)org> wrote:
>>> On Mon, Aug 26, 2013 at 10:29:06PM +0300, Heikki Linnakangas wrote:
>>>> While looking at the pg_restore code, I noticed that while it
>>>> supports specifying multiple --table options to restore several
>>>> tables, it does not support multiple --function options. Or --index,
>>>> --schema, or --trigger.
>>>>
>>>> The support for multiple --table options was added in 9.3, in
>>>> January. See http://www.postgresql.org/message-id/CAK3UJRG+yV1mK5twLfKVMCwXH4f6PnJou6Rn=ecabyfQH1vVHg@mail.gmail.com.
>>>> Was there a particular reason for only doing it for --table, or was
>>>> it just an oversight or lack of interest? No doubt that --table is
>>>> the most interesting one, but IMHO the other options should behave
>>>> the same, for the sake of consistency.

>>> +1 for making them consistent. There will also be an improvement in
>>> usability.
>> +1. It would be good to have consistency there for all the objects.

> Would anyone object to backpatching that change to 9.3 ? The risk seems
> very small, and it would be good to do the other options in the same
> release as --table. It was an oversight to only do it for --table in 9.3.

> Assuming no objections, I'll apply the attached patch to 9.3 and master
> later tonight.

I object, strongly. This is a feature addition, and has no business going
in post-rc1, especially with no time for review.

As far as the function case goes, I'm not really thrilled about layering
more functionality on that until we've come to some understanding about
how to select from a group of overloaded functions. It may be that this
is orthogonal to that issue ... or maybe not. I don't have any objection
to fixing the non-function cases, as long as it's only in HEAD.

regards, tom lane


From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, David Fetter <david(at)fetter(dot)org>, Josh Kupershmidt <schmiddy(at)gmail(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: pg_restore multiple --function options
Date: 2013-08-27 19:35:40
Message-ID: 521CFF8C.3000802@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 27.08.2013 21:56, Tom Lane wrote:
> Heikki Linnakangas<hlinnakangas(at)vmware(dot)com> writes:
>> Would anyone object to backpatching that change to 9.3 ? The risk seems
>> very small, and it would be good to do the other options in the same
>> release as --table. It was an oversight to only do it for --table in 9.3.
>
>> Assuming no objections, I'll apply the attached patch to 9.3 and master
>> later tonight.
>
> I object, strongly. This is a feature addition, and has no business going
> in post-rc1, especially with no time for review.

Ok.

> As far as the function case goes, I'm not really thrilled about layering
> more functionality on that until we've come to some understanding about
> how to select from a group of overloaded functions. It may be that this
> is orthogonal to that issue ... or maybe not. I don't have any objection
> to fixing the non-function cases, as long as it's only in HEAD.

Huh, what's that issue?

As the code stands, you have to pass the argument types to the
--function flag, ie. --function="myfunc(integer)". It's annoyingly picky
about the spelling, as the it has to match exactly what pg_dump prints,
but it does handle selecting one function from a group of overloaded
ones. And that really is orthogonal to whether or not you can give
multiple --function arguments.

- Heikki


From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_restore multiple --function options
Date: 2013-08-27 19:55:57
Message-ID: 521D044D.2000302@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 08/27/2013 10:14 AM, Heikki Linnakangas wrote:
> Would anyone object to backpatching that change to 9.3 ? The risk seems
> very small, and it would be good to do the other options in the same
> release as --table. It was an oversight to only do it for --table in 9.3.
>
> Assuming no objections, I'll apply the attached patch to 9.3 and master
> later tonight.

That will pretty much force us to do an RC2, and therefore push back
final release date.

Just for consideration.

--
Josh Berkus
PostgreSQL Experts Inc.
http://pgexperts.com


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, David Fetter <david(at)fetter(dot)org>, Josh Kupershmidt <schmiddy(at)gmail(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: pg_restore multiple --function options
Date: 2013-08-27 20:21:42
Message-ID: 21970.1377634902@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Heikki Linnakangas <hlinnakangas(at)vmware(dot)com> writes:
> As the code stands, you have to pass the argument types to the
> --function flag, ie. --function="myfunc(integer)". It's annoyingly picky
> about the spelling, as the it has to match exactly what pg_dump prints,
> but it does handle selecting one function from a group of overloaded
> ones.

Oh --- OK, I was misremembering. I recalled that people weren't happy
with the handling of --function, but had the details wrong.

[pokes around]

I think really the issues are (1) it only works in pg_restore, not
pg_dump, and (2) there's no wildcard matching (the pickiness about
argument type name spelling being perhaps a subset of that).

It's probably true that accepting multiple patterns doesn't preclude
solving either of those, and indeed might help users work around (2).
So nevermind that objection. But I still say this is all too late
for 9.3.

regards, tom lane


From: David Fetter <david(at)fetter(dot)org>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Josh Kupershmidt <schmiddy(at)gmail(dot)com>, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: pg_restore multiple --function options
Date: 2013-08-27 20:31:27
Message-ID: 20130827203127.GC18575@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Aug 27, 2013 at 10:35:40PM +0300, Heikki Linnakangas wrote:
> On 27.08.2013 21:56, Tom Lane wrote:
> >Heikki Linnakangas<hlinnakangas(at)vmware(dot)com> writes:
> >>Would anyone object to backpatching that change to 9.3 ? The risk seems
> >>very small, and it would be good to do the other options in the same
> >>release as --table. It was an oversight to only do it for --table in 9.3.
> >
> >>Assuming no objections, I'll apply the attached patch to 9.3 and master
> >>later tonight.
> >
> >I object, strongly. This is a feature addition, and has no business going
> >in post-rc1, especially with no time for review.
>
> Ok.
>
> >As far as the function case goes, I'm not really thrilled about layering
> >more functionality on that until we've come to some understanding about
> >how to select from a group of overloaded functions. It may be that this
> >is orthogonal to that issue ... or maybe not. I don't have any objection
> >to fixing the non-function cases, as long as it's only in HEAD.
>
> Huh, what's that issue?
>
> As the code stands, you have to pass the argument types to the
> --function flag, ie. --function="myfunc(integer)". It's annoyingly
> picky about the spelling, as the it has to match exactly what
> pg_dump prints, but it does handle selecting one function from a
> group of overloaded ones. And that really is orthogonal to whether
> or not you can give multiple --function arguments.

Come to think of it, some kind of recognition that functions can come
in several flavors would be awesome, e.g.

--function=myfunc\*

which would capture all variants of myfunc.

Let the bikeshedding begin!

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, David Fetter <david(at)fetter(dot)org>, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: pg_restore multiple --function options
Date: 2013-09-06 01:15:09
Message-ID: CAK3UJRFjNh7Nfjw3JdLsFoCp3L9Kuh-=0KevoUH7jCd+BDnCog@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Aug 27, 2013 at 1:14 PM, Heikki Linnakangas
<hlinnakangas(at)vmware(dot)com> wrote:
> Assuming no objections, I'll apply the attached patch to 9.3 and master
> later tonight.

Just a little stylistic nitpick: could we pluralize the --help outputs
for the modified options so that they make clear that multiple
specifications are supported. E.g. "restore named index(es)" instead
of just "restore named index". The last round of such changes tried to
make such --help tweaks, it would be nice to keep 'em consistent.

Josh


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, David Fetter <david(at)fetter(dot)org>, Magnus Hagander <magnus(at)hagander(dot)net>
Subject: Re: pg_restore multiple --function options
Date: 2014-02-01 03:29:11
Message-ID: 20140201032911.GE31141@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Sep 5, 2013 at 09:15:09PM -0400, Josh Kupershmidt wrote:
> On Tue, Aug 27, 2013 at 1:14 PM, Heikki Linnakangas
> <hlinnakangas(at)vmware(dot)com> wrote:
> > Assuming no objections, I'll apply the attached patch to 9.3 and master
> > later tonight.
>
> Just a little stylistic nitpick: could we pluralize the --help outputs
> for the modified options so that they make clear that multiple
> specifications are supported. E.g. "restore named index(es)" instead
> of just "restore named index". The last round of such changes tried to
> make such --help tweaks, it would be nice to keep 'em consistent.

Agreed. Attached patch applied.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

Attachment Content-Type Size
restore.diff text/x-diff 2.6 KB