1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

New version. Add support for int2, int8, float4, float8, timestamp with/without time zone, time with/without time zone, date, interval, oid, money and macaddr, char, varchar/text, bytea, numeric, bit, varbit, inet/cidr types for GiST

This commit is contained in:
Teodor Sigaev
2004-05-28 10:43:32 +00:00
parent 1a321f26d8
commit 42d069886f
99 changed files with 18221 additions and 2974 deletions

View File

@ -0,0 +1,66 @@
-- bit check
CREATE TABLE bittmp (a bit(33));
\copy bittmp from 'data/bit.data'
SET enable_seqscan=on;
SELECT count(*) FROM bittmp WHERE a < '011011000100010111011000110000100';
count
-------
249
(1 row)
SELECT count(*) FROM bittmp WHERE a <= '011011000100010111011000110000100';
count
-------
250
(1 row)
SELECT count(*) FROM bittmp WHERE a = '011011000100010111011000110000100';
count
-------
1
(1 row)
SELECT count(*) FROM bittmp WHERE a >= '011011000100010111011000110000100';
count
-------
351
(1 row)
SELECT count(*) FROM bittmp WHERE a > '011011000100010111011000110000100';
count
-------
350
(1 row)
CREATE INDEX bitidx ON bittmp USING GIST ( a );
SET enable_seqscan=off;
SELECT count(*) FROM bittmp WHERE a < '011011000100010111011000110000100';
count
-------
249
(1 row)
SELECT count(*) FROM bittmp WHERE a <= '011011000100010111011000110000100';
count
-------
250
(1 row)
SELECT count(*) FROM bittmp WHERE a = '011011000100010111011000110000100';
count
-------
1
(1 row)
SELECT count(*) FROM bittmp WHERE a >= '011011000100010111011000110000100';
count
-------
351
(1 row)
SELECT count(*) FROM bittmp WHERE a > '011011000100010111011000110000100';
count
-------
350
(1 row)

View File

@ -1,102 +0,0 @@
--
-- first, define the datatype. Turn off echoing so that expected file
-- does not depend on contents of btree_gist.sql.
--
\set ECHO none
psql:btree_gist.sql:8: NOTICE: type "int2key" is not yet defined
DETAIL: Creating a shell type definition.
psql:btree_gist.sql:13: NOTICE: argument type int2key is only a shell
psql:btree_gist.sql:25: NOTICE: type "int4key" is not yet defined
DETAIL: Creating a shell type definition.
psql:btree_gist.sql:30: NOTICE: argument type int4key is only a shell
psql:btree_gist.sql:42: NOTICE: type "int8key" is not yet defined
DETAIL: Creating a shell type definition.
psql:btree_gist.sql:47: NOTICE: argument type int8key is only a shell
psql:btree_gist.sql:59: NOTICE: type "float4key" is not yet defined
DETAIL: Creating a shell type definition.
psql:btree_gist.sql:64: NOTICE: argument type float4key is only a shell
psql:btree_gist.sql:77: NOTICE: type "float8key" is not yet defined
DETAIL: Creating a shell type definition.
psql:btree_gist.sql:82: NOTICE: argument type float8key is only a shell
psql:btree_gist.sql:392: NOTICE: type "tskey" is not yet defined
DETAIL: Creating a shell type definition.
psql:btree_gist.sql:397: NOTICE: argument type tskey is only a shell
CREATE TABLE int4tmp (b int4);
\copy int4tmp from 'data/test_btree.data'
CREATE TABLE int8tmp (b int8);
\copy int8tmp from 'data/test_btree.data'
CREATE TABLE float4tmp (b float4);
\copy float4tmp from 'data/test_btree.data'
CREATE TABLE float8tmp (b float8);
\copy float8tmp from 'data/test_btree.data'
CREATE TABLE tstmp ( t timestamp without time zone );
\copy tstmp from 'data/test_btree_ts.data'
-- without idx
SELECT count(*) FROM int4tmp WHERE b <=10;
count
-------
11
(1 row)
SELECT count(*) FROM int8tmp WHERE b <=10;
count
-------
11
(1 row)
SELECT count(*) FROM float4tmp WHERE b <=10;
count
-------
11
(1 row)
SELECT count(*) FROM float8tmp WHERE b <=10;
count
-------
11
(1 row)
SELECT count(*) FROM tstmp WHERE t < '2001-05-29 08:33:09';
count
-------
66
(1 row)
-- create idx
CREATE INDEX aaaidx ON int4tmp USING gist ( b );
CREATE INDEX bbbidx ON int8tmp USING gist ( b );
CREATE INDEX cccidx ON float4tmp USING gist ( b );
CREATE INDEX dddidx ON float8tmp USING gist ( b );
CREATE INDEX tsidx ON tstmp USING gist ( t );
--with idx
SET enable_seqscan=off;
SELECT count(*) FROM int4tmp WHERE b <=10::int4;
count
-------
11
(1 row)
SELECT count(*) FROM int8tmp WHERE b <=10::int8;
count
-------
11
(1 row)
SELECT count(*) FROM float4tmp WHERE b <=10::float4;
count
-------
11
(1 row)
SELECT count(*) FROM float8tmp WHERE b <=10::float8;
count
-------
11
(1 row)
SELECT count(*) FROM tstmp WHERE t < '2001-05-29 08:33:09';
count
-------
66
(1 row)

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,66 @@
-- money check
CREATE TABLE moneytmp (a money) WITH OIDS;
\copy moneytmp from 'data/cash.data'
SET enable_seqscan=on;
SELECT count(*) FROM moneytmp WHERE a < '22649.64';
count
-------
289
(1 row)
SELECT count(*) FROM moneytmp WHERE a <= '22649.64';
count
-------
290
(1 row)
SELECT count(*) FROM moneytmp WHERE a = '22649.64';
count
-------
1
(1 row)
SELECT count(*) FROM moneytmp WHERE a >= '22649.64';
count
-------
254
(1 row)
SELECT count(*) FROM moneytmp WHERE a > '22649.64';
count
-------
253
(1 row)
CREATE INDEX moneyidx ON moneytmp USING gist ( a );
SET enable_seqscan=off;
SELECT count(*) FROM moneytmp WHERE a < '22649.64'::money;
count
-------
289
(1 row)
SELECT count(*) FROM moneytmp WHERE a <= '22649.64'::money;
count
-------
290
(1 row)
SELECT count(*) FROM moneytmp WHERE a = '22649.64'::money;
count
-------
1
(1 row)
SELECT count(*) FROM moneytmp WHERE a >= '22649.64'::money;
count
-------
254
(1 row)
SELECT count(*) FROM moneytmp WHERE a > '22649.64'::money;
count
-------
253
(1 row)

