postgresql/src
Tom Lane f7bbd46dcf In locate_grouping_columns(), don't expect an exact match of Var typmods.
It's possible that inlining of SQL functions (or perhaps other changes?)
has exposed typmod information not known at parse time.  In such cases,
Vars generated by query_planner might have valid typmod values while the
original grouping columns only have typmod -1.  This isn't a semantic
problem since the behavior of grouping only depends on type not typmod,
but it breaks locate_grouping_columns' use of tlist_member to locate the
matching entry in query_planner's result tlist.

We can fix this without an excessive amount of new code or complexity by
relying on the fact that locate_grouping_columns only gets called when
make_subplanTargetList has set need_tlist_eval == false, and that can only
happen if all the grouping columns are simple Vars.  Therefore we only need
to search the sub_tlist for a matching Var, and we can reasonably define a
"match" as being a match of the Var identity fields
varno/varattno/varlevelsup.  The code still Asserts that vartype matches,
but ignores vartypmod.

Per bug #8393 from Evan Martin.  The added regression test case is
basically the same as his example.  This has been broken for a very long
time, so back-patch to all supported branches.
2013-08-23 17:31:03 -04:00
..
backend In locate_grouping_columns(), don't expect an exact match of Var typmods. 2013-08-23 17:31:03 -04:00
bin Clean up pg_basebackup libpq usage 2013-07-15 11:27:20 -04:00
include In locate_grouping_columns(), don't expect an exact match of Var typmods. 2013-08-23 17:31:03 -04:00
interfaces libpq: Report strerror on pthread_mutex_lock() failure 2013-08-17 21:52:35 -04:00
makefiles Make pgxs build executables with the right suffix. 2013-01-19 14:54:29 -05:00
pl Add semicolons to eval'd strings to hide a minor Perl behavioral change. 2013-06-03 14:19:36 -04:00
port Stamp 9.1.9. 2013-04-01 14:23:05 -04:00
template Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
test In locate_grouping_columns(), don't expect an exact match of Var typmods. 2013-08-23 17:31:03 -04:00
timezone Update time zone data files to tzdata release 2013b. 2013-03-28 15:25:58 -04:00
tools Properly zero-pad the day-of-year part of the win32 build number 2013-01-31 15:08:05 +01:00
tutorial Modernize string literal syntax in tutorial example. 2013-01-19 17:21:08 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
bcc32.mak Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Fix some oversights in distprep and maintainer-clean targets. 2011-03-10 00:04:05 -05:00
Makefile.global.in Add mode where contrib installcheck runs each module in a separately named database. 2012-12-11 11:51:51 -05:00
Makefile.shlib Use single quotes in preference to double quotes for protecting pathnames. 2011-06-15 21:45:50 -04:00
nls-global.mk Fix makefile logic to not break the build when xgettext is missing 2010-10-14 23:16:46 +03:00
win32.mak Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00