-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for PostgreSQL 17 and EDB Postgres Advanced Server 17.
Code changes involve adjusting calls to some server-side functions due to their signature changes. FDW-681, Suraj Kharage, reviewed by Sravan Velagandula.
- Loading branch information
1 parent
dcfd737
commit 981970c
Showing
5 changed files
with
2,256 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,275 @@ | ||
\set MYSQL_HOST `echo \'"$MYSQL_HOST"\'` | ||
\set MYSQL_PORT `echo \'"$MYSQL_PORT"\'` | ||
\set MYSQL_USER_NAME `echo \'"$MYSQL_USER_NAME"\'` | ||
\set MYSQL_PASS `echo \'"$MYSQL_PWD"\'` | ||
-- Before running this file User must create database mysql_fdw_regress on | ||
-- mysql with all permission for MYSQL_USER_NAME user with MYSQL_PWD password | ||
-- and ran mysql_init.sh file to create tables. | ||
\c contrib_regression | ||
CREATE EXTENSION IF NOT EXISTS mysql_fdw; | ||
CREATE SERVER mysql_svr FOREIGN DATA WRAPPER mysql_fdw | ||
OPTIONS (host :MYSQL_HOST, port :MYSQL_PORT); | ||
CREATE USER MAPPING FOR public SERVER mysql_svr | ||
OPTIONS (username :MYSQL_USER_NAME, password :MYSQL_PASS); | ||
-- Create foreign table | ||
CREATE FOREIGN TABLE f_test_tbl2 (c1 INTEGER, c2 VARCHAR(14), c3 VARCHAR(13)) | ||
SERVER mysql_svr OPTIONS (dbname 'mysql_fdw_regress', table_name 'test_tbl2'); | ||
INSERT INTO f_test_tbl2 VALUES(10, 'DEVELOPMENT', 'PUNE'); | ||
INSERT INTO f_test_tbl2 VALUES(20, 'ADMINISTRATION', 'BANGLORE'); | ||
INSERT INTO f_test_tbl2 VALUES(30, 'SALES', 'MUMBAI'); | ||
INSERT INTO f_test_tbl2 VALUES(40, 'HR', 'NAGPUR'); | ||
INSERT INTO f_test_tbl2 VALUES(50, 'IT', 'PUNE'); | ||
INSERT INTO f_test_tbl2 VALUES(60, 'DB SERVER', 'PUNE'); | ||
SELECT * FROM f_test_tbl2 ORDER BY 1; | ||
c1 | c2 | c3 | ||
----+----------------+---------- | ||
10 | DEVELOPMENT | PUNE | ||
20 | ADMINISTRATION | BANGLORE | ||
30 | SALES | MUMBAI | ||
40 | HR | NAGPUR | ||
50 | IT | PUNE | ||
60 | DB SERVER | PUNE | ||
(6 rows) | ||
|
||
-- LIMIT/OFFSET pushdown. | ||
-- Limit with Offset should get pushdown. | ||
EXPLAIN (VERBOSE, COSTS FALSE) | ||
SELECT * FROM f_test_tbl2 ORDER BY 1 LIMIT 3 OFFSET 2; | ||
QUERY PLAN | ||
------------------------------------------------------------------------------------------------------------------------------- | ||
Foreign Scan on public.f_test_tbl2 | ||
Output: c1, c2, c3 | ||
Remote query: SELECT `c1`, `c2`, `c3` FROM `mysql_fdw_regress`.`test_tbl2` ORDER BY `c1` IS NULL, `c1` ASC LIMIT 3 OFFSET 2 | ||
(3 rows) | ||
|
||
SELECT * FROM f_test_tbl2 ORDER BY 1 LIMIT 3 OFFSET 2; | ||
c1 | c2 | c3 | ||
----+-------+-------- | ||
30 | SALES | MUMBAI | ||
40 | HR | NAGPUR | ||
50 | IT | PUNE | ||
(3 rows) | ||
|
||
-- Only Limit should get pushdown. | ||
EXPLAIN (VERBOSE, COSTS FALSE) | ||
SELECT * FROM f_test_tbl2 ORDER BY 1 LIMIT 3; | ||
QUERY PLAN | ||
---------------------------------------------------------------------------------------------------------------------- | ||
Foreign Scan on public.f_test_tbl2 | ||
Output: c1, c2, c3 | ||
Remote query: SELECT `c1`, `c2`, `c3` FROM `mysql_fdw_regress`.`test_tbl2` ORDER BY `c1` IS NULL, `c1` ASC LIMIT 3 | ||
(3 rows) | ||
|
||
SELECT * FROM f_test_tbl2 ORDER BY 1 LIMIT 3; | ||
c1 | c2 | c3 | ||
----+----------------+---------- | ||
10 | DEVELOPMENT | PUNE | ||
20 | ADMINISTRATION | BANGLORE | ||
30 | SALES | MUMBAI | ||
(3 rows) | ||
|
||
-- Expression in Limit clause. | ||
EXPLAIN (VERBOSE, COSTS FALSE) | ||
SELECT * FROM f_test_tbl2 ORDER BY 1 LIMIT round(3.2) OFFSET 2; | ||
QUERY PLAN | ||
------------------------------------------------------------------------------------------------------------------------------- | ||
Foreign Scan on public.f_test_tbl2 | ||
Output: c1, c2, c3 | ||
Remote query: SELECT `c1`, `c2`, `c3` FROM `mysql_fdw_regress`.`test_tbl2` ORDER BY `c1` IS NULL, `c1` ASC LIMIT 3 OFFSET 2 | ||
(3 rows) | ||
|
||
SELECT * FROM f_test_tbl2 ORDER BY 1 LIMIT round(3.2) OFFSET 2; | ||
c1 | c2 | c3 | ||
----+-------+-------- | ||
30 | SALES | MUMBAI | ||
40 | HR | NAGPUR | ||
50 | IT | PUNE | ||
(3 rows) | ||
|
||
-- Only Offset without Limit should not get pushdown. | ||
EXPLAIN (VERBOSE, COSTS FALSE) | ||
SELECT * FROM f_test_tbl2 ORDER BY 1 OFFSET 2; | ||
QUERY PLAN | ||
-------------------------------------------------------------------------------------------------------------------- | ||
Limit | ||
Output: c1, c2, c3 | ||
-> Foreign Scan on public.f_test_tbl2 | ||
Output: c1, c2, c3 | ||
Remote query: SELECT `c1`, `c2`, `c3` FROM `mysql_fdw_regress`.`test_tbl2` ORDER BY `c1` IS NULL, `c1` ASC | ||
(5 rows) | ||
|
||
SELECT * FROM f_test_tbl2 ORDER BY 1 OFFSET 2; | ||
c1 | c2 | c3 | ||
----+-----------+-------- | ||
30 | SALES | MUMBAI | ||
40 | HR | NAGPUR | ||
50 | IT | PUNE | ||
60 | DB SERVER | PUNE | ||
(4 rows) | ||
|
||
-- Limit ALL | ||
EXPLAIN (VERBOSE, COSTS FALSE) | ||
SELECT * FROM f_test_tbl2 ORDER BY 1 LIMIT ALL; | ||
QUERY PLAN | ||
-------------------------------------------------------------------------------------------------------------- | ||
Foreign Scan on public.f_test_tbl2 | ||
Output: c1, c2, c3 | ||
Remote query: SELECT `c1`, `c2`, `c3` FROM `mysql_fdw_regress`.`test_tbl2` ORDER BY `c1` IS NULL, `c1` ASC | ||
(3 rows) | ||
|
||
SELECT * FROM f_test_tbl2 ORDER BY 1 LIMIT ALL; | ||
c1 | c2 | c3 | ||
----+----------------+---------- | ||
10 | DEVELOPMENT | PUNE | ||
20 | ADMINISTRATION | BANGLORE | ||
30 | SALES | MUMBAI | ||
40 | HR | NAGPUR | ||
50 | IT | PUNE | ||
60 | DB SERVER | PUNE | ||
(6 rows) | ||
|
||
-- Limit NULL | ||
EXPLAIN (VERBOSE, COSTS FALSE) | ||
SELECT * FROM f_test_tbl2 ORDER BY 1 LIMIT NULL; | ||
QUERY PLAN | ||
-------------------------------------------------------------------------------------------------------------- | ||
Foreign Scan on public.f_test_tbl2 | ||
Output: c1, c2, c3 | ||
Remote query: SELECT `c1`, `c2`, `c3` FROM `mysql_fdw_regress`.`test_tbl2` ORDER BY `c1` IS NULL, `c1` ASC | ||
(3 rows) | ||
|
||
SELECT * FROM f_test_tbl2 ORDER BY 1 LIMIT NULL; | ||
c1 | c2 | c3 | ||
----+----------------+---------- | ||
10 | DEVELOPMENT | PUNE | ||
20 | ADMINISTRATION | BANGLORE | ||
30 | SALES | MUMBAI | ||
40 | HR | NAGPUR | ||
50 | IT | PUNE | ||
60 | DB SERVER | PUNE | ||
(6 rows) | ||
|
||
EXPLAIN (VERBOSE, COSTS FALSE) | ||
SELECT * FROM f_test_tbl2 ORDER BY 1 LIMIT NULL OFFSET 2; | ||
QUERY PLAN | ||
-------------------------------------------------------------------------------------------------------------------- | ||
Limit | ||
Output: c1, c2, c3 | ||
-> Foreign Scan on public.f_test_tbl2 | ||
Output: c1, c2, c3 | ||
Remote query: SELECT `c1`, `c2`, `c3` FROM `mysql_fdw_regress`.`test_tbl2` ORDER BY `c1` IS NULL, `c1` ASC | ||
(5 rows) | ||
|
||
SELECT * FROM f_test_tbl2 ORDER BY 1 LIMIT NULL OFFSET 2; | ||
c1 | c2 | c3 | ||
----+-----------+-------- | ||
30 | SALES | MUMBAI | ||
40 | HR | NAGPUR | ||
50 | IT | PUNE | ||
60 | DB SERVER | PUNE | ||
(4 rows) | ||
|
||
-- Limit 0 and Offset 0 | ||
EXPLAIN (VERBOSE, COSTS FALSE) | ||
SELECT * FROM f_test_tbl2 ORDER BY 1 LIMIT 0; | ||
QUERY PLAN | ||
---------------------------------------------------------------------------------------------------------------------- | ||
Foreign Scan on public.f_test_tbl2 | ||
Output: c1, c2, c3 | ||
Remote query: SELECT `c1`, `c2`, `c3` FROM `mysql_fdw_regress`.`test_tbl2` ORDER BY `c1` IS NULL, `c1` ASC LIMIT 0 | ||
(3 rows) | ||
|
||
SELECT * FROM f_test_tbl2 ORDER BY 1 LIMIT 0; | ||
c1 | c2 | c3 | ||
----+----+---- | ||
(0 rows) | ||
|
||
EXPLAIN (VERBOSE, COSTS FALSE) | ||
SELECT * FROM f_test_tbl2 ORDER BY 1 LIMIT 0 OFFSET 0; | ||
QUERY PLAN | ||
------------------------------------------------------------------------------------------------------------------------------- | ||
Foreign Scan on public.f_test_tbl2 | ||
Output: c1, c2, c3 | ||
Remote query: SELECT `c1`, `c2`, `c3` FROM `mysql_fdw_regress`.`test_tbl2` ORDER BY `c1` IS NULL, `c1` ASC LIMIT 0 OFFSET 0 | ||
(3 rows) | ||
|
||
SELECT * FROM f_test_tbl2 ORDER BY 1 LIMIT 0 OFFSET 0; | ||
c1 | c2 | c3 | ||
----+----+---- | ||
(0 rows) | ||
|
||
-- Offset NULL. | ||
EXPLAIN (VERBOSE, COSTS FALSE) | ||
SELECT * FROM f_test_tbl2 ORDER BY 1 LIMIT 3 OFFSET NULL; | ||
QUERY PLAN | ||
---------------------------------------------------------------------------------------------------------------------- | ||
Foreign Scan on public.f_test_tbl2 | ||
Output: c1, c2, c3 | ||
Remote query: SELECT `c1`, `c2`, `c3` FROM `mysql_fdw_regress`.`test_tbl2` ORDER BY `c1` IS NULL, `c1` ASC LIMIT 3 | ||
(3 rows) | ||
|
||
SELECT * FROM f_test_tbl2 ORDER BY 1 LIMIT 3 OFFSET NULL; | ||
c1 | c2 | c3 | ||
----+----------------+---------- | ||
10 | DEVELOPMENT | PUNE | ||
20 | ADMINISTRATION | BANGLORE | ||
30 | SALES | MUMBAI | ||
(3 rows) | ||
|
||
-- Limit with placeholder. | ||
EXPLAIN (VERBOSE, COSTS FALSE) | ||
SELECT * FROM f_test_tbl2 ORDER BY 1 LIMIT (SELECT COUNT(*) FROM f_test_tbl2); | ||
QUERY PLAN | ||
---------------------------------------------------------------------------------------------------------------------- | ||
Foreign Scan on public.f_test_tbl2 | ||
Output: f_test_tbl2.c1, f_test_tbl2.c2, f_test_tbl2.c3 | ||
Remote query: SELECT `c1`, `c2`, `c3` FROM `mysql_fdw_regress`.`test_tbl2` ORDER BY `c1` IS NULL, `c1` ASC LIMIT ? | ||
InitPlan 1 | ||
-> Foreign Scan | ||
Output: (count(*)) | ||
Relations: Aggregate on (mysql_fdw_regress.f_test_tbl2) | ||
Remote query: SELECT count(*) FROM `mysql_fdw_regress`.`test_tbl2` | ||
(8 rows) | ||
|
||
SELECT * FROM f_test_tbl2 ORDER BY 1 LIMIT (SELECT COUNT(*) FROM f_test_tbl2); | ||
c1 | c2 | c3 | ||
----+----------------+---------- | ||
10 | DEVELOPMENT | PUNE | ||
20 | ADMINISTRATION | BANGLORE | ||
30 | SALES | MUMBAI | ||
40 | HR | NAGPUR | ||
50 | IT | PUNE | ||
60 | DB SERVER | PUNE | ||
(6 rows) | ||
|
||
-- Limit with expression, should not pushdown. | ||
EXPLAIN (VERBOSE, COSTS FALSE) | ||
SELECT * FROM f_test_tbl2 ORDER BY 1 LIMIT (10 - (SELECT COUNT(*) FROM f_test_tbl2)); | ||
QUERY PLAN | ||
-------------------------------------------------------------------------------------------------------------------- | ||
Limit | ||
Output: f_test_tbl2.c1, f_test_tbl2.c2, f_test_tbl2.c3 | ||
InitPlan 1 | ||
-> Foreign Scan | ||
Output: (count(*)) | ||
Relations: Aggregate on (mysql_fdw_regress.f_test_tbl2) | ||
Remote query: SELECT count(*) FROM `mysql_fdw_regress`.`test_tbl2` | ||
-> Foreign Scan on public.f_test_tbl2 | ||
Output: f_test_tbl2.c1, f_test_tbl2.c2, f_test_tbl2.c3 | ||
Remote query: SELECT `c1`, `c2`, `c3` FROM `mysql_fdw_regress`.`test_tbl2` ORDER BY `c1` IS NULL, `c1` ASC | ||
(10 rows) | ||
|
||
SELECT * FROM f_test_tbl2 ORDER BY 1 LIMIT (10 - (SELECT COUNT(*) FROM f_test_tbl2)); | ||
c1 | c2 | c3 | ||
----+----------------+---------- | ||
10 | DEVELOPMENT | PUNE | ||
20 | ADMINISTRATION | BANGLORE | ||
30 | SALES | MUMBAI | ||
40 | HR | NAGPUR | ||
(4 rows) | ||
|
||
DELETE FROM f_test_tbl2; | ||
DROP FOREIGN TABLE f_test_tbl2; | ||
DROP USER MAPPING FOR public SERVER mysql_svr; | ||
DROP SERVER mysql_svr; | ||
DROP EXTENSION mysql_fdw; |
Oops, something went wrong.