View File

@ -0,0 +1,66 @@
-- char check
CREATE TABLE chartmp (a char(32));
\copy chartmp from 'data/char.data'
SET enable_seqscan=on;
SELECT count(*) FROM chartmp WHERE a < '31b0'::char(32);
count
-------
121
(1 row)
SELECT count(*) FROM chartmp WHERE a <= '31b0'::char(32);
count
-------
122
(1 row)
SELECT count(*) FROM chartmp WHERE a = '31b0'::char(32);
count
-------
1
(1 row)
SELECT count(*) FROM chartmp WHERE a >= '31b0'::char(32);
count
-------
401
(1 row)
SELECT count(*) FROM chartmp WHERE a > '31b0'::char(32);
count
-------
400
(1 row)
CREATE INDEX charidx ON chartmp USING GIST ( a );
SET enable_seqscan=off;
SELECT count(*) FROM chartmp WHERE a < '31b0'::char(32);
count
-------
121
(1 row)
SELECT count(*) FROM chartmp WHERE a <= '31b0'::char(32);
count
-------
122
(1 row)
SELECT count(*) FROM chartmp WHERE a = '31b0'::char(32);
count
-------
1
(1 row)
SELECT count(*) FROM chartmp WHERE a >= '31b0'::char(32);
count
-------
401
(1 row)
SELECT count(*) FROM chartmp WHERE a > '31b0'::char(32);
count
-------
400
(1 row)

View File

@ -0,0 +1,66 @@
-- cidr check
CREATE TABLE cidrtmp AS
SELECT cidr(a) AS a FROM inettmp ;
SET enable_seqscan=on;
SELECT count(*) FROM cidrtmp WHERE a < '121.111.63.82';
count
-------
290
(1 row)
SELECT count(*) FROM cidrtmp WHERE a <= '121.111.63.82';
count
-------
291
(1 row)
SELECT count(*) FROM cidrtmp WHERE a = '121.111.63.82';
count
-------
1
(1 row)
SELECT count(*) FROM cidrtmp WHERE a >= '121.111.63.82';
count
-------
310
(1 row)
SELECT count(*) FROM cidrtmp WHERE a > '121.111.63.82';
count
-------
309
(1 row)
CREATE INDEX cidridx ON cidrtmp USING gist ( a );
SET enable_seqscan=off;
SELECT count(*) FROM cidrtmp WHERE a < '121.111.63.82'::cidr;
count
-------
290
(1 row)
SELECT count(*) FROM cidrtmp WHERE a <= '121.111.63.82'::cidr;
count
-------
291
(1 row)
SELECT count(*) FROM cidrtmp WHERE a = '121.111.63.82'::cidr;
count
-------
1
(1 row)
SELECT count(*) FROM cidrtmp WHERE a >= '121.111.63.82'::cidr;
count
-------
310
(1 row)
SELECT count(*) FROM cidrtmp WHERE a > '121.111.63.82'::cidr;
count
-------
309
(1 row)

View File

