Re: BUG #17570: Unrecognized node type for query with statistics on expressions

From: Japin Li <japinli(at)hotmail(dot)com>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: a(dot)kozhemyakin(at)postgrespro(dot)ru, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17570: Unrecognized node type for query with statistics on expressions
Date: 2022-08-04 14:59:07
Message-ID: ME3P282MB1667E822B3DEA81E46EEE11CB69F9@ME3P282MB1667.AUSP282.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


On Thu, 04 Aug 2022 at 19:25, Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
> On Thu, Aug 4, 2022 at 6:37 PM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
>
>>
>> On Thu, Aug 4, 2022 at 4:28 PM PG Bug reporting form <
>> noreply(at)postgresql(dot)org> wrote:
>>
>>> The following bug has been logged on the website:
>>>
>>> Bug reference: 17570
>>> Logged by: Alexander Kozhemyakin
>>> Email address: a(dot)kozhemyakin(at)postgrespro(dot)ru
>>> PostgreSQL version: 14.4
>>> Operating system: ubunu 20.04
>>> Description:
>>>
>>> When executing the following script:
>>> CREATE TABLE t(a INT, b VARCHAR);
>>> INSERT INTO t(a, b) SELECT i, i FROM generate_series(1,100) s(i);
>>> CREATE STATISTICS t_stats (mcv) ON (a), (b) FROM t;
>>> ANALYZE t;
>>> CREATE ROLE u;
>>> --GRANT SELECT ON t TO u;
>>> SET SESSION AUTHORIZATION u;
>>> SELECT * FROM t WHERE a = 1 AND b::int = 1;
>>>
>>> I get:
>>> ERROR: unrecognized node type: 1697192808
>>
>>
>> Thanks for the report! I can reproduce it in HEAD. Propose the attached
>> for fix.
>>
>
> Oops.. sorry I didn't notice Japin's email before I hit the 'send' for
> my reply. The two patches are almost the same, except that before we
> check against whole-row reference, I also adjust the attnum by
> FirstLowInvalidHeapAttributeNumber.
>

Doesn't matter.

Attached to new patch add a test-case from Alexander Kozhemyakin.

--
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.

Attachment Content-Type Size
v1-0001-Fix-unrecognized-node-type-about-statistics-on-ex.patch text/x-patch 3.6 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2022-08-04 15:13:22 Re: BUG #17564: Planner bug in combination of generate_series(), unnest() and ORDER BY
Previous Message PG Bug reporting form 2022-08-04 14:56:32 BUG #17571: PostgreSQL 15b2 ICU collation defined at db level sorts differently in collate clause vs implicit