Обсуждение: pg_dump a specific schema

Поиск
Список
Период
Сортировка

pg_dump a specific schema

От
Neil Conway
Дата:
This patch allows pg_dump to dump the contents of a specific schema, and
updates the documentation for pg_dump.

I used the '-n' and '--namespace' command-line arguments. I did some
limited testing and it seems to work fine, but there may be some bugs
lurking in it...

BTW, If the user specifies a non-existent namespace, what should pg_dump
do? ISTM that printing an error message and aborting the dump is
probably best, but presently non-existent namespaces are ignored, since
-t follows a similar policy. Should we change both of these?

Cheers,

Neil
--
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC



Вложения

Re: pg_dump a specific schema

От
Bruce Momjian
Дата:
Neil Conway wrote:
> This patch allows pg_dump to dump the contents of a specific schema, and
> updates the documentation for pg_dump.
>
> I used the '-n' and '--namespace' command-line arguments. I did some
> limited testing and it seems to work fine, but there may be some bugs
> lurking in it...
>
> BTW, If the user specifies a non-existent namespace, what should pg_dump
> do? ISTM that printing an error message and aborting the dump is
> probably best, but presently non-existent namespaces are ignored, since
> -t follows a similar policy. Should we change both of these?

I can't think of any logic that would allow a table to be skipped on a
dump, same with namespaces.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: pg_dump a specific schema

От
Neil Conway
Дата:
On Fri, 2003-01-10 at 13:32, Bruce Momjian wrote:
> I can't think of any logic that would allow a table to be skipped on a
> dump, same with namespaces.

Uh, what? The issue is that:

pg_dump -t some_non_existent_table_name

produces an empty dump (well, it has a 3 lines of comments, but no SQL).
Similarly:

pg_dump -n some_non_existent_schema_name

also produces an empty dump. I'm asking if that's the correct behavior:
perhaps we should throw an error instead?

Cheers,

Neil
--
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC




Re: pg_dump a specific schema

От
Bruce Momjian
Дата:
Neil Conway wrote:
> On Fri, 2003-01-10 at 13:32, Bruce Momjian wrote:
> > I can't think of any logic that would allow a table to be skipped on a
> > dump, same with namespaces.
>
> Uh, what? The issue is that:
>
> pg_dump -t some_non_existent_table_name
>
> produces an empty dump (well, it has a 3 lines of comments, but no SQL).
> Similarly:
>
> pg_dump -n some_non_existent_schema_name
>
> also produces an empty dump. I'm asking if that's the correct behavior:
> perhaps we should throw an error instead?

We certainly should throw an error!

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: pg_dump a specific schema

От
Peter Eisentraut
Дата:
Neil Conway writes:

> I used the '-n' and '--namespace' command-line arguments.

Please do not export the term namespace to the user space.  Use schema
instead.

--
Peter Eisentraut   peter_e@gmx.net


Re: pg_dump a specific schema

От
Neil Conway
Дата:
On Fri, 2003-01-10 at 17:08, Peter Eisentraut wrote:
> Please do not export the term namespace to the user space.  Use schema
> instead.

Oh, yeah -- I was going to ask about that. If I should use "schema",
what command-line argument do you suggest? (-s and -S are taken)

Cheers,

Neil
--
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC




Re: pg_dump a specific schema

От
"Ross J. Reedstrom"
Дата:
On Fri, Jan 10, 2003 at 11:08:09PM +0100, Peter Eisentraut wrote:
> Neil Conway writes:
>
> > I used the '-n' and '--namespace' command-line arguments.
>
> Please do not export the term namespace to the user space.  Use schema
> instead.

Here we have the problem of colliding nomenclature. Pg_dump already uses
the word schema in its generic RDB sense, rather than its SQL standard
sense. Got any ideas on what to call it instead? One option would be to
bite the bullet, and rename our current 'schema-only' option to 'DDL-only'
although that's not completely accurate.

BTW, -n _was_ the 'suppress unneeded quotes' flag/option. You overrode that?

Ross

Re: pg_dump a specific schema

От
Neil Conway
Дата:
On Fri, 2003-01-10 at 17:14, Ross J. Reedstrom wrote:
> BTW, -n _was_ the 'suppress unneeded quotes' flag/option. You overrode that?

No, that's not been present since 7.3

Cheers,

Neil


Re: pg_dump a specific schema

От
"Ross J. Reedstrom"
Дата:
On Fri, Jan 10, 2003 at 05:23:20PM -0500, Neil Conway wrote:
> On Fri, 2003-01-10 at 17:14, Ross J. Reedstrom wrote:
> > BTW, -n _was_ the 'suppress unneeded quotes' flag/option. You overrode that?
>
> No, that's not been present since 7.3

Right, sorry, I was looking on the older install (a 7.2 box)

Ross

Re: pg_dump a specific schema

От
Bruce Momjian
Дата:
Peter Eisentraut wrote:
> Neil Conway writes:
>
> > I used the '-n' and '--namespace' command-line arguments.
>
> Please do not export the term namespace to the user space.  Use schema
> instead.

We already exported it as \dn for namespace/schema.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: pg_dump a specific schema