@ -0,0 +1,66 @@
-- date check
CREATE TABLE datetmp (a date);
\copy datetmp from 'data/date.data'
SET enable_seqscan=on;
SELECT count(*) FROM datetmp WHERE a < '2001-02-13';
count
-------
230
(1 row)
SELECT count(*) FROM datetmp WHERE a <= '2001-02-13';
count
-------
231
(1 row)
SELECT count(*) FROM datetmp WHERE a = '2001-02-13';
count
-------
1
(1 row)
SELECT count(*) FROM datetmp WHERE a >= '2001-02-13';
count
-------
314
(1 row)
SELECT count(*) FROM datetmp WHERE a > '2001-02-13';
count
-------
313
(1 row)
CREATE INDEX dateidx ON datetmp USING gist ( a );
SET enable_seqscan=off;
SELECT count(*) FROM datetmp WHERE a < '2001-02-13'::date;
count
-------
230
(1 row)
SELECT count(*) FROM datetmp WHERE a <= '2001-02-13'::date;
count
-------
231
(1 row)
SELECT count(*) FROM datetmp WHERE a = '2001-02-13'::date;
count
-------
1
(1 row)
SELECT count(*) FROM datetmp WHERE a >= '2001-02-13'::date;
count
-------
314
(1 row)
SELECT count(*) FROM datetmp WHERE a > '2001-02-13'::date;
count
-------
313
(1 row)

View File

@ -0,0 +1,66 @@
-- float4 check
CREATE TABLE float4tmp (a float4);
\copy float4tmp from 'data/float4.data'
SET enable_seqscan=on;
SELECT count(*) FROM float4tmp WHERE a < -179.0;
count
-------
244
(1 row)
SELECT count(*) FROM float4tmp WHERE a <= -179.0;
count
-------
245
(1 row)
SELECT count(*) FROM float4tmp WHERE a = -179.0;
count
-------
1
(1 row)
SELECT count(*) FROM float4tmp WHERE a >= -179.0;
count
-------
303
(1 row)
SELECT count(*) FROM float4tmp WHERE a > -179.0;
count
-------
302
(1 row)
CREATE INDEX float4idx ON float4tmp USING gist ( a );
SET enable_seqscan=off;
SELECT count(*) FROM float4tmp WHERE a < -179.0::float4;
count
-------
244
(1 row)
SELECT count(*) FROM float4tmp WHERE a <= -179.0::float4;
count
-------
245
(1 row)
SELECT count(*) FROM float4tmp WHERE a = -179.0::float4;
count
-------
1
(1 row)
SELECT count(*) FROM float4tmp WHERE a >= -179.0::float4;
count
-------
303
(1 row)
SELECT count(*) FROM float4tmp WHERE a > -179.0::float4;
count
-------
302
(1 row)

View File

@ -0,0 +1,66 @@
-- float8 check
CREATE TABLE float8tmp (a float8);
\copy float8tmp from 'data/float8.data'
SET enable_seqscan=on;
SELECT count(*) FROM float8tmp WHERE a < -1890.0;
count
-------
237
(1 row)
SELECT count(*) FROM float8tmp WHERE a <= -1890.0;
count
-------
238
(1 row)
SELECT count(*) FROM float8tmp WHERE a = -1890.0;
count
-------
1
(1 row)
SELECT count(*) FROM float8tmp WHERE a >= -1890.0;
count
-------
307
(1 row)
SELECT count(*) FROM float8tmp WHERE a > -1890.0;
count
-------
306
(1 row)
CREATE INDEX float8idx ON float8tmp USING gist ( a );
SET enable_seqscan=off;
SELECT count(*) FROM float8tmp WHERE a < -1890.0::float8;
count
-------
237
(1 row)
SELECT count(*) FROM float8tmp WHERE a <= -1890.0::float8;
count
-------
238
(1 row)
SELECT count(*) FROM float8tmp WHERE a = -1890.0::float8;
count
-------
1
(1 row)
SELECT count(*) FROM float8tmp WHERE a >= -1890.0::float8;
count
-------
307
(1 row)
SELECT count(*) FROM float8tmp WHERE a > -1890.0::float8;
count
-------
306
(1 row)

View File

@ -0,0 +1,66 @@
-- inet check
CREATE TABLE inettmp (a inet);
\copy inettmp from 'data/inet.data'
SET enable_seqscan=on;
SELECT count(*) FROM inettmp WHERE a < '89.225.196.191';
count
-------
213
(1 row)
SELECT count(*) FROM inettmp WHERE a <= '89.225.196.191';
count
-------
214
(1 row)
SELECT count(*) FROM inettmp WHERE a = '89.225.196.191';
count
-------
1
(1 row)
SELECT count(*) FROM inettmp WHERE a >= '89.225.196.191';
count
-------
387
(1 row)
SELECT count(*) FROM inettmp WHERE a > '89.225.196.191';
count
-------
386
(1 row)
CREATE INDEX inetidx ON inettmp USING gist ( a );
SET enable_seqscan=off;
SELECT count(*) FROM inettmp WHERE a < '89.225.196.191'::inet;
count
-------
213
(1 row)
SELECT count(*) FROM inettmp WHERE a <= '89.225.196.191'::inet;
count
-------
214
(1 row)
SELECT count(*) FROM inettmp WHERE a = '89.225.196.191'::inet;
count
-------
1
(1 row)
SELECT count(*) FROM inettmp WHERE a >= '89.225.196.191'::inet;
count
-------
387
(1 row)
SELECT count(*) FROM inettmp WHERE a > '89.225.196.191'::inet;
count
-------
386
(1 row)

View File

