Strange behavior with missing column in SQL function

From: Marcelo Lacerda <marceloslacerda(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Strange behavior with missing column in SQL function
Date: 2018-07-30 18:12:42
Message-ID: CAPmRTtNWK6fS3NDG7R2c6Juf6=RpORRyGeH9pvw1KZtg3oxvbQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Here's the code that reproduces the behavior:
http://paste.debian.net/1035412/

I have already discussed this in the IRC channel but there doesn't seem to
be a consensus on whether this is a bug here's a brief transcript of
RhodiumToad's opinion:

> this isn't new, goes back to 9.1 at least
> basically, the error path in sql_fn_post_column_ref is a bit confused.
> seeing r.c it tries to resolve it as parameter.field, fails, and rather
than reporting the error directly as being a missing field, it just returns
with the reference unresolved
>then the outer parser code, having failed to resolve it as table.column
and having had the hook function not override it, reports it on the
assumption that it's a missing table
> so it's probably been this way for as long as named parameters have
worked in language sql
> msl09: as far as I can tell it's just giving the wrong error in an error
path, everything that's supposed to work does work
> msl09: but the error is definitely misleading

My question is "Is this a bug? Should it be reported?"

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Lu, Dan 2018-07-30 18:35:59 Question on postgresql.conf
Previous Message Dimitri Maziuk 2018-07-30 18:06:08 Re: logical replication snapshots