回复: Core dump happens when execute sql CREATE VIEW v1(c1) AS (SELECT ('4' COLLATE "C")::INT FROM generate_series(1, 10));
Yulin PEI <ypeiae@connect.ust.hk>
From: Yulin PEI <ypeiae@connect.ust.hk>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2021-04-13T09:27:08Z
Lists: pgsql-hackers
Attachments
- 0001-add-regress.patch (application/octet-stream) patch 0001
I think it is better to add this test case to regress.
________________________________
发件人: Tom Lane <tgl@sss.pgh.pa.us>
发送时间: 2021年4月13日 0:59
收件人: Yulin PEI <ypeiae@connect.ust.hk>
抄送: pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>
主题: Re: Core dump happens when execute sql CREATE VIEW v1(c1) AS (SELECT ('4' COLLATE "C")::INT FROM generate_series(1, 10));
Yulin PEI <ypeiae@connect.ust.hk> writes:
> I found it could cause a crash when executing sql statement: `CREATE VIEW v1(c1) AS (SELECT ('4' COLLATE "C")::INT FROM generate_series(1, 10)); ` in postgres 13.2 release.
Nice catch. I don't think the code in DefineVirtualRelation is wrong:
exprCollation shouldn't report any collation for an expression of a
non-collatable type. Rather the problem is with an old kluge in
coerce_type(), which will push a type coercion underneath a CollateExpr
... without any mind for the possibility that the coercion result isn't
collatable. So the right fix is more or less the attached.
regards, tom lane
Commits
-
Remove no-longer-relevant test case.
- cf0020080a3d 14.0 landed
-
Fix old bug with coercing the result of a COLLATE expression.
- c402b02b9fb5 14.0 landed
- fb2cca828ec8 11.12 landed
- a6158a4d9c2e 9.6.22 landed
- 8a7bd1e6cba3 13.3 landed
- 4b0aecee8a7d 10.17 landed
- 27011bcffa74 12.7 landed