@ -0,0 +1,20 @@
--
-- first, define the datatype. Turn off echoing so that expected file
-- does not depend on contents of btree_gist.sql.
--
\set ECHO none
psql:btree_gist.sql:7: NOTICE: type "gbtreekey4" is not yet defined
DETAIL: Creating a shell type definition.
psql:btree_gist.sql:12: NOTICE: argument type gbtreekey4 is only a shell
psql:btree_gist.sql:23: NOTICE: type "gbtreekey8" is not yet defined
DETAIL: Creating a shell type definition.
psql:btree_gist.sql:28: NOTICE: argument type gbtreekey8 is only a shell
psql:btree_gist.sql:39: NOTICE: type "gbtreekey16" is not yet defined
DETAIL: Creating a shell type definition.
psql:btree_gist.sql:44: NOTICE: argument type gbtreekey16 is only a shell
psql:btree_gist.sql:55: NOTICE: type "gbtreekey24" is not yet defined
DETAIL: Creating a shell type definition.
psql:btree_gist.sql:60: NOTICE: argument type gbtreekey24 is only a shell
psql:btree_gist.sql:71: NOTICE: type "gbtreekey_var" is not yet defined
DETAIL: Creating a shell type definition.
psql:btree_gist.sql:76: NOTICE: argument type gbtreekey_var is only a shell

View File

@ -0,0 +1,66 @@
-- int2 check
CREATE TABLE int2tmp (a int2);
\copy int2tmp from 'data/int2.data'
SET enable_seqscan=on;
SELECT count(*) FROM int2tmp WHERE a < 237;
count
-------
297
(1 row)
SELECT count(*) FROM int2tmp WHERE a <= 237;
count
-------
298
(1 row)
SELECT count(*) FROM int2tmp WHERE a = 237;
count
-------
1
(1 row)
SELECT count(*) FROM int2tmp WHERE a >= 237;
count
-------
249
(1 row)
SELECT count(*) FROM int2tmp WHERE a > 237;
count
-------
248
(1 row)
CREATE INDEX int2idx ON int2tmp USING gist ( a );
SET enable_seqscan=off;
SELECT count(*) FROM int2tmp WHERE a < 237::int2;
count
-------
297
(1 row)
SELECT count(*) FROM int2tmp WHERE a <= 237::int2;
count
-------
298
(1 row)
SELECT count(*) FROM int2tmp WHERE a = 237::int2;
count
-------
1
(1 row)
SELECT count(*) FROM int2tmp WHERE a >= 237::int2;
count
-------
249
(1 row)
SELECT count(*) FROM int2tmp WHERE a > 237::int2;
count
-------
248
(1 row)

View File

@ -0,0 +1,66 @@
-- int4 check
CREATE TABLE int4tmp (a int4);
\copy int4tmp from 'data/int2.data'
SET enable_seqscan=on;
SELECT count(*) FROM int4tmp WHERE a < 237;
count
-------
297
(1 row)
SELECT count(*) FROM int4tmp WHERE a <= 237;
count
-------
298
(1 row)
SELECT count(*) FROM int4tmp WHERE a = 237;
count
-------
1
(1 row)
SELECT count(*) FROM int4tmp WHERE a >= 237;
count
-------
249
(1 row)
SELECT count(*) FROM int4tmp WHERE a > 237;
count
-------
248
(1 row)
CREATE INDEX int4idx ON int4tmp USING gist ( a );
SET enable_seqscan=off;
SELECT count(*) FROM int4tmp WHERE a < 237::int4;
count
-------
297
(1 row)
SELECT count(*) FROM int4tmp WHERE a <= 237::int4;
count
-------
298
(1 row)
SELECT count(*) FROM int4tmp WHERE a = 237::int4;
count
-------
1
(1 row)
SELECT count(*) FROM int4tmp WHERE a >= 237::int4;
count
-------
249
(1 row)
SELECT count(*) FROM int4tmp WHERE a > 237::int4;
count
-------
248
(1 row)

View File

@ -0,0 +1,66 @@
-- 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)
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)

View File

@ -0,0 +1,66 @@
-- interval check
CREATE TABLE intervaltmp (a interval);
\copy intervaltmp from 'data/interval.data'
SET enable_seqscan=on;
SELECT count(*) FROM intervaltmp WHERE a < '199 days 21:21:23';
count
-------
329
(1 row)
SELECT count(*) FROM intervaltmp WHERE a <= '199 days 21:21:23';
count
-------
330
(1 row)
SELECT count(*) FROM intervaltmp WHERE a = '199 days 21:21:23';
count
-------
1
(1 row)
SELECT count(*) FROM intervaltmp WHERE a >= '199 days 21:21:23';
count
-------
271
(1 row)
SELECT count(*) FROM intervaltmp WHERE a > '199 days 21:21:23';
count
-------
270
(1 row)
CREATE INDEX intervalidx ON intervaltmp USING gist ( a );
SET enable_seqscan=off;
SELECT count(*) FROM intervaltmp WHERE a < '199 days 21:21:23'::interval;
count
-------
329
(1 row)
SELECT count(*) FROM intervaltmp WHERE a <= '199 days 21:21:23'::interval;
count
-------
330
(1 row)
SELECT count(*) FROM intervaltmp WHERE a = '199 days 21:21:23'::interval;
count
-------
1
(1 row)
SELECT count(*) FROM intervaltmp WHERE a >= '199 days 21:21:23'::interval;
count
-------
271
(1 row)
SELECT count(*) FROM intervaltmp WHERE a > '199 days 21:21:23'::interval;
count
-------
270
(1 row)

