Re: Creating Primary Key after CREATE TABLE: Is Sequence created?
От | Adrian Klaver |
---|---|
Тема | Re: Creating Primary Key after CREATE TABLE: Is Sequence created? |
Дата | |
Msg-id | 5245EA0C.6060904@gmail.com обсуждение исходный текст |
Ответ на | Re: Creating Primary Key after CREATE TABLE: Is Sequence created? (Monosij <monosij.forums@gmail.com>) |
Ответы |
Re: Creating Primary Key after CREATE TABLE: Is Sequence created?
|
Список | pgsql-general |
On 09/27/2013 01:16 PM, Monosij wrote: > Ok I understand about not programming to LCD. > > I just initially wanted to play around with creating tables / indexes / fks > and import some data before moving to next steps. > > I did want to have some control over namimg conventions. > > For eg. with creating PK id and sequence with 1 statement as: > id serial primary key > I have a vague idea how the primary key and sequence was named but no > control on it. > > However if I could control the naming convention from here I would be ok > with it. > > Would there be a way to control the naming of the id and sequence from the > create table statement? Using serial, remembering that serial is basically a macro that does what is shown here: http://www.postgresql.org/docs/9.3/interactive/datatype-numeric.html#DATATYPE-SERIAL Name your table and id column to get the desired sequence name. Otherwise do as shown in the expanded example in the link above and wrap multiple statements in a transaction and create the sequence and id as you want. > > Thank you. > > > > -- > View this message in context: http://postgresql.1045698.n5.nabble.com/Creating-Primary-Key-after-CREATE-TABLE-Is-Sequence-created-tp5772633p5772651.html > Sent from the PostgreSQL - general mailing list archive at Nabble.com. > > -- Adrian Klaver adrian.klaver@gmail.com
В списке pgsql-general по дате отправления: