On Tue, Nov 1, 2016 at 3:54 PM, Dilip Kumar <dilipbal...@gmail.com> wrote:

> On Tue, Oct 4, 2016 at 1:07 PM, Haribabu Kommi <kommi.harib...@gmail.com>
> wrote:
> > I think currently there is no handling of INSTEAD of triggers in the copy
> > functionality.
> >
> > It didn't seem difficult to the support the same, until unless there are
> any
> > problems for complext queries, so after adding the INSTEAD of triggers
> > check and calling the ExecIRInsertTriggers function, the Copy is also
> > working for the view.
> >
> > Attached is a POC patch of the same. I didn't checked all the possible
> > scenarios.
> We support insert into view in below 2 cases..
> 1. INSTEAD OF INSERT trigger
> 2. or an unconditional ON INSERT DO INSTEAD rule

Yes, I agree that the above are the two cases where the insert is possible
on a view other than updatable views.

> In your patch we are supporting first one in COPY command, Will it not
> be good to support second one also in COPY command ?

COPY command is treated as an UTILITY command, During the query
processing, the rules are not applied on the COPY command, and in the
execution of COPY command, it just inserts the data into the heap and
indexes with direct calls.

I feel supporting the COPY command for the case-2 is little bit complex
and may not be that much worth.

Attached is the updated patch with doc changes.

Hari Babu
Fujitsu Australia

Attachment: copy_to_view_1.patch
Description: Binary data

Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:

Reply via email to