Search Postgresql Archives

Re: sequences not restoring properly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I need to amend what I said before; apparently, the 8.1.1 dump is creating correct sequence values (except in one instance), but it's changing the names to "match" the tables and columns they go with. Which is nice, I suppose, except that I use an object-relational mapping API that requires hard-coding of sequence names. Oh well... will the new version Postgres now prevent me from creating sequences by hand and associating them with tables, or renaming them, or renaming sequence columns? I sure hope so! Because if not, dumps should reflect any changes I've been able to make.

As for how the changes were made at first, to be honest, I don't remember. The vast majority of my tables were created with SERIAL columns initially and they retain the automatically-generated sequences that went with them.

I think what may have happened is that for a few tables, I decided to change the name of the serial column in question shortly after creating it; that's probably the case with the 'dbbandcode' example I posted.

In another case, I believe I had created an entirely new table ('items' and 'itemid'), but kept the original sequence from a previous table ('garments_garmentid_seq'), thinking I was going to use them in tandem, generating numbers for each that would not overlap. Unfortunately I had inadvertently left an auto-generated, but unused, items_itemid_seq in there too, so when 8.1.1 saw that it must have chucked garments_garmentid_seq and its value in favor of the one that appeared to match the table and column. The other tables had their values restored correctly, it's just that their *names* are now a little *too* 'correct'.

Brian

Joshua D. Drake wrote:

Brian Dimeler wrote:

Doing it that way doesn't produce any errors, but it still produces incorrect sequence names and values.

Are these sequences that you created by hand and then associated with a column? Versus using serial/bigserial types?

Sincerely,

Joshua D. Drake


Doug McNaught wrote:

Brian Dimeler <briand@xxxxxxxxxx> writes:


I'm trying to transition a database from one server to another, the
old one running Postgres 7.4.1 and the new, 8.1.1. When I try to
restore using a pg_dump plaintext sql file from a nightly backup via
the usual

psql thedb < backup.sql



The best way to do this is to run the 8.1.1 pg_dump against the 7.4.1
server.  The new pg_dump will know better how to create a backup that
8.1.1 will like.

-Doug


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux