On Mon, Dec 20, 2021 at 1:13 PM Tom Lane <t...@sss.pgh.pa.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