On Tue, Nov 1, 2016 at 8:05 PM, Dilip Kumar <dilipbal...@gmail.com> wrote:
> On Tue, Nov 1, 2016 at 12:40 PM, Haribabu Kommi > <kommi.harib...@gmail.com> wrote: > > 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. > > I agree it will be complex.. > > > > Attached is the updated patch with doc changes. > > Now since we are adding support for INSTEAD OF TRIGGER in COPY FROM > command, It will be good that we provide a HINT to user if INSTEAD of > trigger does not exist, like we do in case of insert ? > > INSERT case: > postgres=# insert into ttt_v values(7); > 2016-11-01 14:31:39.845 IST [72343] ERROR: cannot insert into view "ttt_v" > 2016-11-01 14:31:39.845 IST [72343] DETAIL: Views that do not select > from a single table or view are not automatically updatable. > 2016-11-01 14:31:39.845 IST [72343] HINT: To enable inserting into > the view, provide an INSTEAD OF INSERT trigger or an unconditional ON > INSERT DO INSTEAD rule. > > COPY case: > postgres=# COPY ttt_v FROM stdin; > 2016-11-01 14:31:52.235 IST [72343] ERROR: cannot copy to view "ttt_v" > 2016-11-01 14:31:52.235 IST [72343] STATEMENT: COPY ttt_v FROM stdin; Thanks for your suggestion. Yes, I agree that adding a hint is good. Updated patch is attached with addition of hint message. 2016-11-03 14:56:28.685 AEDT [7822] ERROR: cannot copy to view "ttt_v" 2016-11-03 14:56:28.685 AEDT [7822] HINT: To enable copy to view, provide an INSTEAD OF INSERT trigger 2016-11-03 14:56:28.685 AEDT [7822] STATEMENT: COPY ttt_v FROM stdin; Regards, Hari Babu Fujitsu Australia
copy_to_view_2.patch
Description: Binary data
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers