Search Postgresql Archives

Re: stored procs

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

 



For tables that already exist and have a foreign key relationship, is there an equivalent alter statement for the statement below?

Does this mean that if table xxx.id primary key value changes, the foreign key value will change as well?

If this is the case, then would not have to match up all the foreign keys to the new re-sequenced id.

Also another question: if the "id serial primary key", do I need to create a sequence at all? Or is that managed by the database?

Typically you have to link the id to the database sequence object, but it looks as in this case no "CREATE SEQUENCE" would be needed.

thanks


J.V.

On 9/30/2011 2:45 AM, John R Pierce wrote:
create table yyy (id serial primary key, xxx_id int references xxx(id));

--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[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