Re: psql vs perl prepared inserts - Mailing list pgsql-general

From Mike Rylander
Subject Re: psql vs perl prepared inserts
Date
Msg-id [email protected]
Whole thread Raw
In response to Re: psql vs perl prepared inserts  (Dawid Kuroczko <[email protected]>)
List pgsql-general
Just to add some clarity to the Dawid's fine comments:

On 4/14/05, Dawid Kuroczko <[email protected]> wrote:
> On 4/13/05, Matt Van Mater <[email protected]> wrote:
> I believe that COPY handles things like unique constraints and
> referer integerity just fine (of the latter I am not sure) -- well,
> its hard to imagine PostgreSQL allowing itself to loose integrity
> of the data, don't you agree?
>

I do, and so does PG. :)  Everything that would normally happen with
an INSERT, including firing TRIGGERs, checking FKEYs, setting
DEFAULTs, running CHECK constraints -- everything -- happens with a
COPY import.

The *one and only* exception to the above statement is that RULEs to
not get used on COPY.  The reason for this is that RULEs rewrite
queries and after the COPY FROM header there isn't a query to rewrite,
it's just a pile of data.

This is in the docs, but it's not easy to find.  It's actually just
one line in the "Notes" section of
http://www.postgresql.org/docs/8.0/static/sql-copy.html .  Perhaps we
should add some more verbiage (he says, non-voluntarily...)?

--
Mike Rylander
[email protected]
GPLS -- PINES Development
Database Developer
http://open-ils.org

pgsql-general by date:

Previous
From: Sibtay Abbas
Date:
Subject: Re: Checking cursor's state in plpgsql
Next
From: Hugo
Date:
Subject: Re: grant all privileges to all tables in a database