View File

@ -0,0 +1,66 @@
-- macaddr check
CREATE TABLE macaddrtmp (a macaddr);
\copy macaddrtmp from 'data/macaddr.data'
SET enable_seqscan=on;
SELECT count(*) FROM macaddrtmp WHERE a < '22:00:5c:e5:9b:0d';
count
-------
56
(1 row)
SELECT count(*) FROM macaddrtmp WHERE a <= '22:00:5c:e5:9b:0d';
count
-------
60
(1 row)
SELECT count(*) FROM macaddrtmp WHERE a = '22:00:5c:e5:9b:0d';
count
-------
4
(1 row)
SELECT count(*) FROM macaddrtmp WHERE a >= '22:00:5c:e5:9b:0d';
count
-------
544
(1 row)
SELECT count(*) FROM macaddrtmp WHERE a > '22:00:5c:e5:9b:0d';
count
-------
540
(1 row)
CREATE INDEX macaddridx ON macaddrtmp USING gist ( a );
SET enable_seqscan=off;
SELECT count(*) FROM macaddrtmp WHERE a < '22:00:5c:e5:9b:0d'::macaddr;
count
-------
56
(1 row)
SELECT count(*) FROM macaddrtmp WHERE a <= '22:00:5c:e5:9b:0d'::macaddr;
count
-------
60
(1 row)
SELECT count(*) FROM macaddrtmp WHERE a = '22:00:5c:e5:9b:0d'::macaddr;
count
-------
4
(1 row)
SELECT count(*) FROM macaddrtmp WHERE a >= '22:00:5c:e5:9b:0d'::macaddr;
count
-------
544
(1 row)
SELECT count(*) FROM macaddrtmp WHERE a > '22:00:5c:e5:9b:0d'::macaddr;
count
-------
540
(1 row)

View File

@ -0,0 +1,188 @@
-- numeric check
CREATE TABLE numerictmp (a numeric);
\copy numerictmp from 'data/int8.data'
\copy numerictmp from 'data/numeric.data'
\copy numerictmp from 'data/float8.data'
SET enable_seqscan=on;
SELECT count(*) FROM numerictmp WHERE a < -1890.0;
count
-------
505
(1 row)
SELECT count(*) FROM numerictmp WHERE a <= -1890.0;
count
-------
506
(1 row)
SELECT count(*) FROM numerictmp WHERE a = -1890.0;
count
-------
1
(1 row)
SELECT count(*) FROM numerictmp WHERE a >= -1890.0;
count
-------
597
(1 row)
SELECT count(*) FROM numerictmp WHERE a > -1890.0;
count
-------
596
(1 row)
SELECT count(*) FROM numerictmp WHERE a < 'NaN' ;
count
-------
1100
(1 row)
SELECT count(*) FROM numerictmp WHERE a <= 'NaN' ;
count
-------
1102
(1 row)
SELECT count(*) FROM numerictmp WHERE a = 'NaN' ;
count
-------
2
(1 row)
SELECT count(*) FROM numerictmp WHERE a >= 'NaN' ;
count
-------
2
(1 row)
SELECT count(*) FROM numerictmp WHERE a > 'NaN' ;
count
-------
0
(1 row)
SELECT count(*) FROM numerictmp WHERE a < 0 ;
count
-------
523
(1 row)
SELECT count(*) FROM numerictmp WHERE a <= 0 ;
count
-------
526
(1 row)
SELECT count(*) FROM numerictmp WHERE a = 0 ;
count
-------
3
(1 row)
SELECT count(*) FROM numerictmp WHERE a >= 0 ;
count
-------
579
(1 row)
SELECT count(*) FROM numerictmp WHERE a > 0 ;
count
-------
576
(1 row)
CREATE INDEX numericidx ON numerictmp USING gist ( a );
SET enable_seqscan=off;
SELECT count(*) FROM numerictmp WHERE a < -1890.0;
count
-------
505
(1 row)
SELECT count(*) FROM numerictmp WHERE a <= -1890.0;
count
-------
506
(1 row)
SELECT count(*) FROM numerictmp WHERE a = -1890.0;
count
-------
1
(1 row)
SELECT count(*) FROM numerictmp WHERE a >= -1890.0;
count
-------
597
(1 row)
SELECT count(*) FROM numerictmp WHERE a > -1890.0;
count
-------
596
(1 row)
SELECT count(*) FROM numerictmp WHERE a < 'NaN' ;
count
-------
1100
(1 row)
SELECT count(*) FROM numerictmp WHERE a <= 'NaN' ;
count
-------
1102
(1 row)
SELECT count(*) FROM numerictmp WHERE a = 'NaN' ;
count
-------
2
(1 row)
SELECT count(*) FROM numerictmp WHERE a >= 'NaN' ;
count
-------
2
(1 row)
SELECT count(*) FROM numerictmp WHERE a > 'NaN' ;
count
-------
0
(1 row)
SELECT count(*) FROM numerictmp WHERE a < 0 ;
count
-------
523
(1 row)
SELECT count(*) FROM numerictmp WHERE a <= 0 ;
count
-------
526
(1 row)
SELECT count(*) FROM numerictmp WHERE a = 0 ;
count
-------
3
(1 row)
SELECT count(*) FROM numerictmp WHERE a >= 0 ;
count
-------
579
(1 row)
SELECT count(*) FROM numerictmp WHERE a > 0 ;
count
-------
576
(1 row)

