]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Don't set a fast default for anything but a plain table
authorAndrew Dunstan <andrew@dunslane.net>
Fri, 18 Jun 2021 11:44:58 +0000 (07:44 -0400)
committerAndrew Dunstan <andrew@dunslane.net>
Fri, 18 Jun 2021 11:53:08 +0000 (07:53 -0400)
commit306c318043a9c977a248b0fbef7ca091ff863ef1
treeea3e5f65e902bdaa2a0a67bbf54631a89bb596d6
parentba529a6ff41319ea7ad2ab11d2205965e6649a14
Don't set a fast default for anything but a plain table

The fast default code added in Release 11 omitted to check that the
table a fast default was being added to was a plain table. Thus one
could be added to a foreign table, which predicably blows up. Here we
perform that check.

In addition, on the back branches, since some of these might have
escaped into the wild, if we encounter a missing value for
an attribute of something other than a plain table we ignore it.

Fixes bug #17056

Backpatch to release 11,

Reviewed by: Andres Freund, Álvaro Herrera and Tom Lane
src/backend/catalog/heap.c
src/backend/commands/tablecmds.c
src/backend/utils/cache/relcache.c
src/test/regress/expected/fast_default.out
src/test/regress/sql/fast_default.sql