diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-08-10 02:36:29 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-08-10 02:36:29 +0000 |
commit | 0ee26100b64702f2fb4cd65c6dfdfb8f31e88130 (patch) | |
tree | a10c4a1937f8707bc94950216ee8fdb4f0a61fe8 /src/backend/optimizer/prep/prepunion.c | |
parent | e860e746e15a6c3bc26d7e337162a22e403f5a79 (diff) | |
download | postgresql-0ee26100b64702f2fb4cd65c6dfdfb8f31e88130.tar.gz postgresql-0ee26100b64702f2fb4cd65c6dfdfb8f31e88130.zip |
Fix UNION/INTERSECT/EXCEPT so that when two inputs being merged have
same data type and same typmod, we show that typmod as the output
typmod, rather than generic -1. This responds to several complaints
over the past few years about UNIONs unexpectedly dropping length or
precision info.
Diffstat (limited to 'src/backend/optimizer/prep/prepunion.c')
-rw-r--r-- | src/backend/optimizer/prep/prepunion.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/backend/optimizer/prep/prepunion.c b/src/backend/optimizer/prep/prepunion.c index 3b9e740cadf..3bf7223199f 100644 --- a/src/backend/optimizer/prep/prepunion.c +++ b/src/backend/optimizer/prep/prepunion.c @@ -22,7 +22,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepunion.c,v 1.132 2006/04/30 18:30:39 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/prep/prepunion.c,v 1.133 2006/08/10 02:36:28 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -152,6 +152,10 @@ plan_set_operations(PlannerInfo *root, double tuple_fraction, * flag: if >= 0, add a resjunk output column indicating value of flag * refnames_tlist: targetlist to take column names from * *sortClauses: receives list of SortClauses for result plan, if any + * + * We don't have to care about typmods here: the only allowed difference + * between set-op input and output typmods is input is a specific typmod + * and output is -1, and that does not require a coercion. */ static Plan * recurse_set_operations(Node *setOp, PlannerInfo *root, |