View File

@ -0,0 +1,64 @@
-- oid check
SET enable_seqscan=on;
SELECT count(*) FROM moneytmp WHERE oid < ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
count
-------
372
(1 row)
SELECT count(*) FROM moneytmp WHERE oid <= ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
count
-------
373
(1 row)
SELECT count(*) FROM moneytmp WHERE oid = ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
count
-------
1
(1 row)
SELECT count(*) FROM moneytmp WHERE oid >= ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
count
-------
228
(1 row)
SELECT count(*) FROM moneytmp WHERE oid > ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
count
-------
227
(1 row)
CREATE INDEX oididx ON moneytmp USING gist ( oid );
SET enable_seqscan=off;
SELECT count(*) FROM moneytmp WHERE oid < ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
count
-------
372
(1 row)
SELECT count(*) FROM moneytmp WHERE oid <= ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
count
-------
373
(1 row)
SELECT count(*) FROM moneytmp WHERE oid = ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
count
-------
1
(1 row)
SELECT count(*) FROM moneytmp WHERE oid >= ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
count
-------
228
(1 row)
SELECT count(*) FROM moneytmp WHERE oid > ( SELECT oid FROM moneytmp WHERE a = '22649.64' );
count
-------
227
(1 row)

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,66 @@
-- time check
CREATE TABLE timetmp (a time);
\copy timetmp from 'data/time.data'
SET enable_seqscan=on;
SELECT count(*) FROM timetmp WHERE a < '10:57:11';
count
-------
251
(1 row)
SELECT count(*) FROM timetmp WHERE a <= '10:57:11';
count
-------
252
(1 row)
SELECT count(*) FROM timetmp WHERE a = '10:57:11';
count
-------
1
(1 row)
SELECT count(*) FROM timetmp WHERE a >= '10:57:11';
count
-------
293
(1 row)
SELECT count(*) FROM timetmp WHERE a > '10:57:11';
count
-------
292
(1 row)
CREATE INDEX timeidx ON timetmp USING gist ( a );
SET enable_seqscan=off;
SELECT count(*) FROM timetmp WHERE a < '10:57:11'::time;
count
-------
251
(1 row)
SELECT count(*) FROM timetmp WHERE a <= '10:57:11'::time;
count
-------
252
(1 row)
SELECT count(*) FROM timetmp WHERE a = '10:57:11'::time;
count
-------
1
(1 row)
SELECT count(*) FROM timetmp WHERE a >= '10:57:11'::time;
count
-------
293
(1 row)
SELECT count(*) FROM timetmp WHERE a > '10:57:11'::time;
count
-------
292
(1 row)

View File

@ -0,0 +1,66 @@
-- timestamp check
CREATE TABLE timestamptmp (a timestamp);
\copy timestamptmp from 'data/timestamp.data'
SET enable_seqscan=on;
SELECT count(*) FROM timestamptmp WHERE a < '2004-10-26 08:55:08';
count
-------
270
(1 row)
SELECT count(*) FROM timestamptmp WHERE a <= '2004-10-26 08:55:08';
count
-------
271
(1 row)
SELECT count(*) FROM timestamptmp WHERE a = '2004-10-26 08:55:08';
count
-------
1
(1 row)
SELECT count(*) FROM timestamptmp WHERE a >= '2004-10-26 08:55:08';
count
-------
274
(1 row)
SELECT count(*) FROM timestamptmp WHERE a > '2004-10-26 08:55:08';
count
-------
273
(1 row)
CREATE INDEX timestampidx ON timestamptmp USING gist ( a );
SET enable_seqscan=off;
SELECT count(*) FROM timestamptmp WHERE a < '2004-10-26 08:55:08'::timestamp;
count
-------
270
(1 row)
SELECT count(*) FROM timestamptmp WHERE a <= '2004-10-26 08:55:08'::timestamp;
count
-------
271
(1 row)
SELECT count(*) FROM timestamptmp WHERE a = '2004-10-26 08:55:08'::timestamp;
count
-------
1
(1 row)
SELECT count(*) FROM timestamptmp WHERE a >= '2004-10-26 08:55:08'::timestamp;
count
-------
274
(1 row)
SELECT count(*) FROM timestamptmp WHERE a > '2004-10-26 08:55:08'::timestamp;
count
-------
273
(1 row)

View File

