Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fc7a5e9

Browse filesBrowse files
committed
Ensure relcache consistency around generated columns
In certain transient states, it's possible that a table has attributes with attgenerated set but no default expressions in pg_attrdef yet. In that case, the old code path would not set relation->rd_att->constr->has_generated_stored, unless relation->rd_att->constr was also populated for some other reason. There was probably no practical impact, but it's better to keep this consistent. Reported-by: Andres Freund <andres@anarazel.de> Discussion: https://www.postgresql.org/message-id/flat/20200115181105.ad6ab6dlgyww3lb6%40alap3.anarazel.de
1 parent 7d4395d commit fc7a5e9
Copy full SHA for fc7a5e9

File tree

Expand file treeCollapse file tree

1 file changed

+5
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-2
lines changed

‎src/backend/utils/cache/relcache.c

Copy file name to clipboardExpand all lines: src/backend/utils/cache/relcache.c
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,8 +669,11 @@ RelationBuildTupleDesc(Relation relation)
669669
/*
670670
* Set up constraint/default info
671671
*/
672-
if (constr->has_not_null || ndef > 0 ||
673-
attrmiss || relation->rd_rel->relchecks)
672+
if (constr->has_not_null ||
673+
constr->has_generated_stored ||
674+
ndef > 0 ||
675+
attrmiss ||
676+
relation->rd_rel->relchecks)
674677
{
675678
relation->rd_att->constr = constr;
676679

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.