Re: Mysql -> Postgresql pitfalls

From: Rod Taylor <rbt(at)rbt(dot)ca>
To: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
Cc: "Chad N(dot) Tindel" <chad(at)tindel(dot)net>, Josh Berkus <josh(at)agliodbs(dot)com>, PostgreSQL Docs <pgsql-docs(at)postgresql(dot)org>
Subject: Re: Mysql -> Postgresql pitfalls
Date: 2003-08-04 21:01:29
Message-ID: 1060030888.91190.22.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Lamar Owen 2003-08-04 21:08:41 Re: Mysql -> Postgresql pitfalls
Previous Message Chad N. Tindel 2003-08-04 19:29:48 Re: Mysql -> Postgresql pitfalls