Re: BUG #13652: Function names as a table prefiex by underscore, confused with array - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #13652: Function names as a table prefiex by underscore, confused with array
Date
Msg-id 16142.1443542877@sss.pgh.pa.us
Whole thread Raw
In response to BUG #13652: Function names as a table prefiex by underscore, confused with array  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-bugs
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Tuesday, September 29, 2015, <marisradu@gmail.com
> <javascript:_e(%7B%7D,'cvml','marisradu@gmail.com');>> wrote:
>> Select by _c(text) returns unexpected error:
>> # select _c('text');
>> ERROR:  malformed array literal: "text"

> It's unfortunate that such an implementation detail is exposed in this
> situation but the name is still valid if you place it in double-quotes (I
> think...) so making it fail at any other time seems unnecessarily strict.

Actually the way to get this to work as desired is to cast the argument
to the right type:

select _c('text'::text);

Then you get a match at step 2 in the resolution sequence ("exact match
of argument types"), so the user-defined function wins out over the cast
interpretation.

            regards, tom lane

pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: BUG #13652: Function names as a table prefiex by underscore, confused with array
Next
From: Jeff Janes
Date:
Subject: Re: GRANT USAGE ON SEQUENCE missing from psql command completion