Re: Remove Modifiers on Table

Поиск
Список
Период
Сортировка
От Raymond O'Donnell
Тема Re: Remove Modifiers on Table
Дата
Msg-id 4DD29E5D.8030007@iol.ie
обсуждение исходный текст
Ответ на Re: Remove Modifiers on Table  (Carlos Mennens <carlos.mennens@gmail.com>)
Ответы Re: Remove Modifiers on Table
Список pgsql-general
On 17/05/2011 16:26, Carlos Mennens wrote:
> On Tue, May 17, 2011 at 11:22 AM, Jaime Casanova<jaime@2ndquadrant.com>  wrote:
>> in postgres is as easy as
>>
>> CREATE TABLE test(
>>   id SERIAL PRIMARY KEY);
>>
>> hey! it's even less keystrokes!
>
> I don't understand how this command above is associated with being
> able to auto increment the 'id' column. Sorry I'm still learning a
> lot...

Well, the SERIAL pseudo-type creates the sequence, associates it with
the column, and sets a DEFAULT on the column which executes the
nextval() function on the sequence - all in one fell swoop. Read all
about it here:

http://www.postgresql.org/docs/9.0/static/datatype-numeric.html#DATATYPE-SERIAL

Ray.


--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie

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

Предыдущее
От: Christopher Opena
Дата:
Сообщение: Re: Granting privileges on all tables,sequences , views, procedures
Следующее
От: Carlos Mennens
Дата:
Сообщение: Re: Remove Modifiers on Table