Re: TIPO SERIAL

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Andrea <andrea(at)compesa(dot)com(dot)br>
Cc: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: TIPO SERIAL
Date: 2005-09-13 16:05:53
Message-ID: 20050913160553.GC17440@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

On Tue, Sep 13, 2005 at 11:28:03AM -0300, Andrea wrote:

> Gustaría de saber se es corecto usar o tipo serial numa tabla o es mejor
> definir INTEGER y despues crear una sequencia.
> Así
>
> CREATE TABLE nombre-tabla
> ( coluna SERIAL );

Es mejor usar SERIAL. De esa manera el sistema es consciente de que hay
una dependencia entre la secuencia y la tabla. Por ej. cuando borres la
tabla automaticamente se borrara la secuencia. Cuando hagas ALTER TABLE
... OWNER TO tambien se va a preocupar de ajustar la secuencia. Etc.

--
Alvaro Herrera -- Valdivia, Chile Architect, www.EnterpriseDB.com
"Right now the sectors on the hard disk run clockwise, but I heard a rumor that
you can squeeze 0.2% more throughput by running them counterclockwise.
It's worth the effort. Recommended." (Gerry Pourwelle)

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Alvaro Herrera 2005-09-13 16:15:00 Re: Inicio de seccion
Previous Message Roger Alejandro Flores Estepa 2005-09-13 15:57:43 encriptacion de datos