Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
90a391c6
Commit
90a391c6
authored
Aug 03, 2010
by
Robert Haas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Regression tests for new btree_gist "not equals" support.
Jeff Davis, with minor adjustments by me.
parent
34915209
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
2 deletions
+74
-2
contrib/btree_gist/Makefile
contrib/btree_gist/Makefile
+2
-2
contrib/btree_gist/expected/not_equal.out
contrib/btree_gist/expected/not_equal.out
+40
-0
contrib/btree_gist/sql/not_equal.sql
contrib/btree_gist/sql/not_equal.sql
+32
-0
No files found.
contrib/btree_gist/Makefile
View file @
90a391c6
# $PostgreSQL: pgsql/contrib/btree_gist/Makefile,v 1.1
2 2007/11/10 23:59:50 momjian
Exp $
# $PostgreSQL: pgsql/contrib/btree_gist/Makefile,v 1.1
3 2010/08/03 19:53:19 rhaas
Exp $
MODULE_big
=
btree_gist
MODULE_big
=
btree_gist
...
@@ -11,7 +11,7 @@ DATA_built = btree_gist.sql
...
@@ -11,7 +11,7 @@ DATA_built = btree_gist.sql
DATA
=
uninstall_btree_gist.sql
DATA
=
uninstall_btree_gist.sql
REGRESS
=
init int2 int4 int8 float4 float8 cash oid timestamp timestamptz
time
timetz
\
REGRESS
=
init int2 int4 int8 float4 float8 cash oid timestamp timestamptz
time
timetz
\
date
interval macaddr inet cidr text varchar char bytea bit varbit numeric
date
interval macaddr inet cidr text varchar char bytea bit varbit numeric
not_equal
ifdef
USE_PGXS
ifdef
USE_PGXS
PG_CONFIG
=
pg_config
PG_CONFIG
=
pg_config
...
...
contrib/btree_gist/expected/not_equal.out
0 → 100644
View file @
90a391c6
SET enable_seqscan to false;
-- test search for "not equals"
CREATE TABLE test_ne (
a TIMESTAMP,
b NUMERIC
);
CREATE INDEX test_ne_idx ON test_ne USING gist (a, b);
INSERT INTO test_ne SELECT '2009-01-01', 10.7 FROM generate_series(1,1000);
INSERT INTO test_ne VALUES('2007-02-03', -91.3);
INSERT INTO test_ne VALUES('2011-09-01', 43.7);
INSERT INTO test_ne SELECT '2009-01-01', 10.7 FROM generate_series(1,1000);
EXPLAIN (COSTS OFF) SELECT * FROM test_ne WHERE a <> '2009-01-01' AND b <> 10.7;
QUERY PLAN
------------------------------------------------------------------------------------------------------
Bitmap Heap Scan on test_ne
Recheck Cond: ((a <> 'Thu Jan 01 00:00:00 2009'::timestamp without time zone) AND (b <> 10.7))
-> Bitmap Index Scan on test_ne_idx
Index Cond: ((a <> 'Thu Jan 01 00:00:00 2009'::timestamp without time zone) AND (b <> 10.7))
(4 rows)
SELECT * FROM test_ne WHERE a <> '2009-01-01' AND b <> 10.7;
a | b
--------------------------+-------
Sat Feb 03 00:00:00 2007 | -91.3
Thu Sep 01 00:00:00 2011 | 43.7
(2 rows)
-- test search for "not equals" using an exclusion constraint
CREATE TABLE zoo (
cage INTEGER,
animal TEXT,
EXCLUDE USING gist (cage WITH =, animal WITH <>)
);
NOTICE: CREATE TABLE / EXCLUDE will create implicit index "zoo_cage_animal_excl" for table "zoo"
INSERT INTO zoo VALUES(123, 'zebra');
INSERT INTO zoo VALUES(123, 'zebra');
INSERT INTO zoo VALUES(123, 'lion');
ERROR: conflicting key value violates exclusion constraint "zoo_cage_animal_excl"
DETAIL: Key (cage, animal)=(123, lion) conflicts with existing key (cage, animal)=(123, zebra).
INSERT INTO zoo VALUES(124, 'lion');
contrib/btree_gist/sql/not_equal.sql
0 → 100644
View file @
90a391c6
SET
enable_seqscan
to
false
;
-- test search for "not equals"
CREATE
TABLE
test_ne
(
a
TIMESTAMP
,
b
NUMERIC
);
CREATE
INDEX
test_ne_idx
ON
test_ne
USING
gist
(
a
,
b
);
INSERT
INTO
test_ne
SELECT
'2009-01-01'
,
10
.
7
FROM
generate_series
(
1
,
1000
);
INSERT
INTO
test_ne
VALUES
(
'2007-02-03'
,
-
91
.
3
);
INSERT
INTO
test_ne
VALUES
(
'2011-09-01'
,
43
.
7
);
INSERT
INTO
test_ne
SELECT
'2009-01-01'
,
10
.
7
FROM
generate_series
(
1
,
1000
);
EXPLAIN
(
COSTS
OFF
)
SELECT
*
FROM
test_ne
WHERE
a
<>
'2009-01-01'
AND
b
<>
10
.
7
;
SELECT
*
FROM
test_ne
WHERE
a
<>
'2009-01-01'
AND
b
<>
10
.
7
;
-- test search for "not equals" using an exclusion constraint
CREATE
TABLE
zoo
(
cage
INTEGER
,
animal
TEXT
,
EXCLUDE
USING
gist
(
cage
WITH
=
,
animal
WITH
<>
)
);
INSERT
INTO
zoo
VALUES
(
123
,
'zebra'
);
INSERT
INTO
zoo
VALUES
(
123
,
'zebra'
);
INSERT
INTO
zoo
VALUES
(
123
,
'lion'
);
INSERT
INTO
zoo
VALUES
(
124
,
'lion'
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment