On 15 May 2017 at 03:43, Marko Elezovic <marko.elezovic@oradian.com> wrote:
> Script to reproduce:
>
> psql -Upostgres -c"DROP DATABASE IF EXISTS cod;" postgres
>
> psql -Upostgres -c"CREATE DATABASE cod;" postgres
>
> psql -Upostgres -c"CREATE TABLE foo(id int PRIMARY KEY);" cod
>
> psql -Upostgres -c"CREATE TABLE bar(id int CONSTRAINT baz REFERENCES
> foo);" cod
>
> psql -Upostgres -c"COMMENT ON CONSTRAINT baz ON bar IS 'Fubar';" cod
>
> psql -Upostgres -c"ALTER TABLE foo ALTER COLUMN id TYPE int;" cod
Thanks for detailing out the method to reproduce.
It can be simplified a bit to become:
CREATE TABLE foo(id int PRIMARY KEY);
CREATE TABLE bar(id int CONSTRAINT baz REFERENCES foo);
COMMENT ON CONSTRAINT baz ON bar IS 'Fubar';
\c
ALTER TABLE foo ALTER COLUMN id TYPE int;
It seems there's just some missing pstrdup() calls in
RebuildConstraintComment().
The attached should fix it.
--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs