Re: BUG #13652: Function names as a table prefiex by underscore, confused with array

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "marisradu(at)gmail(dot)com" <marisradu(at)gmail(dot)com>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #13652: Function names as a table prefiex by underscore, confused with array
Date: 2015-09-29 16:07:57
Message-ID: 16142.1443542877@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> On Tuesday, September 29, 2015, <marisradu(at)gmail(dot)com
> <javascript:_e(%7B%7D,'cvml','marisradu(at)gmail(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Maris Radu 2015-09-29 16:08:36 Re: BUG #13652: Function names as a table prefiex by underscore, confused with array
Previous Message David G. Johnston 2015-09-29 15:50:14 BUG #13652: Function names as a table prefiex by underscore, confused with array