Re: BUG #18546: Attempt to insert default into a non-updatable column of a view fails with a dubious error
Dean Rasheed <dean.a.rasheed@gmail.com>
From: Dean Rasheed <dean.a.rasheed@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2024-07-22T08:41:11Z
Lists: pgsql-bugs
Attachments
- comment-update-for-bug-18546.patch (text/x-patch) patch
On Sat, 20 Jul 2024 at 17:26, Tom Lane <tgl@sss.pgh.pa.us> wrote: > > The existing code/comments (dating AFAICS to Dean's cab5dc5da) > already point out that rewriteTargetListIU can add targetlist items, > but we missed the fact that it can delete them too. So it seems like > what we need to do is union the original set of target columns with > what's listed in the targetlist, as attached. > Ah yes, that makes sense and the fix looks good. Thanks for taking care of that. I had always thought that rewriteTargetListIU() only ever added or merged items, somehow overlooking the fact that it could also delete them. In my defence, it's very easy to get that impression just by reading the function's comments. I think it's worth updating those comments to mention that. Something like the attached, perhaps. Regards, Dean
Commits
-
Correctly check updatability of columns targeted by INSERT...DEFAULT.
- feca6c688cd9 12.20 landed
- fd958bbbdf20 16.4 landed
- 96953052a12c 15.8 landed
- 461f47948553 13.16 landed
- 220003b9b937 18.0 landed
- 0d712ec12a90 14.13 landed
- 041a00c4803b 17.0 landed