Re: sqlsmith: ERROR: XX000: bogus varno: 2

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Justin Pryzby <pryzby(at)telsasoft(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: sqlsmith: ERROR: XX000: bogus varno: 2
Date: 2021-12-20 18:50:37
Message-ID: CA+Tgmob2wVbfj47aqFxYeTuP_rcO45dip_GU-Hz=BSxu4POgXw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Dec 20, 2021 at 1:13 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> The reason the regression tests fail if I only patch ruleutils is
> that psql \d on a partitioned table invokes
> ... pg_get_expr(c.relpartbound, c.oid) FROM pg_catalog.pg_class c
> and evidently relpartbound does contain precisely these node types.

Right. I'm not surprised that relpartbound uses those node types. I
*am* surprised that pg_get_expr() is expected to be able to handle
them. IOW, they ARE node trees, consonant with the fact that the
column type is pg_node_tree, but they're NOT expressions.

If we're going to have a policy that all node types stored in the
catalog should be supported by expression_tree_walker even if they're
not actually expressions, we ought to have a rather explicit comment
about that in the comments for expression_tree_walker, because
otherwise somebody might easily make this same mistake again.
Alternatively, maybe pg_get_expr() should just fail and tell you that
this is not an expression, and if you want to see what's in that
column, you should use the SQL-callable functions specifically
provided for that purpose (pg_get_partkeydef, I think). I don't know
why it should be legitimate for pg_get_expr() to just assume that any
random node tree it gets handed must be an expression without doing
any sanity checking.

--
Robert Haas
EDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Euler Taveira 2021-12-20 18:57:45 Re: row filtering for logical replication
Previous Message Peter Geoghegan 2021-12-20 18:37:05 Re: Add index scan progress to pg_stat_progress_vacuum