Re: Mysql -> Postgresql pitfalls - Mailing list pgsql-docs

From Rod Taylor
Subject Re: Mysql -> Postgresql pitfalls
Date
Msg-id 1060030888.91190.22.camel@jester
Whole thread Raw
In response to Re: Mysql -> Postgresql pitfalls  ("scott.marlowe" <scott.marlowe@ihs.com>)
List pgsql-docs
> speak in the \copy command.  I.e. you wouldn't use inserts to load your
> data, you'd use a bulk copy, which bypassess all the serial / IDENTITY
> stuff.  Basically, with the IDENTITY type, if you try to insert a value,

COPY enforces everything that insert does.  It's simply a little quicker
than insert due to a different string parsing method and avoiding places
that are for advanced features (subselects, functions, etc.).

A default is still applied if the column has not been provided.
Likewise, triggers (constraint triggers anyway) still run.

Bumping the start value for an IDENTITY is simple:

CREATE TABLE tab (
 col integer GENERATED ALWAYS AS IDENTITY(START WITH 42)
);

I suppose we'll need a GUC so that GENERATED ALWAYS isn't actually
always -- just usually.

Attachment

pgsql-docs by date:

Previous
From: "Chad N. Tindel"
Date:
Subject: Re: Mysql -> Postgresql pitfalls
Next
From: Lamar Owen
Date:
Subject: Re: Mysql -> Postgresql pitfalls