Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ef74e03

Browse files
committed
Fix UPDATE of GENERATED ALWAYS identity columns
The bug would previously prevent the update of any column in a table with identity columns, rather than just the actual identity column. Reported-by: [email protected] Bug: #14718
1 parent 572d6ee commit ef74e03

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/rewrite/rewriteHandler.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ rewriteTargetListIU(List *targetList,
827827

828828
if (commandType == CMD_UPDATE)
829829
{
830-
if (att_tup->attidentity == ATTRIBUTE_IDENTITY_ALWAYS && !apply_default)
830+
if (att_tup->attidentity == ATTRIBUTE_IDENTITY_ALWAYS && new_tle && !apply_default)
831831
ereport(ERROR,
832832
(errcode(ERRCODE_GENERATED_ALWAYS),
833833
errmsg("column \"%s\" can only be updated to DEFAULT", NameStr(att_tup->attname)),

0 commit comments

Comments
 (0)