Re: RFC: ALTER SYSTEM [...] COMMENT

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: RFC: ALTER SYSTEM [...] COMMENT
Date: 2017-04-26 17:37:09
Message-ID: 9083.1493228229@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Stephen Frost <sfrost(at)snowman(dot)net> writes:
> Having COMMENT ON accept a general query whose result is then cast to
> text and stored as the comment would allow this to be done, eg:

> COMMENT ON table IS (pg_get_comment('table') || ' new text');

Putting general subexpressions into utility statements has some
implementation issues. Plus, it's not really all that powerful.
It'd be better to invent inverse pg_get_comment and pg_set_comment
functions, then you could do bulk-update things like

select pg_set_comment('table', pg_get_comment('table') || ' more')
from pg_class where ...

The main thing lacking to make that into a real proposal would be
a way of naming the object the comment is for; but I think Alvaro's
already exposed something corresponding to ObjectAddress to SQL, no?

> We could also have new syntax along these lines, for this specific case:
> COMMENT ON table ADD ' new text';

Wouldn't have a big problem with that, as it'd address a common case
for not much work.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2017-04-26 17:37:48 Re: RFC: ALTER SYSTEM [...] COMMENT
Previous Message Hunley, Douglas 2017-04-26 17:35:10 Re: RFC: ALTER SYSTEM [...] COMMENT