Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

To support PostgreSQL v15 #131

Merged
merged 18 commits into from
Jan 16, 2023
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
strategy:
matrix:
PGVERSION: # TODO: build with master branch
# - "15"
mikecaat marked this conversation as resolved.
Show resolved Hide resolved
- "14"
- "13"
- "12"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
strategy:
matrix:
PGVERSION: # TODO: build with master branch
- "15beta2"
mikecaat marked this conversation as resolved.
Show resolved Hide resolved
- "14.0"
- "13.4"
- "12.8"
Expand Down
25 changes: 18 additions & 7 deletions bin/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ sql/init-13.sql:
cp sql/init-extension-v2.sql sql/init-13.sql
sql/init-14.sql:
cp sql/init-extension-v2.sql sql/init-14.sql
sql/init-15.sql:
cp sql/init-extension-v3.sql sql/init-15.sql

sql/load_bin.sql: sql/load_bin-$(MAJORVERSION).sql
cp sql/load_bin-$(MAJORVERSION).sql sql/load_bin.sql
Expand All @@ -85,6 +87,8 @@ sql/load_bin-13.sql:
cp sql/load_bin-v2.sql sql/load_bin-13.sql
sql/load_bin-14.sql:
cp sql/load_bin-v2.sql sql/load_bin-14.sql
sql/load_bin-15.sql:
cp sql/load_bin-v2.sql sql/load_bin-15.sql

sql/load_csv.sql: sql/load_csv-$(MAJORVERSION).sql
cp sql/load_csv-$(MAJORVERSION).sql sql/load_csv.sql
Expand All @@ -106,6 +110,8 @@ sql/load_csv-13.sql:
cp sql/load_csv-v2.sql sql/load_csv-13.sql
sql/load_csv-14.sql:
cp sql/load_csv-v2.sql sql/load_csv-14.sql
sql/load_csv-15.sql:
cp sql/load_csv-v3.sql sql/load_csv-15.sql

sql/load_filter.sql: sql/load_filter-$(MAJORVERSION).sql
cp sql/load_filter-$(MAJORVERSION).sql sql/load_filter.sql
Expand All @@ -127,6 +133,8 @@ sql/load_filter-13.sql:
cp sql/load_filter-v3.sql sql/load_filter-13.sql
sql/load_filter-14.sql:
cp sql/load_filter-v3.sql sql/load_filter-14.sql
sql/load_filter-15.sql:
cp sql/load_filter-v3.sql sql/load_filter-15.sql

sql/load_function.sql: sql/load_function-$(MAJORVERSION).sql
cp sql/load_function-$(MAJORVERSION).sql sql/load_function.sql
Expand All @@ -148,6 +156,8 @@ sql/load_function-13.sql:
cp sql/load_function-v3.sql sql/load_function-13.sql
sql/load_function-14.sql:
cp sql/load_function-v3.sql sql/load_function-14.sql
sql/load_function-15.sql:
cp sql/load_function-v3.sql sql/load_function-15.sql

sql/write_bin.sql: sql/write_bin-$(MAJORVERSION).sql
cp sql/write_bin-$(MAJORVERSION).sql sql/write_bin.sql
Expand All @@ -169,18 +179,19 @@ sql/write_bin-13.sql:
cp sql/write_bin-v2.sql sql/write_bin-13.sql
sql/write_bin-14.sql:
cp sql/write_bin-v2.sql sql/write_bin-14.sql

sql/write_bin-15.sql:
cp sql/write_bin-v2.sql sql/write_bin-15.sql

.PHONY: subclean
clean: subclean

