Skip to content

Commit

Permalink
a regression test for issue #226
Browse files Browse the repository at this point in the history
  • Loading branch information
eeeebbbbrrrr committed Sep 18, 2017
1 parent f3448b1 commit 13568b8
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
22 changes: 22 additions & 0 deletions postgres/src/test/expected/issue-226.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
CREATE TABLE issue226 (
id SERIAL8 NOT NULL PRIMARY KEY
);
CREATE INDEX idxissue226
ON issue226 USING zombodb (zdb('issue226', ctid), zdb(issue226)) WITH (url='localhost:9200/');
INSERT INTO issue226 (id) VALUES (default);
BEGIN;
INSERT INTO issue226 (id) VALUES (default);
ABORT;
VACUUM issue226;
SELECT
(SELECT count(*) FROM issue226) AS issue226,
(SELECT count(*) FROM issue226 WHERE zdb('issue226', ctid) ==> 'id:*') AS issue226_all,
(SELECT count(*) FROM issue226 WHERE zdb('issue226', ctid) ==> 'id:null') AS issue226_null,
(SELECT zdb_estimate_count('issue226', 'id:*')) AS issue226_estimate_all,
(SELECT zdb_estimate_count('issue226', 'id:null')) AS issue226_estimate_null;
issue226 | issue226_all | issue226_null | issue226_estimate_all | issue226_estimate_null
----------+--------------+---------------+-----------------------+------------------------
1 | 1 | 0 | 1 | 0
(1 row)

DROP TABLE issue226 CASCADE;
22 changes: 22 additions & 0 deletions postgres/src/test/sql/issue-226.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
CREATE TABLE issue226 (
id SERIAL8 NOT NULL PRIMARY KEY
);
CREATE INDEX idxissue226
ON issue226 USING zombodb (zdb('issue226', ctid), zdb(issue226)) WITH (url='localhost:9200/');

INSERT INTO issue226 (id) VALUES (default);

BEGIN;
INSERT INTO issue226 (id) VALUES (default);
ABORT;

VACUUM issue226;

SELECT
(SELECT count(*) FROM issue226) AS issue226,
(SELECT count(*) FROM issue226 WHERE zdb('issue226', ctid) ==> 'id:*') AS issue226_all,
(SELECT count(*) FROM issue226 WHERE zdb('issue226', ctid) ==> 'id:null') AS issue226_null,
(SELECT zdb_estimate_count('issue226', 'id:*')) AS issue226_estimate_all,
(SELECT zdb_estimate_count('issue226', 'id:null')) AS issue226_estimate_null;

DROP TABLE issue226 CASCADE;
3 changes: 2 additions & 1 deletion postgres/src/test/tests.list
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,5 @@ issue-214
issue-218
issue-219
issue-210
issue-224
issue-224
issue-226

0 comments on commit 13568b8

Please sign in to comment.