Re: BUG #13126: table constraint loses its comment

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: xi(at)resolvent(dot)net, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #13126: table constraint loses its comment
Date: 2015-04-29 04:30:58
Message-ID: CAB7nPqT5dzkfYBwaz-NnojU8-aQNGas1P=AQBa9n9hg8mjv+hg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Sun, Apr 26, 2015 at 6:05 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> xi(at)resolvent(dot)net writes:
>> In some circumstances, the comment on a table constraint disappears. Here
>> is an example:
>
> Hm, yeah. The problem is that ATExecAlterColumnType() rebuilds all the
> affected indexes from scratch, and it isn't doing anything about copying
> their comments to the new objects (either comments on the constraints, or
> comments directly on the indexes).
>
> The least painful way to fix it might be to charter ATPostAlterTypeCleanup
> to create COMMENT commands and add those to the appropriate work queue,
> rather than complicating the data structure initially emitted by
> ATExecAlterColumnType. But it'd still be a fair amount of new code I'm
> afraid.
>
> Not planning to fix this personally, but maybe someone else would like to
> take it up.

In order to fix this, an idea would be to add a new routine in
ruleutils.c that generates the COMMENT query string, and then call it
directly from tablecmds.c. On master, I imagine that we could even add
some SQL interface if there is some need.
Thoughts?
--
Michael

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2015-04-29 05:06:05 Re: BUG #13188: .pgpass does not work
Previous Message Bruce Momjian 2015-04-29 01:03:15 Re: BUG #12754: The 'OF' template pattern of to_char() print incorrect results with negative offsets with minutes

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2015-04-29 04:47:21 Re: [COMMITTERS] pgsql: Add transforms feature
Previous Message Tom Lane 2015-04-29 04:12:42 Re: improving speed of make check-world