Re: MySQL to Postgres question

Поиск
Список
Период
Сортировка
От Adam Rich
Тема Re: MySQL to Postgres question
Дата
Msg-id 00e101c88b84$df1bbca0$9d5335e0$@r@sbcglobal.net
обсуждение исходный текст
Ответ на Re: MySQL to Postgres question  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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);




В списке pgsql-general по дате отправления:

Предыдущее
От: "Edmund.Bacon"
Дата:
Сообщение: Re: Cast character to boolean
Следующее
От: "Gauthier, Dave"
Дата:
Сообщение: begin-end blocks in psql