Search Postgresql Archives

Change SERIAL to INTEGER

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

 



Hi everybody:

In a computer which is un production, I have a PostgreSQL 7.4 database. In a couple of tables, I have just realised that I made a small mistake: the primary key is SERIAL but what I really need is an INTEGER, since I do not need the auto-increment feature or the sequence. Until now, this has not created any problem, since all INSERTs set the primary key value, but I am not sure if in the future this could cause any problem. I cannot drop and recreate the table or the column, since this column is a used as foreign keys in other tables.

I have already tried to do the following:

ALTER TABLE mytable ALTER COLUMN mytableid DROP DEFAULT;
DROP SEQUENCE mytable_mytableid_seq;

but the last command fails, saying that mytable still uses this sequence.

Is there any way to change a SERIAL type to an INTEGER? I think that it should be easy, since SERIAL is, in fact, an INTEGER with some conditions.

Thanks!

Pedro


[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