Thread: Patch for pg_dump

Patch for pg_dump

From
"Dany DeBontridder"
Date:
Here is a (small) patch to give the ability to pg_dump to export only the functions (or only one), very useful when you
oftendevelop with psql (postgresql.8.2.3)<br /><br />Usage:<br /> pg_dump -Q function_name  DATABASE export
function_name<br /> pg_dump -Q                        DATABASE  export all the functions <br /><br />This patch is
distributedunder the BSD licence<br /><br /><br />Regards,<br /><br /><br /><br />D.<br /><br /><br />PS: I hope it is
thecorrect ml, otherwise excuse me, it is the first time I propose a patch for postgresql <br /> 

Re: Patch for pg_dump

From
Tom Lane
Date:
"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


Re: Patch for pg_dump

From
Bruce Momjian
Date:
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. +


Re: Patch for pg_dump

From
"Dany DeBontridder"
Date:
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

Re: Patch for pg_dump

From
Bruce Momjian
Date:
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. +


Re: Patch for pg_dump

From
Tom Lane
Date:
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


Re: Patch for pg_dump

From
Andrew Dunstan
Date:
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


Re: Patch for pg_dump

From
"Dany DeBontridder"
Date:


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.
 

                  

Re: Patch for pg_dump

From
Bruce Momjian
Date:
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. +