[7.4beta3] pg_dump -t xxx won't output sequences

Started by Tomas Szepeover 22 years ago4 messagesbugs
Jump to latest
#1Tomas Szepe
szepe@pinerecords.com

Hi,

Not sure if this is a bug, but still. :)
Compare:

<cut>

pgsql7.3.4$ pg_dump -a -t seq_wtmp db1
--
-- PostgreSQL database dump
--

\connect - kala

SET search_path = public, pg_catalog;

--
-- TOC entry 1 (OID 800427)
-- Name: seq_wtmp; Type: SEQUENCE SET; Schema: public; Owner: kala
--

SELECT pg_catalog.setval ('seq_wtmp', 3928, true);

<cut>

pgsql7.4beta3$ pg_dump -a -t seq_wtmp db1
pg_dump: specified table "seq_wtmp" does not exist

<cut>

seq_wtmp is a perfectly normal sequence.

Bye,
--
Tomas Szepe <szepe@pinerecords.com>

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Tomas Szepe (#1)
Re: [7.4beta3] pg_dump -t xxx won't output sequences

Tomas Szepe <szepe@pinerecords.com> writes:

Not sure if this is a bug, but still. :)

pgsql7.3.4$ pg_dump -a -t seq_wtmp db1
[ works ]

pgsql7.4beta3$ pg_dump -a -t seq_wtmp db1
pg_dump: specified table "seq_wtmp" does not exist

Looking at the CVS history, I see that Neil added code to deliberately
reject this case, but I don't understand why.

/*
* If the user is attempting to dump a specific table, check to ensure
* that the specified table actually exists (and is a table or a view,
* not a sequence).
*/
if (selectTableName)
{
for (i = 0; i < ntups; i++)
if (strcmp(tblinfo[i].relname, selectTableName) == 0 &&
tblinfo[i].relkind != 'S')
break;

Neil, what's the reason not to allow dumping just a sequence?

regards, tom lane

#3Neil Conway
neilc@samurai.com
In reply to: Tom Lane (#2)
Re: [7.4beta3] pg_dump -t xxx won't output sequences

On Sat, 2003-09-27 at 14:23, Tom Lane wrote:

/*
* If the user is attempting to dump a specific table, check to ensure
* that the specified table actually exists (and is a table or a view,
* not a sequence).
*/
if (selectTableName)
{
for (i = 0; i < ntups; i++)
if (strcmp(tblinfo[i].relname, selectTableName) == 0 &&
tblinfo[i].relkind != 'S')
break;

Neil, what's the reason not to allow dumping just a sequence?

Good question. I can't see a good reason not to allow it, and I can't
recall my original reason for including that code. Please go ahead and
revert it (or let me know and I'll submit a patch myself).

Sorry about that.

-Neil

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Neil Conway (#3)
Re: [7.4beta3] pg_dump -t xxx won't output sequences

Neil Conway <neilc@samurai.com> writes:

On Sat, 2003-09-27 at 14:23, Tom Lane wrote:

Neil, what's the reason not to allow dumping just a sequence?

Good question. I can't see a good reason not to allow it, and I can't
recall my original reason for including that code. Please go ahead and
revert it (or let me know and I'll submit a patch myself).

Okay, I removed the check on relkind.

regards, tom lane