Patch for pg_dump

Started by Dany DeBontridderalmost 19 years ago9 messages
#1Dany DeBontridder
dany118@gmail.com

Here is a (small) patch to give the ability to pg_dump to export only the
functions (or only one), very useful when you often develop with psql (
postgresql.8.2.3)

Usage:
pg_dump -Q function_name DATABASE export function_name
pg_dump -Q DATABASE export all the functions

This patch is distributed under the BSD licence

Regards,

D.

PS: I hope it is the correct ml, otherwise excuse me, it is the first time I
propose a patch for postgresql

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Dany DeBontridder (#1)
Re: Patch for pg_dump

"Dany DeBontridder" <dany118@gmail.com> writes:

Usage:
pg_dump -Q function_name DATABASE export function_name
pg_dump -Q DATABASE export all the functions

What of overloading? And your switch syntax seems ambiguous anyway.

btw, I see no patch here...

regards, tom lane

#3Bruce Momjian
bruce@momjian.us
In reply to: Dany DeBontridder (#1)
Re: Patch for pg_dump

And the patch is so small, it is invisible (missing). ;-)

---------------------------------------------------------------------------

Dany DeBontridder wrote:

Here is a (small) patch to give the ability to pg_dump to export only the
functions (or only one), very useful when you often develop with psql (
postgresql.8.2.3)

Usage:
pg_dump -Q function_name DATABASE export function_name
pg_dump -Q DATABASE export all the functions

This patch is distributed under the BSD licence

Regards,

D.

PS: I hope it is the correct ml, otherwise excuse me, it is the first time I
propose a patch for postgresql

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

#4Dany DeBontridder
dany118@gmail.com
In reply to: Bruce Momjian (#3)
1 attachment(s)
Re: Patch for pg_dump

Sorry I forgot the attach :-)

It is not perfect so bear with me, it is my first try.

Regards,

D.

Show quoted text

On 3/21/07, Bruce Momjian <bruce@momjian.us> wrote:

And the patch is so small, it is invisible (missing). ;-)

---------------------------------------------------------------------------

Dany DeBontridder wrote:

Here is a (small) patch to give the ability to pg_dump to export only

the

functions (or only one), very useful when you often develop with psql (
postgresql.8.2.3)

Usage:
pg_dump -Q function_name DATABASE export function_name
pg_dump -Q DATABASE export all the functions

This patch is distributed under the BSD licence

Regards,

D.

PS: I hope it is the correct ml, otherwise excuse me, it is the first

time I

propose a patch for postgresql

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

Attachments:

pg_dump-8.2.3.patch.gzapplication/x-gzip; name=pg_dump-8.2.3.patch.gzDownload
#5Bruce Momjian
bruce@momjian.us
In reply to: Dany DeBontridder (#4)
Re: Patch for pg_dump

I guess this matches this TODO item:

o Allow selection of individual object(s) of all types, not just
tables

Your patch has been added to the PostgreSQL unapplied patches list at:

http://momjian.postgresql.org/cgi-bin/pgpatches

It will be applied as soon as one of the PostgreSQL committers reviews
and approves it.

---------------------------------------------------------------------------

Dany DeBontridder wrote:

Sorry I forgot the attach :-)

It is not perfect so bear with me, it is my first try.

Regards,

D.

On 3/21/07, Bruce Momjian <bruce@momjian.us> wrote:

And the patch is so small, it is invisible (missing). ;-)

---------------------------------------------------------------------------

Dany DeBontridder wrote:

Here is a (small) patch to give the ability to pg_dump to export only

the

functions (or only one), very useful when you often develop with psql (
postgresql.8.2.3)

Usage:
pg_dump -Q function_name DATABASE export function_name
pg_dump -Q DATABASE export all the functions

This patch is distributed under the BSD licence

Regards,

D.

PS: I hope it is the correct ml, otherwise excuse me, it is the first

time I

propose a patch for postgresql

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

[ Attachment, skipping... ]

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

#6Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#5)
Re: Patch for pg_dump

Bruce Momjian <bruce@momjian.us> writes:

I guess this matches this TODO item:
o Allow selection of individual object(s) of all types, not just
tables

