Re: ERROR: argument to pg_get_expr() must come from system catalogs - Mailing list pgsql-hackers

From Tom Lane
Subject Re: ERROR: argument to pg_get_expr() must come from system catalogs
Date
Msg-id 4378.1279046192@sss.pgh.pa.us
Whole thread Raw
In response to ERROR: argument to pg_get_expr() must come from system catalogs  (Dave Page <dpage@pgadmin.org>)
Responses Re: ERROR: argument to pg_get_expr() must come from system catalogs
List pgsql-hackers
Dave Page <dpage@pgadmin.org> writes:
> We had a report of the above error from a pgAdmin user testing
> 1.12.0b3 with PG 9.0b3. The (highly simplified) query below works fine
> as a superuser:

> SELECT pg_get_expr(proargdefaults, 'pg_catalog.pg_class'::regclass)
>   FROM pg_proc pr
>   LEFT OUTER JOIN pg_description des ON des.objoid=pr.oid

> Run as a regular user though, we get the error. If I remove the join,
> it works fine as the normal user. This is in a database owned by the
> regular user.

> Am I missing something obvious, or is there a bug here?

Yeah, it's a bug.  The code Heikki added in parse_expr.c isn't allowing
for the possibility of join alias Vars.  (There's another problem with
it too, which is you can trivially circumvent the check, just by
creating an operator based on pg_get_expr ...)

I wasn't terribly happy with that approach to begin with.  I think we
need to rethink.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Per-column collation, proof of concept
Next
From: "Kevin Grittner"
Date:
Subject: Re: bg worker: overview