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