subclean:
rm -f sql/init.sql sql/init-{9.3,9.4,9.5,9.6,10,11,12,13,14}.sql
rm -f sql/load_bin.sql sql/load_bin-{9.3,9.4,9.5,9.6,10,11,12,13,14}.sql
rm -f sql/load_csv.sql sql/load_csv-{9.3,9.4,9.5,9.6,10,11,12,13,14}.sql
rm -f sql/load_filter.sql sql/load_filter-{9.3,9.4,9.5,9.6,10,11,12,13,14}.sql
rm -f sql/load_function.sql sql/load_function-{9.3,9.4,9.5,9.6,10,11,12,13,14}.sql
rm -f sql/write_bin.sql sql/write_bin-{9.3,9.4,9.5,9.6,10,11,12,13,14}.sql
rm -f sql/init.sql sql/init-{9.3,9.4,9.5,9.6,10,11,12,13,14,15}.sql
rm -f sql/load_bin.sql sql/load_bin-{9.3,9.4,9.5,9.6,10,11,12,13,14,15}.sql
rm -f sql/load_csv.sql sql/load_csv-{9.3,9.4,9.5,9.6,10,11,12,13,14,15}.sql
rm -f sql/load_filter.sql sql/load_filter-{9.3,9.4,9.5,9.6,10,11,12,13,14,15}.sql
rm -f sql/load_function.sql sql/load_function-{9.3,9.4,9.5,9.6,10,11,12,13,14,15}.sql
rm -f sql/write_bin.sql sql/write_bin-{9.3,9.4,9.5,9.6,10,11,12,13,14,15}.sql

installcheck: sql/init.sql sql/load_bin.sql sql/load_csv.sql sql/load_function.sql sql/load_filter.sql sql/write_bin.sql

