diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-11-08 21:49:48 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-11-08 21:49:48 +0000 |
commit | c291203ca3cde3b10e7a8962df2c1ccc737a9e6f (patch) | |
tree | 2fef9ed8d4bbd9b725b4f857918ea98cf85bbc09 /src/backend/nodes/outfuncs.c | |
parent | 1be0601681197fe79a2d2d403c518e7aeff1788a (diff) | |
download | postgresql-c291203ca3cde3b10e7a8962df2c1ccc737a9e6f.tar.gz postgresql-c291203ca3cde3b10e7a8962df2c1ccc737a9e6f.zip |
Fix EquivalenceClass code to handle volatile sort expressions in a more
predictable manner; in particular that if you say ORDER BY output-column-ref,
it will in fact sort by that specific column even if there are multiple
syntactic matches. An example is
SELECT random() AS a, random() AS b FROM ... ORDER BY b, a;
While the use-case for this might be a bit debatable, it worked as expected
in earlier releases, so we should preserve the behavior for 8.3. Per my
recent proposal.
While at it, fix convert_subquery_pathkeys() to handle RelabelType stripping
in both directions; it needs this for the same reasons make_sort_from_pathkeys
does.
Diffstat (limited to 'src/backend/nodes/outfuncs.c')
-rw-r--r-- | src/backend/nodes/outfuncs.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index 005879b8c91..fc4f7d2daca 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.315 2007/10/11 18:05:27 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.316 2007/11/08 21:49:47 tgl Exp $ * * NOTES * Every node type that can appear in stored rules' parsetrees *must* @@ -1405,6 +1405,7 @@ _outEquivalenceClass(StringInfo str, EquivalenceClass *node) WRITE_BOOL_FIELD(ec_has_volatile); WRITE_BOOL_FIELD(ec_below_outer_join); WRITE_BOOL_FIELD(ec_broken); + WRITE_UINT_FIELD(ec_sortref); } static void |