postgresql/src/test/regress
Tom Lane 27011bcffa Fix old bug with coercing the result of a COLLATE expression.
There are hacks in parse_coerce.c to push down a requested coercion
to below any CollateExpr that may appear.  However, we did that even
if the requested data type is non-collatable, leading to an invalid
expression tree in which CollateExpr is applied to a non-collatable
type.  The fix is just to drop the CollateExpr altogether, reasoning
that it's useless.

This bug is ten years old, dating to the original addition of
COLLATE support.  The lack of field complaints suggests that there
aren't a lot of user-visible consequences.  We noticed the problem
because it would trigger an assertion in DefineVirtualRelation if
the invalid structure appears as an output column of a view; however,
in a non-assert build, you don't see a crash just a (subtly incorrect)
complaint about applying collation to a non-collatable type.  I found
that by putting the incorrect structure further down in a view, I could
make a view definition that would fail dump/reload, per the added
regression test case.  But CollateExpr doesn't do anything at run-time,
so this likely doesn't lead to any really exciting consequences.

Per report from Yulin Pei.  Back-patch to all supported branches.

Discussion: https://postgr.es/m/HK0PR01MB22744393C474D503E16C8509F4709@HK0PR01MB2274.apcprd01.prod.exchangelabs.com
2021-04-12 14:37:22 -04:00
..
data Fix full text search to handle NOT above a phrase search correctly. 2020-04-27 12:21:04 -04:00
expected Fix old bug with coercing the result of a COLLATE expression. 2021-04-12 14:37:22 -04:00
input Prevent drop of tablespaces used by partitioned relations 2021-01-14 15:32:14 -03:00
output Prevent drop of tablespaces used by partitioned relations 2021-01-14 15:32:14 -03:00
sql Fix old bug with coercing the result of a COLLATE expression. 2021-04-12 14:37:22 -04:00
.gitignore Update .gitignore for config.cache. 2014-12-18 19:56:42 +09:00
GNUmakefile Make install-tests target work with vpath builds 2020-05-31 18:35:08 -04:00
Makefile Fix non-GNU makefiles for AIX make. 2017-11-30 00:57:22 -08:00
parallel_schedule Paper over regression failures in infinite_recurse() on PPC64 Linux. 2020-10-13 17:44:56 -04:00
pg_regress.c Blind attempt to fix SSPI-auth case in 010_dump_connstr.pl. 2019-06-30 13:34:45 -04:00
pg_regress.h Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
pg_regress_main.c tableam: introduce table AM infrastructure. 2019-03-06 09:54:38 -08:00
README Don't generate plain-text HISTORY and src/test/regress/README anymore. 2014-02-10 20:48:04 -05:00
regress.c Fix deadlock danger when atomic ops are done under spinlock. 2020-06-18 14:13:06 -07:00
regressplans.sh Rename 'gmake' to 'make' in docs and recommended commands 2014-02-12 17:29:19 -05:00
resultmap Cygwin and Mingw floating-point fixes. 2019-02-16 01:50:16 +00:00
serial_schedule Paper over regression failures in infinite_recurse() on PPC64 Linux. 2020-10-13 17:44:56 -04:00
standby_schedule Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00

Documentation concerning how to run these regression tests and interpret
the results can be found in the PostgreSQL manual, in the chapter
"Regression Tests".