Bug #743: pg_dump -a -c without DELETE FROM

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

Bug #743: pg_dump -a -c without DELETE FROM

От:
pgsql-bugs@postgresql.org
Дата:
Przemyslaw Sztoch (psztoch@interia.pl) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
pg_dump -a -c without DELETE FROM

Long Description
In my opinion "pg_dump -a -c" should generate "DELETE FROM " before COPY statement.
Options:
  -a, --data-only          dump only the data, not the schema
  -c, --clean              clean (drop) schema prior to create
TIA for answer or your opinions.

Sample Code


No file was uploaded with this report

Re: Bug #743: pg_dump -a -c without DELETE FROM

От:
Philip Warner <pjw@rhyme.com.au>
Дата:
At 10:40 22/08/2002 -0400, pgsql-bugs@postgresql.org wrote:
>   -c, --clean              clean (drop) schema prior to create

Given that it is dropping the table, it does not really need to do a delete.



----------------------------------------------------------------
Philip Warner                    |     __---_____
Albatross Consulting Pty. Ltd.   |----/       -  \
(A.B.N. 75 008 659 498)          |          /(@)   ______---_
Tel: (+61) 0500 83 82 81         |                 _________  \
Fax: (+61) 0500 83 82 82         |                 ___________ |
Http://www.rhyme.com.au          |                /           \|
                                  |    --________--
PGP key available upon request,  |  /
and from pgp5.ai.mit.edu:11371   |/

Re: Bug #743: pg_dump -a -c without DELETE FROM

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
Philip Warner  writes:
> Given that it is dropping the table, it does not really need to do a delete.

But with -a it won't do the drop (I hope).

The combination -a -c seems rather useless to me, and I'd vote for
throwing an error.  I don't think emitting DELETE FROM would be very
useful in practice (at least not without a VACUUM) so I'm not in
favor of that.

			regards, tom lane

Re: Bug #743: pg_dump -a -c without DELETE FROM

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:

The following patch disables use of -a and -c together.  This will
appear in the next release.

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

pgsql-bugs@postgresql.org wrote:
> Przemyslaw Sztoch (psztoch@interia.pl) reports a bug with a severity of 3
> The lower the number the more severe it is.
> 
> Short Description
> pg_dump -a -c without DELETE FROM
> 
> Long Description
> In my opinion "pg_dump -a -c" should generate "DELETE FROM " before COPY statement.
> Options:
>   -a, --data-only          dump only the data, not the schema
>   -c, --clean              clean (drop) schema prior to create
> TIA for answer or your opinions.
> 
> Sample Code
> 
> 
> No file was uploaded with this report
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
> 

-- 
  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
Index: src/bin/pg_dump/pg_dump.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/pg_dump/pg_dump.c,v
retrieving revision 1.291
diff -c -c -r1.291 pg_dump.c
*** src/bin/pg_dump/pg_dump.c	22 Aug 2002 21:35:50 -0000	1.291
--- src/bin/pg_dump/pg_dump.c	27 Aug 2002 20:33:50 -0000
***************
*** 467,472 ****
--- 467,478 ----
  		exit(1);
  	}
  
+ 	if (dataOnly && outputClean)
+ 	{
+ 		write_msg(NULL, "The options \"clean\" (-c) and \"data only\" (-a) cannot be used together.\n");
+ 		exit(1);
+ 	}
+ 
  	if (outputBlobs && selectTablename != NULL && strlen(selectTablename) > 0)
  	{
  		write_msg(NULL, "Large object output is not supported for a single table.\n");

Re: Bug #743: pg_dump -a -c without DELETE FROM

От:
Przemysław Sztoch <psztoch@interia.pl>
Дата:
Witam Philip Warner!

22 sierpnia 2002, 16:49:47, zostało napisane:
>>   -c, --clean              clean (drop) schema prior to create

PW> Given that it is dropping the table, it does not really need to do a delete.
---
Ok. But I am talking about "pg_dump -a -c", not about "pg_dump -c".
When I am unloading data only, I can't drop my table!

---
Przemysław Sztoch, LTC Sp. z o.o.
psztoch@finn.pl, http://www.finn.pl, +48 (42) 684-98-91



Re: Bug #743: pg_dump -a -c without DELETE FROM

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
> Witam Philip Warner!
> 
> 22 sierpnia 2002, 16:49:47, zosta³o napisane:
> >>   -c, --clean              clean (drop) schema prior to create
> 
> PW> Given that it is dropping the table, it does not really need to do a delete.
> ---
> Ok. But I am talking about "pg_dump -a -c", not about "pg_dump -c".
> When I am unloading data only, I can't drop my table!

Well, the -a -c options only control what happens when the data is
reloaded.  It doesn't do anything to the database it is dumping.

-- 
  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
FAQ