From: | Raymond O'Donnell <rod(at)iol(dot)ie> |
---|---|
To: | Carlos Mennens <carlos(dot)mennens(at)gmail(dot)com> |
Cc: | PostgreSQL <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Remove Modifiers on Table |
Date: | 2011-05-17 16:12:13 |
Message-ID: | 4DD29E5D.8030007@iol.ie |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 17/05/2011 16:26, Carlos Mennens wrote:
> On Tue, May 17, 2011 at 11:22 AM, Jaime Casanova<jaime(at)2ndquadrant(dot)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(at)iol(dot)ie
From | Date | Subject | |
---|---|---|---|
Next Message | Carlos Mennens | 2011-05-17 16:35:16 | Re: Remove Modifiers on Table |
Previous Message | Christopher Opena | 2011-05-17 15:27:55 | Re: Granting privileges on all tables,sequences , views, procedures |