-
Notifications
You must be signed in to change notification settings - Fork 891
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Since multi-node is not supported on PG16, add errors to multi-node functions when run on this PostgreSQL version.
- Loading branch information
1 parent
8f3bb0b
commit a409065
Showing
125 changed files
with
41,010 additions
and
13,542 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
-- This file and its contents are licensed under the Apache License 2.0. | ||
-- Please see the included NOTICE for copyright information and | ||
-- LICENSE-APACHE for a copy of the license. | ||
-- table 1 | ||
CREATE TABLE "hitest1"(key real, val varchar(40)); | ||
-- insertions | ||
INSERT INTO "hitest1" VALUES(0, 'hi'); | ||
INSERT INTO "hitest1" VALUES(1, 'sup'); | ||
INSERT INTO "hitest1" VALUES(2, 'hello'); | ||
INSERT INTO "hitest1" VALUES(3, 'yo'); | ||
INSERT INTO "hitest1" VALUES(4, 'howdy'); | ||
INSERT INTO "hitest1" VALUES(5, 'hola'); | ||
INSERT INTO "hitest1" VALUES(6, 'ya'); | ||
INSERT INTO "hitest1" VALUES(1, 'sup'); | ||
INSERT INTO "hitest1" VALUES(2, 'hello'); | ||
INSERT INTO "hitest1" VALUES(1, 'sup'); | ||
-- table 2 | ||
CREATE TABLE "hitest2"(name varchar(30), score integer, qualify boolean); | ||
-- insertions | ||
INSERT INTO "hitest2" VALUES('Tom', 6, TRUE); | ||
INSERT INTO "hitest2" VALUES('Mary', 4, FALSE); | ||
INSERT INTO "hitest2" VALUES('Jaq', 3, FALSE); | ||
INSERT INTO "hitest2" VALUES('Jane', 10, TRUE); | ||
-- standard 2 bucket | ||
SELECT histogram(key, 0, 9, 2) FROM hitest1; | ||
histogram | ||
----------- | ||
{0,8,2,0} | ||
(1 row) | ||
|
||
-- standard multi-bucket | ||
SELECT histogram(key, 0, 9, 5) FROM hitest1; | ||
histogram | ||
----------------- | ||
{0,4,3,2,1,0,0} | ||
(1 row) | ||
|
||
-- standard 3 bucket | ||
SELECT val, histogram(key, 0, 7, 3) FROM hitest1 GROUP BY val ORDER BY val; | ||
val | histogram | ||
-------+------------- | ||
hello | {0,2,0,0,0} | ||
hi | {0,1,0,0,0} | ||
hola | {0,0,0,1,0} | ||
howdy | {0,0,1,0,0} | ||
sup | {0,3,0,0,0} | ||
ya | {0,0,0,1,0} | ||
yo | {0,0,1,0,0} | ||
(7 rows) | ||
|
||
-- standard element beneath lb | ||
SELECT histogram(key, 1, 7, 3) FROM hitest1; | ||
histogram | ||
------------- | ||
{1,5,2,2,0} | ||
(1 row) | ||
|
||
-- standard element above ub | ||
SELECT histogram(key, 0, 3, 3) FROM hitest1; | ||
histogram | ||
------------- | ||
{0,1,3,2,4} | ||
(1 row) | ||
|
||
-- standard element beneath and above lb and ub, respectively | ||
SELECT histogram(key, 1, 3, 2) FROM hitest1; | ||
histogram | ||
----------- | ||
{1,3,2,4} | ||
(1 row) | ||
|
||
-- standard 1 bucket | ||
SELECT histogram(key, 1, 3, 1) FROM hitest1; | ||
histogram | ||
----------- | ||
{1,5,4} | ||
(1 row) | ||
|
||
-- standard 2 bucket | ||
SELECT qualify, histogram(score, 0, 10, 2) FROM hitest2 GROUP BY qualify ORDER BY qualify; | ||
qualify | histogram | ||
---------+----------- | ||
f | {0,2,0,0} | ||
t | {0,0,1,1} | ||
(2 rows) | ||
|
||
-- standard multi-bucket | ||
SELECT qualify, histogram(score, 0, 10, 5) FROM hitest2 GROUP BY qualify ORDER BY qualify; | ||
qualify | histogram | ||
---------+----------------- | ||
f | {0,0,1,1,0,0,0} | ||
t | {0,0,0,0,1,0,1} | ||
(2 rows) | ||
|
||
-- check number of buckets is constant | ||
\set ON_ERROR_STOP 0 | ||
select histogram(i,10,90,case when i=1 then 1 else 1000000 end) FROM generate_series(1,100) i; | ||
ERROR: number of buckets must not change between calls | ||
\set ON_ERROR_STOP 1 | ||
CREATE TABLE weather ( | ||
time TIMESTAMPTZ NOT NULL, | ||
city TEXT, | ||
temperature FLOAT, | ||
PRIMARY KEY(time, city) | ||
); | ||
-- There is a bug in width_bucket() causing a NaN as a result, so we | ||
-- check that it is not causing a crash in histogram(). | ||
SELECT * FROM create_hypertable('weather', 'time', 'city', 3); | ||
hypertable_id | schema_name | table_name | created | ||
---------------+-------------+------------+--------- | ||
1 | public | weather | t | ||
(1 row) | ||
|
||
INSERT INTO weather VALUES | ||
('2023-02-10 09:16:51.133584+00','city1',10.4), | ||
('2023-02-10 11:16:51.611618+00','city1',10.3), | ||
('2023-02-10 06:58:59.999999+00','city1',10.3), | ||
('2023-02-10 01:58:59.999999+00','city1',10.3), | ||
('2023-02-09 01:58:59.999999+00','city1',10.3), | ||
('2023-02-10 08:58:59.999999+00','city1',10.3), | ||
('2023-03-23 06:12:02.73765+00 ','city1', 9.7), | ||
('2023-03-23 06:12:06.990998+00','city1',11.7); | ||
-- This will currently generate an error on PG15 and prior versions | ||
\set ON_ERROR_STOP 0 | ||
SELECT histogram(temperature, -1.79769e+308, 1.79769e+308,10) FROM weather GROUP BY city; | ||
ERROR: index -2147483648 from "width_bucket" out of range | ||
\set ON_ERROR_STOP 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
-- This file and its contents are licensed under the Apache License 2.0. | ||
-- Please see the included NOTICE for copyright information and | ||
-- LICENSE-APACHE for a copy of the license. | ||
-- table 1 | ||
CREATE TABLE "hitest1"(key real, val varchar(40)); | ||
-- insertions | ||
INSERT INTO "hitest1" VALUES(0, 'hi'); | ||
INSERT INTO "hitest1" VALUES(1, 'sup'); | ||
INSERT INTO "hitest1" VALUES(2, 'hello'); | ||
INSERT INTO "hitest1" VALUES(3, 'yo'); | ||
INSERT INTO "hitest1" VALUES(4, 'howdy'); | ||
INSERT INTO "hitest1" VALUES(5, 'hola'); | ||
INSERT INTO "hitest1" VALUES(6, 'ya'); | ||
INSERT INTO "hitest1" VALUES(1, 'sup'); | ||
INSERT INTO "hitest1" VALUES(2, 'hello'); | ||
INSERT INTO "hitest1" VALUES(1, 'sup'); | ||
-- table 2 | ||
CREATE TABLE "hitest2"(name varchar(30), score integer, qualify boolean); | ||
-- insertions | ||
INSERT INTO "hitest2" VALUES('Tom', 6, TRUE); | ||
INSERT INTO "hitest2" VALUES('Mary', 4, FALSE); | ||
INSERT INTO "hitest2" VALUES('Jaq', 3, FALSE); | ||
INSERT INTO "hitest2" VALUES('Jane', 10, TRUE); | ||
-- standard 2 bucket | ||
SELECT histogram(key, 0, 9, 2) FROM hitest1; | ||
histogram | ||
----------- | ||
{0,8,2,0} | ||
(1 row) | ||
|
||
-- standard multi-bucket | ||
SELECT histogram(key, 0, 9, 5) FROM hitest1; | ||
histogram | ||
----------------- | ||
{0,4,3,2,1,0,0} | ||
(1 row) | ||
|
||
-- standard 3 bucket | ||
SELECT val, histogram(key, 0, 7, 3) FROM hitest1 GROUP BY val ORDER BY val; | ||
val | histogram | ||
-------+------------- | ||
hello | {0,2,0,0,0} | ||
hi | {0,1,0,0,0} | ||
hola | {0,0,0,1,0} | ||
howdy | {0,0,1,0,0} | ||
sup | {0,3,0,0,0} | ||
ya | {0,0,0,1,0} | ||
yo | {0,0,1,0,0} | ||
(7 rows) | ||
|
||
-- standard element beneath lb | ||
SELECT histogram(key, 1, 7, 3) FROM hitest1; | ||
histogram | ||
------------- | ||
{1,5,2,2,0} | ||
(1 row) | ||
|
||
-- standard element above ub | ||
SELECT histogram(key, 0, 3, 3) FROM hitest1; | ||
histogram | ||
------------- | ||
{0,1,3,2,4} | ||
(1 row) | ||
|
||
-- standard element beneath and above lb and ub, respectively | ||
SELECT histogram(key, 1, 3, 2) FROM hitest1; | ||
histogram | ||
----------- | ||
{1,3,2,4} | ||
(1 row) | ||
|
||
-- standard 1 bucket | ||
SELECT histogram(key, 1, 3, 1) FROM hitest1; | ||
histogram | ||
----------- | ||
{1,5,4} | ||
(1 row) | ||
|
||
-- standard 2 bucket | ||
SELECT qualify, histogram(score, 0, 10, 2) FROM hitest2 GROUP BY qualify ORDER BY qualify; | ||
qualify | histogram | ||
---------+----------- | ||
f | {0,2,0,0} | ||
t | {0,0,1,1} | ||
(2 rows) | ||
|
||
-- standard multi-bucket | ||
SELECT qualify, histogram(score, 0, 10, 5) FROM hitest2 GROUP BY qualify ORDER BY qualify; | ||
qualify | histogram | ||
---------+----------------- | ||
f | {0,0,1,1,0,0,0} | ||
t | {0,0,0,0,1,0,1} | ||
(2 rows) | ||
|
||
-- check number of buckets is constant | ||
\set ON_ERROR_STOP 0 | ||
select histogram(i,10,90,case when i=1 then 1 else 1000000 end) FROM generate_series(1,100) i; | ||
ERROR: number of buckets must not change between calls | ||
\set ON_ERROR_STOP 1 | ||
CREATE TABLE weather ( | ||
time TIMESTAMPTZ NOT NULL, | ||
city TEXT, | ||
temperature FLOAT, | ||
PRIMARY KEY(time, city) | ||
); | ||
-- There is a bug in width_bucket() causing a NaN as a result, so we | ||
-- check that it is not causing a crash in histogram(). | ||
SELECT * FROM create_hypertable('weather', 'time', 'city', 3); | ||
hypertable_id | schema_name | table_name | created | ||
---------------+-------------+------------+--------- | ||
1 | public | weather | t | ||
(1 row) | ||
|
||
INSERT INTO weather VALUES | ||
('2023-02-10 09:16:51.133584+00','city1',10.4), | ||
('2023-02-10 11:16:51.611618+00','city1',10.3), | ||
('2023-02-10 06:58:59.999999+00','city1',10.3), | ||
('2023-02-10 01:58:59.999999+00','city1',10.3), | ||
('2023-02-09 01:58:59.999999+00','city1',10.3), | ||
('2023-02-10 08:58:59.999999+00','city1',10.3), | ||
('2023-03-23 06:12:02.73765+00 ','city1', 9.7), | ||
('2023-03-23 06:12:06.990998+00','city1',11.7); | ||
-- This will currently generate an error on PG15 and prior versions | ||
\set ON_ERROR_STOP 0 | ||
SELECT histogram(temperature, -1.79769e+308, 1.79769e+308,10) FROM weather GROUP BY city; | ||
ERROR: index -2147483648 from "width_bucket" out of range | ||
\set ON_ERROR_STOP 1 |
Oops, something went wrong.