mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-30 09:41:17 +02:00
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
This commit is contained in:
parent
7d4395d0a1
commit
fc7a5e9eaa
7
src/backend/utils/cache/relcache.c
vendored
7
src/backend/utils/cache/relcache.c
vendored
@ -669,8 +669,11 @@ RelationBuildTupleDesc(Relation relation)
|
|||||||
/*
|
/*
|
||||||
* Set up constraint/default info
|
* Set up constraint/default info
|
||||||
*/
|
*/
|
||||||
if (constr->has_not_null || ndef > 0 ||
|
if (constr->has_not_null ||
|
||||||
attrmiss || relation->rd_rel->relchecks)
|
constr->has_generated_stored ||
|
||||||
|
ndef > 0 ||
|
||||||
|
attrmiss ||
|
||||||
|
relation->rd_rel->relchecks)
|
||||||
{
|
{
|
||||||
relation->rd_att->constr = constr;
|
relation->rd_att->constr = constr;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user