Re: BUG #17803: Rule "ALSO INSERT ... SELECT ..." fails to substitute default values

Dean Rasheed <dean.a.rasheed@gmail.com>

From: Dean Rasheed <dean.a.rasheed@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alexander Lakhin <exclusion@gmail.com>, pgsql-bugs@lists.postgresql.org
Date: 2023-02-24T08:50:45Z
Lists: pgsql-bugs

Attachments

On Thu, 23 Feb 2023 at 23:20, Dean Rasheed <dean.a.rasheed@gmail.com> wrote:
>
> Doing the attached fixes the reported issue, and all variants of it
> that I could come up with, but I'm not entirely sure whether it needs
> to be concerned about other rtekinds.
>

I wasn't able to provoke a failure involving any other rtekind. It is
possible to break it using references to OLD in UPDATE rules though.

Here's an updated patch, now with test cases involving both OLD and
NEW references.

Regards,
Dean

Commits

  1. Fix mishandling of OLD/NEW references in subqueries in rule actions.

  2. Fix multi-row DEFAULT handling for INSERT ... SELECT rules.

  3. Fix DEFAULT-handling in multi-row VALUES lists for updatable views.