Обсуждение: pg_dump error
I'm trying to back up a table by dumping to a text file,
but in the proccess of dumping I get the following error
dumpSequence(pilgram_en_id_seq): different sequence name returned by SELECT: pilgram_cross_id_seq
I'm not sure what this means, and I have no idea how to corect it.
Mike
"mike" <matrix@quadrent.net> writes: > dumpSequence(pilgram_en_id_seq): different sequence name returned by SELECT= > : pilgram_cross_id_seq > I'm not sure what this means, and I have no idea how to corect it. Looking at the source code, it would seem that pg_dump is unhappy because "SELECT sequence_name FROM pilgram_en_id_seq" returned "pilgram_cross_id_seq" instead of the expected "pilgram_en_id_seq". I'm not sure why exactly pg_dump is bothering to make such a cross-check, but probably the more interesting question is how the sequence got that way. Did you rename it at some point? I find that "ALTER TABLE RENAME" will work without complaint on a sequence. Seems we should either (a) prohibit renaming a sequence; (b) improve ALTER TABLE RENAME to know about changing the sequence_name field as well; (c) remove this cross-check from pg_dump; and/or (d) remove the sequence_name field from sequences entirely. (c) looks like the path of least resistance. I don't like (d) because of the risk of breaking existing application code that might look at the contents of sequences. Comments? regards, tom lane
> I find that "ALTER TABLE RENAME" will work without complaint on a > sequence. Seems we should either > (a) prohibit renaming a sequence; > (b) improve ALTER TABLE RENAME to know about changing the > sequence_name field as well; > (c) remove this cross-check from pg_dump; and/or > (d) remove the sequence_name field from sequences entirely. > > (c) looks like the path of least resistance. I don't like (d) because > of the risk of breaking existing application code that might look at > the contents of sequences. Comments? I know for a particular program I wrote, I wrote function that you feed it a tablename and the serial fieldname and it spits back the currval, or the nextval. I don't foresee renaming these fields or the sequences, but things change. It seems like (b) provides the most straightforward and predictable behavior. Then again, I don't have to code it :) Greg