Re: Supporting MERGE on updatable views

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Supporting MERGE on updatable views
Date: 2023-10-28 08:34:51
Message-ID: CACJufxFzVZNFPALo+iYZX9Jsz-=JK8U=eBYUTvE0DGNqAeFP4w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

hi.
Excellent work! regress test passed! The code looks so intuitive!

doc/src/sgml/ref/create_view.sgml.
Do we need to add <<command>MERGE</command> for the following sentence?

If the view or any of its base
relations has an <literal>INSTEAD</literal> rule that causes the
<command>INSERT</command> or <command>UPDATE</command> command
to be rewritten, then
all check options will be ignored in the rewritten query, including any
checks from automatically updatable views defined on top of the relation
with the <literal>INSTEAD</literal> rule.

in src/backend/executor/nodeModifyTable.c line 3800: ExecModifyTable
`
datum = ExecGetJunkAttribute(slot,resultRelInfo->ri_RowIdAttNo,&isNull);
.....
oldtupdata.t_data = DatumGetHeapTupleHeader(datum);
oldtupdata.t_len = HeapTupleHeaderGetDatumLength(oldtupdata.t_data);
`
In ExecGetJunkAttribute(slot,resultRelInfo->ri_RowIdAttNo,&isNull);

does resultRelInfo->ri_RowIdAttNo must be 1 to make sure
DatumGetHeapTupleHeader(datum) works?
(I am not familiar with this part.....)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Laurenz Albe 2023-10-28 08:53:58 Re: unnest multirange, returned order
Previous Message jian he 2023-10-28 08:25:57 Re: SQL:2011 application time