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

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: "marisradu(at)gmail(dot)com" <marisradu(at)gmail(dot)com>
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: BUG #13652: Function names as a table prefiex by underscore, confused with array
Date: 2015-09-29 15:50:14
Message-ID: CAKFQuwYrBOE3=4mZs672p7Mb9XWp3oFJbT+eEMa9fsDDuZ6U1w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tuesday, September 29, 2015, <marisradu(at)gmail(dot)com
<javascript:_e(%7B%7D,'cvml','marisradu(at)gmail(dot)com');>> wrote:

> The following bug has been logged on the website:
>
> Bug reference: 13652
> Logged by: Maris Radu
> Email address: marisradu(at)gmail(dot)com
> PostgreSQL version: 9.4.4
> Operating system: Ubuntu Server 14.04.1
> Description:
>
> Creating a method "_c()" as:
> create or replace function _c(text) returns text as $$
> select $1;
> $$ language sql immutable;
>
> and a table "c" as:
> create table c (id int);
>
> Select by _c(text) returns unexpected error:
>
> # select _c('text');
> ERROR: malformed array literal: "text"
> LINE 1: select _c('text');
> ^
> DETAIL: Array value must start with "{" or dimension information.
>
>
> Dropping the table or renaming the function to solves the issue.
>
> Expecting: The query to run normally, or an error when creating the
> function
> or the table if the function was defined first.
>
>
Not a bug.

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.
Maybe a hint would be in order but otherwise I'm not seeing much here that
would be worth significant effort to correct even ignoring the potential
breakage which Tom aludes to.

David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2015-09-29 16:07:57 Re: BUG #13652: Function names as a table prefiex by underscore, confused with array
Previous Message David G. Johnston 2015-09-29 15:48:12 Re: BUG #13651: trigger security invoker attack