From: | Justin <justin(at)emproshunts(dot)com> |
---|---|
To: | "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: MySQL to Postgres question |
Date: | 2008-03-21 18:07:55 |
Message-ID: | 47E3F97B.5020805@emproshunts.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Joshua D. Drake wrote:
>
> I am not sure about 8.3 but certainly earlier releases of PostgreSQL
> would have specific dependency issues when a sequence was applied to a
> a column after the fact, versus using the serial or bigserial
> psuedo-types.
>
> Sincerely,
>
> Joshua D. Drake
>
> - --
> The PostgreSQL Company since 1997: http://www.commandprompt.com/
> PostgreSQL Community Conference: http://www.postgresqlconference.org/
> United States PostgreSQL Association: http://www.postgresql.us/
> Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
>
>
You still get an error if creating a table that specifies a sequence
that does not exist yet. I like to control the name of the sequence,
plus the starting values or change the incrementing values.
I might have read something wrong but using serial tells PostgreSQL to
automatic transforms.
CREATE TABLE /|tablename|/ (
/|colname|/ SERIAL
to
CREATE SEQUENCE /|tablename|/_/|colname|/_seq;
CREATE TABLE /|tablename|/ (
/|colname|/ integer NOT NULL DEFAULT nextval('/|tablename|/_/|colname|/_seq'));
I copied this from the help files.
From | Date | Subject | |
---|---|---|---|
Next Message | Adam Rich | 2008-03-21 18:53:36 | Re: MySQL to Postgres question |
Previous Message | Webb Sprague | 2008-03-21 18:07:21 | Re: Table size |