From: | "Adam Rich" <adam(dot)r(at)sbcglobal(dot)net> |
---|---|
To: | "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "'Joshua D(dot) Drake'" <jd(at)commandprompt(dot)com> |
Cc: | "'Justin'" <justin(at)emproshunts(dot)com>, "'Edward Blake'" <comedian(dot)watchman(at)gmail(dot)com>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: MySQL to Postgres question |
Date: | 2008-03-21 18:53:36 |
Message-ID: | 00e101c88b84$df1bbca0$9d5335e0$@r@sbcglobal.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> > 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.
I'd like to point out that using pg_dump does in fact apply sequences
to columns after the fact. (at least in 8.3) Columns lose their "serial"
designation after each backup/restore (and therefore during version
upgrades)
mydb=# create table foo(id serial, bar varchar);
NOTICE: CREATE TABLE will create implicit sequence "foo_id_seq" for serial
column "foo.id"
CREATE TABLE
Then, pg_dump produces:
-bash-3.00$ pg_dump -s --table=foo mydb
CREATE TABLE foo (
id integer NOT NULL,
bar character varying
);
CREATE SEQUENCE foo_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
ALTER SEQUENCE foo_id_seq OWNED BY foo.id;
ALTER TABLE foo ALTER COLUMN id SET DEFAULT nextval('foo_id_seq'::regclass);
From | Date | Subject | |
---|---|---|---|
Next Message | Gauthier, Dave | 2008-03-21 18:56:14 | begin-end blocks in psql |
Previous Message | Justin | 2008-03-21 18:07:55 | Re: MySQL to Postgres question |