Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2015-03-30 18:59:49 +0000
committerTom Lane2015-03-30 18:59:49 +0000
commit542320c2bd0b3796a8a9a4617cdb23fbad473390 (patch)
tree38a517f89bfa0098960d44fae94829a3b86ce3bd /contrib/btree_gist/expected
parent701dcc983eb4d08dd36bb3a0ddba255819797760 (diff)
Be more careful about printing constants in ruleutils.c.
The previous coding in get_const_expr() tried to avoid quoting integer, float, and numeric literals if at all possible. While that looks nice, it means that dumped expressions might re-parse to something that's semantically equivalent but not the exact same parsetree; for example a FLOAT8 constant would re-parse as a NUMERIC constant with a cast to FLOAT8. Though the result would be the same after constant-folding, this is problematic in certain contexts. In particular, Jeff Davis pointed out that this could cause unexpected failures in ALTER INHERIT operations because of child tables having not-exactly-equivalent CHECK expressions. Therefore, favor correctness over legibility and dump such constants in quotes except in the limited cases where they'll be interpreted as the same type even without any casting. This results in assorted small changes in the regression test outputs, and will affect display of user-defined views and rules similarly. The odds of that causing problems in the field seem non-negligible; given the lack of previous complaints, it seems best not to change this in the back branches.
Diffstat (limited to 'contrib/btree_gist/expected')
-rw-r--r--contrib/btree_gist/expected/float4.out2
-rw-r--r--contrib/btree_gist/expected/float8.out2
-rw-r--r--contrib/btree_gist/expected/int2.out2
-rw-r--r--contrib/btree_gist/expected/int8.out6
-rw-r--r--contrib/btree_gist/expected/numeric.out6
5 files changed, 9 insertions, 9 deletions
diff --git a/contrib/btree_gist/expected/float4.out b/contrib/btree_gist/expected/float4.out
index 4a52a9399a5..abbd9eef4e8 100644
--- a/contrib/btree_gist/expected/float4.out
+++ b/contrib/btree_gist/expected/float4.out
@@ -78,7 +78,7 @@ SELECT a, a <-> '-179.0' FROM float4tmp ORDER BY a <-> '-179.0' LIMIT 3;
----------------------------------------------------
Limit
-> Index Only Scan using float4idx on float4tmp
- Order By: (a <-> (-179)::real)
+ Order By: (a <-> '-179'::real)
(3 rows)
SELECT a, a <-> '-179.0' FROM float4tmp ORDER BY a <-> '-179.0' LIMIT 3;
diff --git a/contrib/btree_gist/expected/float8.out b/contrib/btree_gist/expected/float8.out
index 918d84860f5..5111dbdfaea 100644
--- a/contrib/btree_gist/expected/float8.out
+++ b/contrib/btree_gist/expected/float8.out
@@ -78,7 +78,7 @@ SELECT a, a <-> '-1890.0' FROM float8tmp ORDER BY a <-> '-1890.0' LIMIT 3;
-----------------------------------------------------
Limit
-> Index Only Scan using float8idx on float8tmp
- Order By: (a <-> (-1890)::double precision)
+ Order By: (a <-> '-1890'::double precision)
(3 rows)
SELECT a, a <-> '-1890.0' FROM float8tmp ORDER BY a <-> '-1890.0' LIMIT 3;
diff --git a/contrib/btree_gist/expected/int2.out b/contrib/btree_gist/expected/int2.out
index 711e2c722ac..50a332939bd 100644
--- a/contrib/btree_gist/expected/int2.out
+++ b/contrib/btree_gist/expected/int2.out
@@ -78,7 +78,7 @@ SELECT a, a <-> '237' FROM int2tmp ORDER BY a <-> '237' LIMIT 3;
------------------------------------------------
Limit
-> Index Only Scan using int2idx on int2tmp
- Order By: (a <-> 237::smallint)
+ Order By: (a <-> '237'::smallint)
(3 rows)
SELECT a, a <-> '237' FROM int2tmp ORDER BY a <-> '237' LIMIT 3;
diff --git a/contrib/btree_gist/expected/int8.out b/contrib/btree_gist/expected/int8.out
index 55982ee3b5c..eff77c26b5a 100644
--- a/contrib/btree_gist/expected/int8.out
+++ b/contrib/btree_gist/expected/int8.out
@@ -74,11 +74,11 @@ SELECT count(*) FROM int8tmp WHERE a > 464571291354841::int8;
EXPLAIN (COSTS OFF)
SELECT a, a <-> '464571291354841' FROM int8tmp ORDER BY a <-> '464571291354841' LIMIT 3;
- QUERY PLAN
----------------------------------------------------
+ QUERY PLAN
+-----------------------------------------------------
Limit
-> Index Only Scan using int8idx on int8tmp
- Order By: (a <-> 464571291354841::bigint)
+ Order By: (a <-> '464571291354841'::bigint)
(3 rows)
SELECT a, a <-> '464571291354841' FROM int8tmp ORDER BY a <-> '464571291354841' LIMIT 3;
diff --git a/contrib/btree_gist/expected/numeric.out b/contrib/btree_gist/expected/numeric.out
index b9b67b503a2..ae839b8ec83 100644
--- a/contrib/btree_gist/expected/numeric.out
+++ b/contrib/btree_gist/expected/numeric.out
@@ -190,12 +190,12 @@ SELECT count(*) FROM numerictmp WHERE a > 0 ;
SET enable_bitmapscan=off;
EXPLAIN (COSTS OFF)
SELECT * FROM numerictmp WHERE a BETWEEN 1 AND 300 ORDER BY a;
- QUERY PLAN
------------------------------------------------------------------
+ QUERY PLAN
+---------------------------------------------------------------------
Sort
Sort Key: a
-> Index Only Scan using numericidx on numerictmp
- Index Cond: ((a >= 1::numeric) AND (a <= 300::numeric))
+ Index Cond: ((a >= '1'::numeric) AND (a <= '300'::numeric))
(4 rows)
SELECT * FROM numerictmp WHERE a BETWEEN 1 AND 300 ORDER BY a;