@ -0,0 +1,186 @@
-- timestamptz check
CREATE TABLE timestamptztmp (a timestamptz);
\copy timestamptztmp from 'data/timestamptz.data'
SET enable_seqscan=on;
SELECT count(*) FROM timestamptztmp WHERE a < '2018-12-18 10:59:54 GMT+3';
count
-------
385
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a <= '2018-12-18 10:59:54 GMT+3';
count
-------
386
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a = '2018-12-18 10:59:54 GMT+3';
count
-------
1
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a >= '2018-12-18 10:59:54 GMT+3';
count
-------
146
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a > '2018-12-18 10:59:54 GMT+3';
count
-------
145
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a < '2018-12-18 10:59:54 GMT+2';
count
-------
385
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a <= '2018-12-18 10:59:54 GMT+2';
count
-------
385
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a = '2018-12-18 10:59:54 GMT+2';
count
-------
0
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a >= '2018-12-18 10:59:54 GMT+2';
count
-------
146
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a > '2018-12-18 10:59:54 GMT+2';
count
-------
146
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a < '2018-12-18 10:59:54 GMT+4';
count
-------
386
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a <= '2018-12-18 10:59:54 GMT+4';
count
-------
386
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a = '2018-12-18 10:59:54 GMT+4';
count
-------
0
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a >= '2018-12-18 10:59:54 GMT+4';
count
-------
145
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a > '2018-12-18 10:59:54 GMT+4';
count
-------
145
(1 row)
CREATE INDEX timestamptzidx ON timestamptztmp USING gist ( a );
SET enable_seqscan=off;
SELECT count(*) FROM timestamptztmp WHERE a < '2018-12-18 10:59:54 GMT+3'::timestamptz;
count
-------
385
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a <= '2018-12-18 10:59:54 GMT+3'::timestamptz;
count
-------
386
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a = '2018-12-18 10:59:54 GMT+3'::timestamptz;
count
-------
1
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a >= '2018-12-18 10:59:54 GMT+3'::timestamptz;
count
-------
146
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a > '2018-12-18 10:59:54 GMT+3'::timestamptz;
count
-------
145
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a < '2018-12-18 10:59:54 GMT+2'::timestamptz;
count
-------
385
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a <= '2018-12-18 10:59:54 GMT+2'::timestamptz;
count
-------
385
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a = '2018-12-18 10:59:54 GMT+2'::timestamptz;
count
-------
0
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a >= '2018-12-18 10:59:54 GMT+2'::timestamptz;
count
-------
146
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a > '2018-12-18 10:59:54 GMT+2'::timestamptz;
count
-------
146
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a < '2018-12-18 10:59:54 GMT+4'::timestamptz;
count
-------
386
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a <= '2018-12-18 10:59:54 GMT+4'::timestamptz;
count
-------
386
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a = '2018-12-18 10:59:54 GMT+4'::timestamptz;
count
-------
0
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a >= '2018-12-18 10:59:54 GMT+4'::timestamptz;
count
-------
145
(1 row)
SELECT count(*) FROM timestamptztmp WHERE a > '2018-12-18 10:59:54 GMT+4'::timestamptz;
count
-------
145
(1 row)

View File