Expand Down
5 changes: 5 additions & 0 deletions bin/data/csv8.ctl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
TABLE = unique_tbl1
WRITER=DIRECT
TYPE = CSV
ON_DUPLICATE_KEEP = NEW
TRUNCATE = TRUE
5 changes: 5 additions & 0 deletions bin/data/csv9.ctl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
TABLE = unique_tbl2
WRITER=DIRECT
TYPE = CSV
ON_DUPLICATE_KEEP = NEW
TRUNCATE = TRUE
7 changes: 7 additions & 0 deletions bin/data/data9.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
1,"one"
2,"two"
3,"three"
4,"one"
5,"five"
,"six"
,"seven"
136 changes: 136 additions & 0 deletions bin/expected/init_3.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
SET client_min_messages = warning;
\set ECHO none
RESET client_min_messages;
CREATE TABLE customer (
c_id int4 NOT NULL,
c_d_id int2 NOT NULL,
c_w_id int4 NOT NULL,
c_first varchar(16) NOT NULL,
c_middle char(2) NOT NULL,
c_last varchar(16) NOT NULL,
c_street_1 varchar(20) NOT NULL,
c_street_2 varchar(20) NOT NULL,
c_city varchar(20) NOT NULL,
c_state char(2) NOT NULL,
c_zip char(9) NOT NULL,
c_phone char(16) NOT NULL,
c_since timestamp NOT NULL,
c_credit char(2) NOT NULL,
c_credit_lim numeric(16,4) NOT NULL,
c_discount numeric(16,4) NOT NULL,
c_balance numeric(16,4) NOT NULL,
c_ytd_payment numeric(16,4) NOT NULL,
c_payment_cnt float4 NOT NULL,
c_delivery_cnt float8 NOT NULL,
c_data varchar(500) NOT NULL
) WITH (fillfactor=20);
ALTER TABLE customer ADD PRIMARY KEY (c_id, c_w_id, c_d_id);
CREATE INDEX idx_btree ON customer USING btree (c_d_id, c_last);
CREATE INDEX idx_btree_fn ON customer USING btree ((abs(c_w_id) + c_d_id));
CREATE INDEX idx_hash ON customer USING hash (c_d_id);
CREATE INDEX idx_hash_fn ON customer USING hash ((abs(c_w_id) + c_d_id));
---------------------------------------------------------------------------
-- load_csv test csv9
mikecaat marked this conversation as resolved.
Show resolved Hide resolved
CREATE TABLE unique_tbl1 (i int, t text);
CREATE UNIQUE INDEX unique_idx1 ON unique_tbl1 (i) NULLS DISTINCT;
CREATE TABLE unique_tbl2 (i int, t text);
CREATE UNIQUE INDEX unique_idx2 ON unique_tbl2 (i) NULLS NOT DISTINCT;
---------------------------------------------------------------------------
-- load_check test
CREATE TABLE master (
id int PRIMARY KEY,
str text
);
CREATE TABLE target (
id int PRIMARY KEY,
str text CHECK(length(str) < 10) NOT NULL UNIQUE,
master int REFERENCES master (id)
);
CREATE TABLE target_like (
id int,
str text,
master int
);
CREATE FUNCTION f_t_target() RETURNS trigger AS
$$
BEGIN
INSERT INTO target_like VALUES(new.*);
RETURN NULL;
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER t_target
AFTER INSERT
ON target
FOR EACH ROW
EXECUTE PROCEDURE f_t_target();
INSERT INTO master VALUES(1, 'aaa');
---------------------------------------------------------------------------
-- load_filter test
--------------------------------
-- error case
--------------------------------
-- VARIACIC function
CREATE FUNCTION variadic_f(int, VARIADIC text[]) RETURNS target AS
$$
SELECT * FROM target;
$$ LANGUAGE SQL;
-- function overloading
CREATE FUNCTION overload_f() RETURNS target AS
$$
SELECT * FROM target;
$$ LANGUAGE SQL;
CREATE FUNCTION overload_f(int4) RETURNS target AS
$$
SELECT * FROM target;
$$ LANGUAGE SQL;
-- returns record using OUT paramator
CREATE FUNCTION outarg_f(OUT int4, OUT int4, OUT int4) RETURNS record AS
$$
SELECT 1, 2, 3;
$$ LANGUAGE SQL;
-- returns setof function
CREATE FUNCTION setof_f() RETURNS SETOF target AS
$$
SELECT * FROM target;
$$ LANGUAGE SQL;
-- returns data type mismatch
CREATE FUNCTION type_mismatch_f() RETURNS master AS
$$
SELECT * FROM master LIMIT 1;
$$ LANGUAGE SQL;
-- returns record type mismatch
CREATE FUNCTION rec_mismatch_f() RETURNS record AS
$$
SELECT 1, 'rec_mismatch_f', 1;
$$ LANGUAGE SQL;
--------------------------------
-- normal case
--------------------------------
-- no argument function
CREATE FUNCTION no_arg_f() RETURNS target AS
$$
SELECT 1, 'call no_arg_f'::text, 3;
$$ LANGUAGE SQL;
---------------------------------------------------------------------------
-- load_encoding test
CREATE DATABASE contrib_regression_sqlascii TEMPLATE template0 ENCODING 'sql_ascii';
ALTER DATABASE contrib_regression_sqlascii SET lc_messages TO 'C';
ALTER DATABASE contrib_regression_sqlascii SET lc_monetary TO 'C';
ALTER DATABASE contrib_regression_sqlascii SET lc_numeric TO 'C';
ALTER DATABASE contrib_regression_sqlascii SET lc_time TO 'C';
ALTER DATABASE contrib_regression_sqlascii SET timezone_abbreviations TO 'Default';
CREATE DATABASE contrib_regression_utf8 TEMPLATE template0 ENCODING 'utf8';
ALTER DATABASE contrib_regression_utf8 SET lc_messages TO 'C';
ALTER DATABASE contrib_regression_utf8 SET lc_monetary TO 'C';
ALTER DATABASE contrib_regression_utf8 SET lc_numeric TO 'C';
ALTER DATABASE contrib_regression_utf8 SET lc_time TO 'C';
ALTER DATABASE contrib_regression_utf8 SET timezone_abbreviations TO 'Default';
\connect contrib_regression_sqlascii
CREATE TABLE target (id int, str text, master int);
CREATE INDEX i_target ON target (id);
\set ECHO none
\connect contrib_regression_utf8
CREATE TABLE target (id int, str text, master int);
CREATE INDEX i_target ON target (id);
\set ECHO none
\! rm -f results/*.log results/*.prs results/*.dup results/*.bin results/*.ctl
Loading