On Jun 30, 2005, at 8:13 PM, Bernd Helmle wrote:

I currently recognized that a SERIAL column doesn't only create an implicit sequence, it creates an implicit composite type with the same name, too. I think this is the same for CREATE SEQUENCE?

Sequences are just special types of tables. All tables have a corresponding composite type, so sequences do as well.

CREATE TABLE foo (foo_id serial); is a shorthand for

CREATE SEQUENCE foo_foo_id_seq;
CREATE TABLE foo (foo_id integer default nextval ('foo_foo_id_seq'::text));

Using SERIAL implies CREATE SEQUENCE.

Does this help?

Michael Glaesemann
grzm myrealbox com



---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

              http://archives.postgresql.org

Reply via email to