Re: Allow COMMENT ON to accept an expression rather than just a string - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Allow COMMENT ON to accept an expression rather than just a string
Date
Msg-id 2875.1239473301@sss.pgh.pa.us
Whole thread Raw
In response to Re: Allow COMMENT ON to accept an expression rather than just a string  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: Allow COMMENT ON to accept an expression rather than just a string  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: Allow COMMENT ON to accept an expression rather than just a string  (Abhijit Menon-Sen <ams@oryx.com>)
List pgsql-hackers
Pavel Stehule <pavel.stehule@gmail.com> writes:
> 2009/4/11 Bruce Momjian <bruce@momjian.us>:
>> I remember adding the TODO after a request from the user, but I have not
>> seen further requests. I have remove the item; let's see if we get any
>> further requests for it.

> I thing so this TODO point is little bit step in bad direction.

I agree with Pavel that the originally suggested use-case seems like
a poor man's substitute for a missing database facility.  But Abhijit's
question about parameters reminds me that there is a use-case from the
point of view of client-side libraries.  You might wish to do something
like (pseudo-code here)
execute('COMMENT ON foo IS $1', some_string);

and let the out-of-line-parameter mechanism take care of quoting and
escaping your string.  This doesn't work today, and I remember having
seen complaints about that on the JDBC list.  So there's a use-case at
least for allowing parameter symbols in place of string literals, if not
fully general expressions.  But again, I think we'd want such a thing
across all utility statements that can take string literals, not only
COMMENT.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Allow COMMENT ON to accept an expression rather than just a string
Next
From: Pavel Stehule
Date:
Subject: Re: Allow COMMENT ON to accept an expression rather than just a string