1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-23 03:21:12 +03:00
Files
config
contrib
adminpack
amcheck
auth_delay
auto_explain
bloom
bool_plperl
btree_gin
btree_gist
data
expected
bit.out
bytea.out
cash.out
char.out
char_1.out
cidr.out
date.out
enum.out
float4.out
float8.out
inet.out
init.out
int2.out
int4.out
int8.out
interval.out
macaddr.out
macaddr8.out
not_equal.out
numeric.out
oid.out
text.out
text_1.out
time.out
timestamp.out
timestamptz.out
timetz.out
uuid.out
varbit.out
varchar.out
varchar_1.out
sql
.gitignore
Makefile
btree_bit.c
btree_bytea.c
btree_cash.c
btree_date.c
btree_enum.c
btree_float4.c
btree_float8.c
btree_gist--1.0--1.1.sql
btree_gist--1.1--1.2.sql
btree_gist--1.2--1.3.sql
btree_gist--1.2.sql
btree_gist--1.3--1.4.sql
btree_gist--1.4--1.5.sql
btree_gist--1.5--1.6.sql
btree_gist.c
btree_gist.control
btree_gist.h
btree_inet.c
btree_int2.c
btree_int4.c
btree_int8.c
btree_interval.c
btree_macaddr.c
btree_macaddr8.c
btree_numeric.c
btree_oid.c
btree_text.c
btree_time.c
btree_ts.c
btree_utils_num.c
btree_utils_num.h
btree_utils_var.c
btree_utils_var.h
btree_uuid.c
citext
cube
dblink
dict_int
dict_xsyn
earthdistance
file_fdw
fuzzystrmatch
hstore
hstore_plperl
hstore_plpython
intagg
intarray
isn
jsonb_plperl
jsonb_plpython
lo
ltree
ltree_plpython
oid2name
old_snapshot
pageinspect
passwordcheck
pg_buffercache
pg_freespacemap
pg_prewarm
pg_stat_statements
pg_surgery
pg_trgm
pg_visibility
pgcrypto
pgrowlocks
pgstattuple
postgres_fdw
seg
sepgsql
spi
sslinfo
start-scripts
tablefunc
tcn
test_decoding
tsm_system_rows
tsm_system_time
unaccent
uuid-ossp
vacuumlo
xml2
Makefile
README
contrib-global.mk
doc
src
.dir-locals.el
.editorconfig
.gitattributes
.gitignore
COPYRIGHT
GNUmakefile.in
HISTORY
Makefile
README
README.git
aclocal.m4
configure
configure.ac
postgres/contrib/btree_gist/expected/int8.out
Tom Lane 542320c2bd 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.
2015-03-30 14:59:49 -04:00

92 lines
1.9 KiB
Plaintext

-- int8 check
CREATE TABLE int8tmp (a int8);
\copy int8tmp from 'data/int8.data'
SET enable_seqscan=on;
SELECT count(*) FROM int8tmp WHERE a < 464571291354841;
count
-------
276
(1 row)
SELECT count(*) FROM int8tmp WHERE a <= 464571291354841;
count
-------
277
(1 row)
SELECT count(*) FROM int8tmp WHERE a = 464571291354841;
count
-------
1
(1 row)
SELECT count(*) FROM int8tmp WHERE a >= 464571291354841;
count
-------
271
(1 row)
SELECT count(*) FROM int8tmp WHERE a > 464571291354841;
count
-------
270
(1 row)
SELECT a, a <-> '464571291354841' FROM int8tmp ORDER BY a <-> '464571291354841' LIMIT 3;
a | ?column?
-----------------+----------------
464571291354841 | 0
457257666629329 | 7313624725512
478227196042750 | 13655904687909
(3 rows)
CREATE INDEX int8idx ON int8tmp USING gist ( a );
SET enable_seqscan=off;
SELECT count(*) FROM int8tmp WHERE a < 464571291354841::int8;
count
-------
276
(1 row)
SELECT count(*) FROM int8tmp WHERE a <= 464571291354841::int8;
count
-------
277
(1 row)
SELECT count(*) FROM int8tmp WHERE a = 464571291354841::int8;
count
-------
1
(1 row)
SELECT count(*) FROM int8tmp WHERE a >= 464571291354841::int8;
count
-------
271
(1 row)
SELECT count(*) FROM int8tmp WHERE a > 464571291354841::int8;
count
-------
270
(1 row)
EXPLAIN (COSTS OFF)
SELECT a, a <-> '464571291354841' FROM int8tmp ORDER BY a <-> '464571291354841' LIMIT 3;
QUERY PLAN
-----------------------------------------------------
Limit
-> Index Only Scan using int8idx on int8tmp
Order By: (a <-> '464571291354841'::bigint)
(3 rows)
SELECT a, a <-> '464571291354841' FROM int8tmp ORDER BY a <-> '464571291354841' LIMIT 3;
a | ?column?
-----------------+----------------
464571291354841 | 0
457257666629329 | 7313624725512
478227196042750 | 13655904687909
(3 rows)