Re: Alternative Serial

From: "Milen A(dot) Radev" <milen(at)radev(dot)net>
To: pgadmin-support(at)postgresql(dot)org
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Alternative Serial
Date: 2007-03-11 16:54:32
Message-ID: et1c74$6f0$1@sea.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support pgsql-sql

Ezequias Rodrigues da Rocha написа:
> Yes you are right, I means sequences.
>

Please re-read my reply!

> The second way is better for me that have Id (PK) fields not defined as
> Sequences. Now it is much more difficult to change the type of my PK than

A field could not be defined as 'sequence', but as 'serial', because
'sequence' is a db object and 'serial' is a (pseudo-)type. The actual
type of a field defined as 'serial' is 'integer' (or 'bigint' in case of
'bigserial'). You could change the type of a field (defined as sequence
earlier) as easy as you could any other field. Or you could just change
its default value. Or anything else.

> define a Default value. I am just concerned about the consistency of this
> sequence. Could you make me more easy ?

What do you mean by 'consistency' here? Guaranteed uniqueness of the
numbers generated by the sequence? Pleas read the fine documentation
here - http://www.postgresql.org/docs/8.2/static/sql-createsequence.html.

>
> And about the cast I have found ?
>
> nextval('mySerial_id'::regclass)
>
> I ask again. What is regclass ? What does it really is.

I already answered that one, please re-read my reply and the pages it
mentions.

[...]

--
Milen A. Radev

In response to

Browse pgadmin-support by date

  From Date Subject
Next Message QuanZongliang 2007-03-12 02:48:50 Build wxWidgets-2.8.0 in Cygwin
Previous Message A. Kretschmer 2007-03-11 16:53:36 Re: Alternative Serial

Browse pgsql-sql by date

  From Date Subject
Next Message Jonah H. Harris 2007-03-11 20:30:49 Re: There is acid without transactions ?
Previous Message A. Kretschmer 2007-03-11 16:53:36 Re: Alternative Serial