Re: BUG #2437: Rules for COPY

Lists: pgsql-bugs
From: "Anton Fedorov" <datacompboy(at)mail(dot)ru>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2437: Rules for COPY
Date: 2006-05-13 11:52:51
Message-ID: 200605131152.k4DBqp6b023058@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 2437
Logged by: Anton Fedorov
Email address: datacompboy(at)mail(dot)ru
PostgreSQL version: 8.1.3-3
Operating system: debian linux
Description: Rules for COPY
Details:

Looks like COPY bypass rules 'ON INSERT INSTEAD'.
I think, COPY .. FROM ... should be equal to
INSERT INTO ... SELECT * FROM ...
and be catched by INSERT rule.

Otherwise, need to create new temporary table, load data into, INSERT ..
SELECT ..., DROP TABLE, while it seems strange.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Anton Fedorov" <datacompboy(at)mail(dot)ru>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2437: Rules for COPY
Date: 2006-05-15 13:50:57
Message-ID: 2494.1147701057@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

"Anton Fedorov" <datacompboy(at)mail(dot)ru> writes:
> Looks like COPY bypass rules 'ON INSERT INSTEAD'.

That's the documented behavior. We're unlikely to change it because
it'd slow COPY down substantially, which'd negate its main use of being
a bulk data loading mechanism.

regards, tom lane


From: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Anton Fedorov <datacompboy(at)mail(dot)ru>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2437: Rules for COPY
Date: 2006-05-15 18:46:00
Message-ID: 20060515184600.GW26212@pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Mon, May 15, 2006 at 09:50:57AM -0400, Tom Lane wrote:
> "Anton Fedorov" <datacompboy(at)mail(dot)ru> writes:
> > Looks like COPY bypass rules 'ON INSERT INSTEAD'.
>
> That's the documented behavior. We're unlikely to change it because
> it'd slow COPY down substantially, which'd negate its main use of being
> a bulk data loading mechanism.

http://pgfoundry.org/projects/pgloader/ might allow for using inserts
and therefore firing ON INSERT rules. Another option is to COPY into a
temporary table, and then to INSERT INTO.

The problem with COPY not firing ON INSERT is that COPY is the only
convenient way to load data in that doesn't already happen to be
formatted as INSERT statements, so it would be nice if there was an
option that allowed you to have it follow normal INSERT conventions. Or
perhaps if there was a utility that allowed reading from an on-disk file
as if it was a table... I know Oracle has that ability, maybe
EnterpriseDB has it as well...
--
Jim C. Nasby, Sr. Engineering Consultant jnasby(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461