Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
postgresql-mysql-fdw
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PostgreSQL
postgresql-mysql-fdw
Commits
fc5bcac2
Commit
fc5bcac2
authored
4 years ago
by
Christoph Berg
Browse files
Options
Downloads
Patches
Plain Diff
Refresh regression test output files
parent
b8d9dc41
No related branches found
No related tags found
No related merge requests found
Pipeline
#208411
passed
4 years ago
Stage: provisioning
Stage: build
Stage: test
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
debian/patches/regress-mariadb
+104
-4
104 additions, 4 deletions
debian/patches/regress-mariadb
debian/patches/remove-flaky-output
+4
-4
4 additions, 4 deletions
debian/patches/remove-flaky-output
with
108 additions
and
8 deletions
debian/patches/regress-mariadb
+
104
−
4
View file @
fc5bcac2
...
...
@@ -62,7 +62,7 @@
+DROP EXTENSION mysql_fdw;
--- /dev/null
+++ b/expected/dml_1.out
@@ -0,0 +1,
1
32 @@
@@ -0,0 +1,
2
32 @@
+\set MYSQL_HOST '\'localhost\''
+\set MYSQL_PORT '\'3306\''
+\set MYSQL_USER_NAME '\'edb\''
...
...
@@ -79,7 +79,7 @@
+-- Create foreign tables
+CREATE FOREIGN TABLE f_mysql_test(a int, b int)
+ SERVER mysql_svr OPTIONS (dbname 'mysql_fdw_regress', table_name 'mysql_test');
+CREATE FOREIGN TABLE fdw126_ft1(stu_id int, stu_name varchar(255))
+CREATE FOREIGN TABLE fdw126_ft1(stu_id int, stu_name varchar(255)
, stu_dept int
)
+ SERVER mysql_svr OPTIONS (dbname 'mysql_fdw_regress1', table_name 'student');
+CREATE FOREIGN TABLE fdw126_ft2(stu_id int, stu_name varchar(255))
+ SERVER mysql_svr OPTIONS (table_name 'student');
...
...
@@ -93,6 +93,8 @@
+ SERVER mysql_svr OPTIONS (table_name 'mysql_fdw_regress1.student');
+CREATE FOREIGN TABLE f_empdata(emp_id int, emp_dat bytea)
+ SERVER mysql_svr OPTIONS (dbname 'mysql_fdw_regress', table_name 'empdata');
+CREATE FOREIGN TABLE fdw193_ft1(stu_id varchar(10), stu_name varchar(255), stu_dept int)
+ SERVER mysql_svr OPTIONS (dbname 'mysql_fdw_regress1', table_name 'student1');
+-- Operation on blob data.
+INSERT INTO f_empdata VALUES (1, decode ('01234567', 'hex'));
+SELECT count(*) FROM f_empdata ORDER BY 1;
...
...
@@ -121,7 +123,7 @@
+-- the operation on foreign table created for tables in mysql_fdw_regress
+-- MySQL database. Below operations will be performed for foreign table
+-- created for table in mysql_fdw_regress1 MySQL database.
+INSERT INTO fdw126_ft1 VALUES(1, 'One');
+INSERT INTO fdw126_ft1 VALUES(1, 'One'
, 101
);
+UPDATE fdw126_ft1 SET stu_name = 'one' WHERE stu_id = 1;
+DELETE FROM fdw126_ft1 WHERE stu_id = 1;
+-- Select on f_mysql_test foreign table which is created for mysql_test table
...
...
@@ -139,7 +141,7 @@
+-- throw an error.
+INSERT INTO fdw126_ft2 VALUES(2, 'Two');
+ERROR: failed to execute the MySQL query:
+
SELECT command denied to user 'edb'@'localhost' for
tab
l
e '
student
'
+
Unknown da
tab
as
e '
public
'
+-- Check with the same table name from different database. fdw126_ft3 is
+-- pointing to the mysql_fdw_regress1.numbers and not mysql_fdw_regress.numbers
+-- table. INSERT/UPDATE/DELETE should be failing. SELECT will return no rows.
...
...
@@ -181,9 +183,105 @@
+WARNING: skipping "f_empdata" --- cannot analyze this foreign table
+VACUUM ANALYZE f_empdata;
+WARNING: skipping "f_empdata" --- cannot vacuum non-tables or special system tables
+-- Verify the before update trigger which modifies the column value which is not
+-- part of update statement.
+CREATE FUNCTION before_row_update_func() RETURNS TRIGGER AS $$
+BEGIN
+ NEW.stu_name := NEW.stu_name || ' trigger updated!';
+ RETURN NEW;
+ END
+$$ language plpgsql;
+CREATE TRIGGER before_row_update_trig
+BEFORE UPDATE ON fdw126_ft1
+FOR EACH ROW EXECUTE PROCEDURE before_row_update_func();
+INSERT INTO fdw126_ft1 VALUES(1, 'One', 101);
+EXPLAIN (verbose, costs off)
+UPDATE fdw126_ft1 SET stu_dept = 201 WHERE stu_id = 1;
+ QUERY PLAN
+-------------------------------------------------------------------------------------------------------------------------------------
+ Update on public.fdw126_ft1
+ -> Foreign Scan on public.fdw126_ft1
+ Output: stu_id, stu_name, 201, stu_id, fdw126_ft1.*
+ Local server startup cost: 10
+ Remote query: SELECT `stu_id`, `stu_name`, `stu_dept` FROM `mysql_fdw_regress1`.`student` WHERE ((`stu_id` = 1)) FOR UPDATE
+(5 rows)
+
+UPDATE fdw126_ft1 SET stu_dept = 201 WHERE stu_id = 1;
+SELECT * FROM fdw126_ft1 ORDER BY stu_id;
+ stu_id | stu_name | stu_dept
+--------+----------------------+----------
+ 1 | One trigger updated! | 201
+(1 row)
+
+-- Throw an error when target list has row identifier column.
+UPDATE fdw126_ft1 SET stu_dept = 201, stu_id = 10 WHERE stu_id = 1;
+ERROR: row identifier column update is not supported
+-- Throw an error when before row update trigger modify the row identifier
+-- column (int column) value.
+CREATE OR REPLACE FUNCTION before_row_update_func() RETURNS TRIGGER AS $$
+BEGIN
+ NEW.stu_name := NEW.stu_name || ' trigger updated!';
+ NEW.stu_id = 20;
+ RETURN NEW;
+ END
+$$ language plpgsql;
+UPDATE fdw126_ft1 SET stu_dept = 301 WHERE stu_id = 1;
+ERROR: row identifier column update is not supported
+-- Verify the before update trigger which modifies the column value which is
+-- not part of update statement.
+CREATE OR REPLACE FUNCTION before_row_update_func() RETURNS TRIGGER AS $$
+BEGIN
+ NEW.stu_name := NEW.stu_name || ' trigger updated!';
+ RETURN NEW;
+ END
+$$ language plpgsql;
+CREATE TRIGGER before_row_update_trig1
+BEFORE UPDATE ON fdw193_ft1
+FOR EACH ROW EXECUTE PROCEDURE before_row_update_func();
+INSERT INTO fdw193_ft1 VALUES('aa', 'One', 101);
+EXPLAIN (verbose, costs off)
+UPDATE fdw193_ft1 SET stu_dept = 201 WHERE stu_id = 'aa';
+ QUERY PLAN
+-----------------------------------------------------------------------------------------------------------------------------------------
+ Update on public.fdw193_ft1
+ -> Foreign Scan on public.fdw193_ft1
+ Output: stu_id, stu_name, 201, stu_id, fdw193_ft1.*
+ Local server startup cost: 10
+ Remote query: SELECT `stu_id`, `stu_name`, `stu_dept` FROM `mysql_fdw_regress1`.`student1` WHERE ((`stu_id` = 'aa')) FOR UPDATE
+(5 rows)
+
+UPDATE fdw193_ft1 SET stu_dept = 201 WHERE stu_id = 'aa';
+SELECT * FROM fdw193_ft1 ORDER BY stu_id;
+ stu_id | stu_name | stu_dept
+--------+----------------------+----------
+ aa | One trigger updated! | 201
+(1 row)
+
+-- Throw an error when before row update trigger modify the row identifier
+-- column (varchar column) value.
+CREATE OR REPLACE FUNCTION before_row_update_func() RETURNS TRIGGER AS $$
+BEGIN
+ NEW.stu_name := NEW.stu_name || ' trigger updated!';
+ NEW.stu_id = 'bb';
+ RETURN NEW;
+ END
+$$ language plpgsql;
+UPDATE fdw193_ft1 SET stu_dept = 301 WHERE stu_id = 'aa';
+ERROR: row identifier column update is not supported
+-- Verify the NULL assignment scenario.
+CREATE OR REPLACE FUNCTION before_row_update_func() RETURNS TRIGGER AS $$
+BEGIN
+ NEW.stu_name := NEW.stu_name || ' trigger updated!';
+ NEW.stu_id = NULL;
+ RETURN NEW;
+ END
+$$ language plpgsql;
+UPDATE fdw193_ft1 SET stu_dept = 401 WHERE stu_id = 'aa';
+ERROR: row identifier column update is not supported
+-- Cleanup
+DELETE FROM fdw126_ft1;
+DELETE FROM f_empdata;
+DELETE FROM fdw193_ft1;
+DROP FOREIGN TABLE f_mysql_test;
+DROP FOREIGN TABLE fdw126_ft1;
+DROP FOREIGN TABLE fdw126_ft2;
...
...
@@ -192,6 +290,8 @@
+DROP FOREIGN TABLE fdw126_ft5;
+DROP FOREIGN TABLE fdw126_ft6;
+DROP FOREIGN TABLE f_empdata;
+DROP FOREIGN TABLE fdw193_ft1;
+DROP FUNCTION before_row_update_func();
+DROP USER MAPPING FOR public SERVER mysql_svr;
+DROP SERVER mysql_svr;
+DROP EXTENSION mysql_fdw;
This diff is collapsed.
Click to expand it.
debian/patches/remove-flaky-output
+
4
−
4
View file @
fc5bcac2
...
...
@@ -35,7 +35,7 @@ Ignore these for Debian.
ALTER SERVER mysql_svr OPTIONS (SET host :MYSQL_HOST);
--- a/expected/dml.out
+++ b/expected/dml.out
@@ -7
2
,9 +7
2
,6 @@
SELECT a, b FROM f_mysql_test ORDER BY 1
@@ -7
4
,9 +7
4
,6 @@
SELECT a, b FROM f_mysql_test ORDER BY 1
-- creating the foreign table, so it will consider the schema name of foreign
-- table as database name and try to connect/lookup into that database. Will
-- throw an error.
...
...
@@ -47,19 +47,19 @@ Ignore these for Debian.
-- table. INSERT/UPDATE/DELETE should be failing. SELECT will return no rows.
--- a/expected/dml_1.out
+++ b/expected/dml_1.out
@@ -7
2
,9 +7
2
,6 @@
SELECT a, b FROM f_mysql_test ORDER BY 1
@@ -7
4
,9 +7
4
,6 @@
SELECT a, b FROM f_mysql_test ORDER BY 1
-- creating the foreign table, so it will consider the schema name of foreign
-- table as database name and try to connect/lookup into that database. Will
-- throw an error.
-INSERT INTO fdw126_ft2 VALUES(2, 'Two');
-ERROR: failed to execute the MySQL query:
-
SELECT command denied to user 'edb'@'localhost' for
tab
l
e '
student
'
-
Unknown da
tab
as
e '
public
'
-- Check with the same table name from different database. fdw126_ft3 is
-- pointing to the mysql_fdw_regress1.numbers and not mysql_fdw_regress.numbers
-- table. INSERT/UPDATE/DELETE should be failing. SELECT will return no rows.
--- a/sql/dml.sql
+++ b/sql/dml.sql
@@ -6
1
,7 +6
1
,6 @@
SELECT a, b FROM f_mysql_test ORDER BY 1
@@ -6
3
,7 +6
3
,6 @@
SELECT a, b FROM f_mysql_test ORDER BY 1
-- creating the foreign table, so it will consider the schema name of foreign
-- table as database name and try to connect/lookup into that database. Will
-- throw an error.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment