Re: Referencing Serial Type as Foreign Key

Поиск
Список
Период
Сортировка
От Joshua D. Drake
Тема Re: Referencing Serial Type as Foreign Key
Дата
Msg-id 42A091A7.4050802@commandprompt.com
обсуждение исходный текст
Ответ на Referencing Serial Type as Foreign Key  (Rich Shepard <rshepard@appl-ecosys.com>)
Ответы Re: Referencing Serial Type as Foreign Key  (Rich Shepard <rshepard@appl-ecosys.com>)
Список pgsql-general
Rich Shepard wrote:
>   Don't know why I've not come across this before, but I have now.
>
>   In a table definition I reference the primary key of another table. That
> key is of datatype SERIAL. In the referencing table, do I define the column
> as
>
>   col_name INTEGER REFERENCES other-table (primary_key_field),
>
> or is the datatype SERIAL because that's what the referenced
> primary_key_field is?

Serial is a psuedo type to integer/big (depending on the type of
serial). What you have above should work fine.

SIncerely,

Joshua D. Drake


>
> Thanks,
>
> Rich
>


--
Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240
PostgreSQL Replication, Consulting, Custom Programming, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/

В списке pgsql-general по дате отправления:

Предыдущее
От: Rich Shepard
Дата:
Сообщение: Referencing Serial Type as Foreign Key
Следующее
От: Rich Shepard
Дата:
Сообщение: Re: Referencing Serial Type as Foreign Key