Re: psql vs perl prepared inserts

From: Mike Rylander <mrylander(at)gmail(dot)com>
To: Dawid Kuroczko <qnex42(at)gmail(dot)com>
Cc: Matt Van Mater <matt(dot)vanmater(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: psql vs perl prepared inserts
Date: 2005-04-14 11:15:39
Message-ID: b918cf3d0504140415574151a8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Just to add some clarity to the Dawid's fine comments:

On 4/14/05, Dawid Kuroczko <qnex42(at)gmail(dot)com> wrote:
> On 4/13/05, Matt Van Mater <matt(dot)vanmater(at)gmail(dot)com> 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
mrylander(at)gmail(dot)com
GPLS -- PINES Development
Database Developer
http://open-ils.org

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Hugo 2005-04-14 13:38:52 Re: grant all privileges to all tables in a database
Previous Message Sibtay Abbas 2005-04-14 09:32:56 Re: Checking cursor's state in plpgsql