От
Neil Conway
Дата:
On Fri, 2003-01-10 at 16:45, Bruce Momjian wrote:
> Neil Conway wrote:
> > I'm asking if that's the correct behavior:
> > perhaps we should throw an error instead?
>
> We certainly should throw an error!

Ok, I've attached a revised version of the patch that throws an error if
the user specifies a non-existent object for "-t" or "-n". I also made a
few minor updates and documentation improvements.

I'll change the command-line args once we've reached a consensus on what
they should be.

Cheers,

Neil
--
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC



Вложения

Re: pg_dump a specific schema

От
Christopher Kings-Lynne
Дата:
> > I used the '-n' and '--namespace' command-line arguments.
>
> Please do not export the term namespace to the user space.  Use schema
> instead.

Hmmm - what about \dn and \? in psql CVS?

Chris


Re: pg_dump a specific schema

От
Bruce Momjian
Дата:
Your patch has been added to the PostgreSQL unapplied patches list at:

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

I will try to apply it within the next 48 hours.

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


Neil Conway wrote:
> On Fri, 2003-01-10 at 16:45, Bruce Momjian wrote:
> > Neil Conway wrote:
> > > I'm asking if that's the correct behavior:
> > > perhaps we should throw an error instead?
> >
> > We certainly should throw an error!
>
> Ok, I've attached a revised version of the patch that throws an error if
> the user specifies a non-existent object for "-t" or "-n". I also made a
> few minor updates and documentation improvements.
>
> I'll change the command-line args once we've reached a consensus on what
> they should be.
>
> Cheers,
>
> Neil
> --
> Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC
>
>

[ Attachment, skipping... ]

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: pg_dump a specific schema

От
Peter Eisentraut
Дата:
Please wait till we resolve the naming of the command-line arguments.

Bruce Momjian writes:

> Your patch has been added to the PostgreSQL unapplied patches list at:
>
>     http://momjian.postgresql.org/cgi-bin/pgpatches
>
> I will try to apply it within the next 48 hours.
>
> ---------------------------------------------------------------------------
>
>
> Neil Conway wrote:
> > On Fri, 2003-01-10 at 16:45, Bruce Momjian wrote:
> > > Neil Conway wrote:
> > > > I'm asking if that's the correct behavior:
> > > > perhaps we should throw an error instead?
> > >
> > > We certainly should throw an error!
> >
> > Ok, I've attached a revised version of the patch that throws an error if
> > the user specifies a non-existent object for "-t" or "-n". I also made a
> > few minor updates and documentation improvements.
> >
> > I'll change the command-line args once we've reached a consensus on what
> > they should be.
> >
> > Cheers,
> >
> > Neil
> > --
> > Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC
> >
> >
>
> [ Attachment, skipping... ]
>
>

--
Peter Eisentraut   peter_e@gmx.net




Re: pg_dump a specific schema

От
Peter Eisentraut
Дата:
Neil Conway writes:

> Oh, yeah -- I was going to ask about that. If I should use "schema",
> what command-line argument do you suggest? (-s and -S are taken)

I don't care what you use for short options if all useful ones are taken.
But the long option should be --schema.

--
Peter Eisentraut   peter_e@gmx.net



Re: pg_dump a specific schema

От
Bruce Momjian
Дата:
Removed from queue at the request of Peter.

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

Neil Conway wrote:
> On Fri, 2003-01-10 at 16:45, Bruce Momjian wrote:
> > Neil Conway wrote:
> > > I'm asking if that's the correct behavior:
> > > perhaps we should throw an error instead?
> >
> > We certainly should throw an error!
>
> Ok, I've attached a revised version of the patch that throws an error if
> the user specifies a non-existent object for "-t" or "-n". I also made a
> few minor updates and documentation improvements.
>
> I'll change the command-line args once we've reached a consensus on what
> they should be.
>
> Cheers,
>
> Neil
> --
> Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC
>
>

[ Attachment, skipping... ]

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: pg_dump a specific schema

От
Neil Conway
Дата:
On Sun, 2003-01-12 at 11:55, Peter Eisentraut wrote:
> I don't care what you use for short options if all useful ones are taken.
> But the long option should be --schema.

Ok, fair enough: a revised patch is attached that uses the '-n' short
option and the '--schema' long option.

Cheers,

Neil
--
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC



Вложения

Re: pg_dump a specific schema

От
Bruce Momjian
Дата:
Your patch has been added to the PostgreSQL unapplied patches list at:

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

I will try to apply it within the next 48 hours.

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


Neil Conway wrote:
> On Sun, 2003-01-12 at 11:55, Peter Eisentraut wrote:
> > I don't care what you use for short options if all useful ones are taken.
> > But the long option should be --schema.
>
> Ok, fair enough: a revised patch is attached that uses the '-n' short
> option and the '--schema' long option.
>
> Cheers,
>
> Neil
> --
> Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC
>
>

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: pg_dump a specific schema

От
Bruce Momjian
Дата:
Patch applied.  Thanks.

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



Neil Conway wrote:
> On Sun, 2003-01-12 at 11:55, Peter Eisentraut wrote:
> > I don't care what you use for short options if all useful ones are taken.
> > But the long option should be --schema.
>
> Ok, fair enough: a revised patch is attached that uses the '-n' short
> option and the '--schema' long option.
>
> Cheers,
>
> Neil
> --
> Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC
>
>

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073