@ -0,0 +1,43 @@
-- timetz check
CREATE TABLE timetztmp (a timetz);
\copy timetztmp from 'data/timetz.data'
CREATE TABLE timetzcmp ( r_id int2, a int4, b int4 );
SET enable_seqscan=on;
INSERT INTO timetzcmp (r_id,a) SELECT 1,count(*) FROM timetztmp WHERE a < '07:46:45 GMT+3';
INSERT INTO timetzcmp (r_id,a) SELECT 2,count(*) FROM timetztmp WHERE a <= '07:46:45 GMT+3';
INSERT INTO timetzcmp (r_id,a) SELECT 3,count(*) FROM timetztmp WHERE a = '07:46:45 GMT+3';
INSERT INTO timetzcmp (r_id,a) SELECT 4,count(*) FROM timetztmp WHERE a >= '07:46:45 GMT+3';
INSERT INTO timetzcmp (r_id,a) SELECT 5,count(*) FROM timetztmp WHERE a > '07:46:45 GMT+3';
INSERT INTO timetzcmp (r_id,a) SELECT 11,count(*) FROM timetztmp WHERE a < '07:46:45 GMT+2';
INSERT INTO timetzcmp (r_id,a) SELECT 12,count(*) FROM timetztmp WHERE a <= '07:46:45 GMT+2';
INSERT INTO timetzcmp (r_id,a) SELECT 13,count(*) FROM timetztmp WHERE a = '07:46:45 GMT+2';
INSERT INTO timetzcmp (r_id,a) SELECT 14,count(*) FROM timetztmp WHERE a >= '07:46:45 GMT+2';
INSERT INTO timetzcmp (r_id,a) SELECT 15,count(*) FROM timetztmp WHERE a > '07:46:45 GMT+2';
INSERT INTO timetzcmp (r_id,a) SELECT 21,count(*) FROM timetztmp WHERE a < '07:46:45 GMT+4';
INSERT INTO timetzcmp (r_id,a) SELECT 22,count(*) FROM timetztmp WHERE a <= '07:46:45 GMT+4';
INSERT INTO timetzcmp (r_id,a) SELECT 23,count(*) FROM timetztmp WHERE a = '07:46:45 GMT+4';
INSERT INTO timetzcmp (r_id,a) SELECT 24,count(*) FROM timetztmp WHERE a >= '07:46:45 GMT+4';
INSERT INTO timetzcmp (r_id,a) SELECT 25,count(*) FROM timetztmp WHERE a > '07:46:45 GMT+4';
CREATE INDEX timetzidx ON timetztmp USING gist ( a );
SET enable_seqscan=off;
UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a < '07:46:45 GMT+3'::timetz ) q WHERE r_id=1 ;
UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a <= '07:46:45 GMT+3'::timetz ) q WHERE r_id=2 ;
UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a = '07:46:45 GMT+3'::timetz ) q WHERE r_id=3 ;
UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a >= '07:46:45 GMT+3'::timetz ) q WHERE r_id=4 ;
UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a > '07:46:45 GMT+3'::timetz ) q WHERE r_id=5 ;
UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a < '07:46:45 GMT+2'::timetz ) q WHERE r_id=11 ;
UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a <= '07:46:45 GMT+2'::timetz ) q WHERE r_id=12 ;
UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a = '07:46:45 GMT+2'::timetz ) q WHERE r_id=13 ;
UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a >= '07:46:45 GMT+2'::timetz ) q WHERE r_id=14 ;
UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a > '07:46:45 GMT+2'::timetz ) q WHERE r_id=15 ;
UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a < '07:46:45 GMT+4'::timetz ) q WHERE r_id=21 ;
UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a <= '07:46:45 GMT+4'::timetz ) q WHERE r_id=22 ;
UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a = '07:46:45 GMT+4'::timetz ) q WHERE r_id=23 ;
UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a >= '07:46:45 GMT+4'::timetz ) q WHERE r_id=24 ;
UPDATE timetzcmp SET b=c FROM ( SELECT count(*) AS c FROM timetztmp WHERE a > '07:46:45 GMT+4'::timetz ) q WHERE r_id=25 ;
SELECT count(*) FROM timetzcmp WHERE a=b;
count
-------
15
(1 row)

View File

@ -0,0 +1,66 @@
-- varbit check
CREATE TABLE varbittmp (a varbit);
\copy varbittmp from 'data/varbit.data'
SET enable_seqscan=on;
SELECT count(*) FROM varbittmp WHERE a < '1110100111010';
count
-------
549
(1 row)
SELECT count(*) FROM varbittmp WHERE a <= '1110100111010';
count
-------
550
(1 row)
SELECT count(*) FROM varbittmp WHERE a = '1110100111010';
count
-------
1
(1 row)
SELECT count(*) FROM varbittmp WHERE a >= '1110100111010';
count
-------
51
(1 row)
SELECT count(*) FROM varbittmp WHERE a > '1110100111010';
count
-------
50
(1 row)
CREATE INDEX varbitidx ON varbittmp USING GIST ( a );
SET enable_seqscan=off;
SELECT count(*) FROM varbittmp WHERE a < '1110100111010'::varbit;
count
-------
549
(1 row)
SELECT count(*) FROM varbittmp WHERE a <= '1110100111010'::varbit;
count
-------
550
(1 row)
SELECT count(*) FROM varbittmp WHERE a = '1110100111010'::varbit;
count
-------
1
(1 row)
SELECT count(*) FROM varbittmp WHERE a >= '1110100111010'::varbit;
count
-------
51
(1 row)
SELECT count(*) FROM varbittmp WHERE a > '1110100111010'::varbit;
count
-------
50
(1 row)

View File

@ -0,0 +1,66 @@
-- char check
CREATE TABLE vchartmp (a varchar(32));
\copy vchartmp from 'data/char.data'
SET enable_seqscan=on;
SELECT count(*) FROM vchartmp WHERE a < '31b0'::varchar(32);
count
-------
121
(1 row)
SELECT count(*) FROM vchartmp WHERE a <= '31b0'::varchar(32);
count
-------
122
(1 row)
SELECT count(*) FROM vchartmp WHERE a = '31b0'::varchar(32);
count
-------
1
(1 row)
SELECT count(*) FROM vchartmp WHERE a >= '31b0'::varchar(32);
count
-------
401
(1 row)
SELECT count(*) FROM vchartmp WHERE a > '31b0'::varchar(32);
count
-------
400
(1 row)
CREATE INDEX vcharidx ON vchartmp USING GIST ( text(a) );
SET enable_seqscan=off;
SELECT count(*) FROM vchartmp WHERE a < '31b0'::varchar(32);
count
-------
121
(1 row)
SELECT count(*) FROM vchartmp WHERE a <= '31b0'::varchar(32);
count
-------
122
(1 row)
SELECT count(*) FROM vchartmp WHERE a = '31b0'::varchar(32);
count
-------
1
(1 row)
SELECT count(*) FROM vchartmp WHERE a >= '31b0'::varchar(32);
count
-------
401
(1 row)
SELECT count(*) FROM vchartmp WHERE a > '31b0'::varchar(32);
count
-------
400
(1 row)