Re: [BUGS] Commenting a FK crashes ALTER TABLE statements - Mailing list pgsql-bugs

From Michael Paquier
Subject Re: [BUGS] Commenting a FK crashes ALTER TABLE statements
Date
Msg-id CAB7nPqSndh49vF=DSdm4vFent+3Qq0Suo-ND=g_ZeNCGDUZtGw@mail.gmail.com
Whole thread Raw
In response to Re: [BUGS] Commenting a FK crashes ALTER TABLE statements  (David Rowley <david.rowley@2ndquadrant.com>)
Responses Re: [BUGS] Commenting a FK crashes ALTER TABLE statements  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Mon, May 15, 2017 at 1:05 PM, David Rowley
<david.rowley@2ndquadrant.com> wrote:
> 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.

I was just finishing to debug it :)
It is surprising that we have not caught this earlier as comment
re-creation handling in ALTER TABLE has been reworked some time ago
already. This means that we did not stress this code enough. Attached
is the previous fix, completed with a set of regression tests.
-- 
Michael

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Attachment

pgsql-bugs by date:

Previous
From: David Rowley
Date:
Subject: Re: [BUGS] Commenting a FK crashes ALTER TABLE statements
Next
From: Sebastion Calbaza
Date:
Subject: Re: [BUGS] BUG #14648: counts for queries using array unnesting is incorrect