Well, it's a subset of it, but do we want to accept a patch that's been
designed with only a subset in mind? I'd like to see a roadmap for what
a complete facility for this would look like, to make sure we aren't
going down a dead end.

One thing that looks particularly dead-end-ish here is the switch name.
We might be well advised to have only long-form switches for these
things, 'cause we'll surely run out of suitable single letters (in fact,
if "Q" is as close as one can get to "function", we already have).

Another question that seems particularly relevant is how the patch scales
up to specifying (a) function's schema name, (b) argument types (in case
the function name is overloaded).

Code-wise, the patch seems a bit of a mess too --- it will certainly not
scale up to dumping some functions and some other things, as one would
expect for instance if one said "pg_dump -Q myfunc -t mytab ...". It
doesn't even look like it will handle multiple -Q switches. I think a
minimum expectation is that -Q would work like -t now does.

regards, tom lane

#7Andrew Dunstan
andrew@dunslane.net
In reply to: Tom Lane (#6)
Re: Patch for pg_dump

Tom Lane wrote:

Bruce Momjian <bruce@momjian.us> writes:

I guess this matches this TODO item:
o Allow selection of individual object(s) of all types, not just
tables

Well, it's a subset of it, but do we want to accept a patch that's been
designed with only a subset in mind? I'd like to see a roadmap for what
a complete facility for this would look like, to make sure we aren't
going down a dead end.

One thing that looks particularly dead-end-ish here is the switch name.
We might be well advised to have only long-form switches for these
things, 'cause we'll surely run out of suitable single letters (in fact,
if "Q" is as close as one can get to "function", we already have).

Another question that seems particularly relevant is how the patch scales
up to specifying (a) function's schema name, (b) argument types (in case
the function name is overloaded).

Code-wise, the patch seems a bit of a mess too --- it will certainly not
scale up to dumping some functions and some other things, as one would
expect for instance if one said "pg_dump -Q myfunc -t mytab ...". It
doesn't even look like it will handle multiple -Q switches. I think a
minimum expectation is that -Q would work like -t now does.

Along similar lines, what happened to the idea of pre-data and post-data
dump subsets that was discussed not so long ago, unless my memory is
playing tricks again?

cheers

andrew

#8Dany DeBontridder
dany118@gmail.com
In reply to: Tom Lane (#6)
Re: Patch for pg_dump

On 3/21/07, Tom Lane <tgl@sss.pgh.pa.us> wrote:

Bruce Momjian <bruce@momjian.us> writes:

I guess this matches this TODO item:
o Allow selection of individual object(s) of all types, not just
tables

(...)
Code-wise, the patch seems a bit of a mess too --- it will certainly not
scale up to dumping some functions and some other things, as one would
expect for instance if one said "pg_dump -Q myfunc -t mytab ...". It
doesn't even look like it will handle multiple -Q switches. I think a
minimum expectation is that -Q would work like -t now does.

Well it was my first patch :-) So I suggest to use a generic argument like
--object=function, which could be extended later to object=type, table,
sequence, trigger... But now I have another problem: how to specify a name ?

regards,

D.

Show quoted text
#9Bruce Momjian
bruce@momjian.us
In reply to: Dany DeBontridder (#4)
Re: Patch for pg_dump

Patch withdrawn by author, perhaps reworked in the future.

---------------------------------------------------------------------------

Dany DeBontridder wrote:

Sorry I forgot the attach :-)

It is not perfect so bear with me, it is my first try.

Regards,

D.

On 3/21/07, Bruce Momjian <bruce@momjian.us> wrote:

And the patch is so small, it is invisible (missing). ;-)

---------------------------------------------------------------------------

Dany DeBontridder wrote:

Here is a (small) patch to give the ability to pg_dump to export only

the

functions (or only one), very useful when you often develop with psql (
postgresql.8.2.3)

Usage:
pg_dump -Q function_name DATABASE export function_name
pg_dump -Q DATABASE export all the functions

This patch is distributed under the BSD licence

Regards,

D.

PS: I hope it is the correct ml, otherwise excuse me, it is the first

time I

propose a patch for postgresql

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

[ Attachment, skipping... ]

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +