Re: Remove Modifiers on Table - Mailing list pgsql-general

From Raymond O'Donnell
Subject Re: Remove Modifiers on Table
Date
Msg-id 4DD2A496.6060604@iol.ie
Whole thread Raw
In response to Re: Remove Modifiers on Table  (Carlos Mennens <carlos.mennens@gmail.com>)
Responses Re: Remove Modifiers on Table  (Carlos Mennens <carlos.mennens@gmail.com>)
List pgsql-general
On 17/05/2011 17:35, Carlos Mennens wrote:
> On Tue, May 17, 2011 at 12:12 PM, Raymond O'Donnell<rod@iol.ie>  wrote:
>> 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
>
> Wow I had no idea. So I do NOT need to manually create a sequence with:
>
> CREATE SEQUENCE blah_id_seq;
>
> And instead I can just use the SERIAL data type, unless I understood
> that wrong. I'm going to read up on the URL you provided.

Yes, that's exactly right - SERIAL does it all for you. The mistake some
people make, on the other hand, is thinking that SERIAL is a type in its
own right - it's not, it just does all those steps automatically.

Ray.

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

pgsql-general by date:

Previous
From: Carlos Mennens
Date:
Subject: Re: Remove Modifiers on Table
Next
From: Carlos Mennens
Date:
Subject: Re: Remove Modifiers on Table