Thread: Print baserestrictinfo for varchar fields

Print baserestrictinfo for varchar fields

From
Donald Dong
Date:
Hi,

I noticed that debug_print_rel outputs "unknown expr" when the fields
in baserestrictinfo are typed as varchar.

create table tbl_a(id int, info varchar(32));

RELOPTINFO (tbl_a): rows=4 width=86
        baserestrictinfo: unknown expr = pattern

My approach is to handle the RelabelType case in print_expr. After
the patch, I get:

RELOPTINFO (tbl_a): rows=4 width=86
        baserestrictinfo: tbl_a.info = pattern

I wonder if this is a proper way of fixing it?

Thank you,
Donald Dong


Attachment

Re: Print baserestrictinfo for varchar fields

From
Tom Lane
Date:
Donald Dong <xdong@csumb.edu> writes:
> I noticed that debug_print_rel outputs "unknown expr" when the fields
> in baserestrictinfo are typed as varchar.
> ...
> I wonder if this is a proper way of fixing it?

It's hard to muster much enthusiasm for extending print_expr(),
considering how incomplete and little-used it is.  I'd rather
spend effort on ripping it out in favor of using the far more
complete, and better-tested, code in ruleutils.c.

            regards, tom lane



Re: Print baserestrictinfo for varchar fields

From
Michael Paquier
Date:
On Mon, Jun 03, 2019 at 01:37:22AM -0400, Tom Lane wrote:
> It's hard to muster much enthusiasm for extending print_expr(),
> considering how incomplete and little-used it is.  I'd rather
> spend effort on ripping it out in favor of using the far more
> complete, and better-tested, code in ruleutils.c.

If it is possible to get the same amount of coverage when debugging
the planner, count me in.  Now it seems to me that we'd still require
some work to get the same level of information as for range table
entry kinds..
--
Michael

Attachment