Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-docs by date

Next:From: Lamar OwenDate: 2003-08-04 21:08:41
Subject: Re: Mysql -> Postgresql pitfalls
Previous:From: Chad N. TindelDate: 2003-08-04 19:29:48
Subject: Re: Mysql -> Postgresql pitfalls

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group