Fix unsafe reference into relcache in constructed CommentStmt. The CommentStmt made by RebuildConstraintComment() has to pstrdup the relation name, else it will contain a dangling pointer after that relcache entry is flushed. (I'm less sure that pstrdup'ing conname is necessary, but let's be safe.) Failure to do this leads to weird errors or crashes, as reported by Marko Elezovic.
Bug introduced by commit e42375fc8, so back-patch to 9.5 as that was. Fix by David Rowley, regression test by Michael Paquier Discussion: https://postgr.es/m/db6pr03mb30775d58e732d4eb0c13725b9a...@db6pr03mb3077.eurprd03.prod.outlook.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/12590c5d33d013e55995c0c0ea6c70262a6d13b3 Modified Files -------------- src/backend/commands/tablecmds.c | 4 ++-- src/test/regress/expected/alter_table.out | 33 +++++++++++++++++++++++++++++++ src/test/regress/sql/alter_table.sql | 18 +++++++++++++++++ 3 files changed, 53 insertions(+), 2 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers