Search Postgresql Archives

Re: Changing ids conflicting with serial values?

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

 



Steven Brown wrote:

> When I change an id (primary key serial) in a table, the next value
> returned by the sequence for the id can conflict with that id (e.g.,
> change the id to be id + 1).  [...]
If you're doing this to have a custom ordering of your data, consider adding
another int column without PK so you can change whatever you want, and keep
an unique way to access (an identify) your data even if it has been
moved...

In my case I wanted to sort my row freely, my first tough was to use the
already existing id (serial PK) column and change it. That worked fine
until I tryied to move a row without freeing the destination first... I
added a new column and changed my "order by" to match its name. 

If this can help,
-- 
MaXX


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

[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