Skip to content

Commit

Permalink
Merge upstream REL-2_5_5 and Bug fixes
Browse files Browse the repository at this point in the history
Merge from EnterpriseDB REL-2_5_5 (PostgreSQL 13.0 support etc.)
Support function pushdown in the target list (for PGSpider)
Bug fixes
- Fix deparsing query for binding an array param
- Fix pushdown function numeric()
- Fix divide results inconsistent between Postgres and Mysql
- Fix division by zero not occur
- Fix binding text array param
- Fix Subquery with ANY
  • Loading branch information
khieuvm authored Jan 14, 2021
1 parent 319d41b commit 65364c3
Show file tree
Hide file tree
Showing 32 changed files with 7,462 additions and 2,726 deletions.
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
* whitespace=space-before-tab,trailing-space
*.[ch] whitespace=space-before-tab,trailing-space,indent-with-non-tab,tabwidth=4

# Avoid confusing ASCII underlines with leftover merge conflict markers
README conflict-marker-size=32
README.* conflict-marker-size=32

# Test output files that contain extra whitespace
*.out -whitespace
88 changes: 88 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
Contributing to `mysql_fdw`
===========================

Following these guidelines helps to facilitate relevant discussion in
pull requests and issues so the developers managing and developing this
open source project can address patches and bugs as efficiently as
possible.


Using Issues
------------

`mysql_fdw`'s maintainers prefer that bug reports, feature requests, and
pull requests are submitted as [GitHub Issues][1].


Bug Reports
-----------

Before opening a bug report:

1. Search for a duplicate issue using GitHub's issue search
2. Check whether the bug remains in the latest `master` or `develop`
commit
3. Create a reduced test case: remove code and data not relevant to
the bug

A contributor should be able to begin work on your bug without asking
too many followup questions. If you include the following information,
your bug will be serviced more quickly:

* Short, descriptive title
* Your OS
* Versions of dependencies
* Any custom modifications

Once the background information is out of the way, you are free to
present the bug itself. You should explain:

* Steps you took to exercise the bug
* The expected outcome
* What actually occurred


Feature Requests
----------------

We are open to adding features but ultimately control the scope and aims
of the project. If a proposed feature is likely to incur high testing,
maintenance, or performance costs it is also unlikely to be accepted.
If a _strong_ case exists for a given feature, we may be persuaded on
merit. Be specific.


Pull Requests
-------------

Well-constructed pull requests are very welcome. By _well-constructed_,
we mean they do not introduce unrelated changes or break backwards
compatibility. Just fork this repo and open a request against `develop`.

Some examples of things likely to increase the likelihood a pull request
is rejected:

* Large structural changes, including:
* Re-factoring for its own sake
* Adding languages to the project
* Unnecessary whitespace changes
* Deviation from obvious conventions
* Introduction of incompatible intellectual property

Please do not change version numbers in your pull request: they will be
updated by the project owners prior to the next release.


License
-------

By submitting a patch, you agree to allow the project owners to license
your work under the terms of the [`LICENSE`][2]. Additionally, you grant
the project owners a license under copyright covering your contribution
to the extent permitted by law. Finally, you confirm that you own said
copyright, have the legal authority to grant said license, and in doing
so are not violating any grant of rights you have made to third parties,
including your employer.

[1]: https://github.com/EnterpriseDB/mysql_fdw/issues
[2]: LICENSE
250 changes: 250 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,250 @@
def NODE_NAME = 'AWS_Instance_CentOS'
def MAIL_TO = '$DEFAULT_RECIPIENTS'
def BRANCH_NAME = 'Branch [' + env.BRANCH_NAME + ']'
def BUILD_INFO = 'Jenkins job: ' + env.BUILD_URL + '\n'

def MYSQL_DOCKER_PATH = '/home/jenkins/Docker/Server/Mysql'
def ENHANCE_TEST_DOCKER_PATH = '/home/jenkins/Docker'
def TEST_TYPE = 'MYSQL'

START_EXISTED_TEST = ''
INIT_EXISTED_TEST = ''
START_ENHANCE_TEST = ''
INIT_ENHANCE_TEST = ''


pipeline {
agent {
node {
label NODE_NAME
}
}
options {
gitLabConnection('GitLabConnection')
}
triggers {
gitlab(
triggerOnPush: true,
triggerOnMergeRequest: false,
triggerOnClosedMergeRequest: false,
triggerOnAcceptedMergeRequest: true,
triggerOnNoteRequest: false,
setBuildDescription: true,
branchFilterType: 'All',
secretToken: "14edd1f2fc244d9f6dfc41f093db270a"
)
}
stages {
stage('Start_containers_Existed_Test') {
steps {
script {
if (env.GIT_URL != null) {
BUILD_INFO = BUILD_INFO + "Git commit: " + env.GIT_URL.replace(".git", "/commit/") + env.GIT_COMMIT + "\n"
}
}
catchError() {
sh """
cd ${MYSQL_DOCKER_PATH}
docker-compose up --build -d
"""
}
}
post {
failure {
script {
START_EXISTED_TEST = 'FAILED'
}
updateGitlabCommitStatus name: 'Build', state: 'failed'
}
success {
script {
START_EXISTED_TEST = 'SUCCESS'
}
updateGitlabCommitStatus name: 'Build', state: 'success'
}
}
}
stage('Initialize_for_Existed_Test') {
steps {
catchError() {
sh """
docker exec mysqlserver_for_existed_test /bin/bash -c '/tmp/start_existed_test.sh ${env.GIT_BRANCH}'
"""
}
}
post {
failure {
script {
INIT_EXISTED_TEST = 'FAILED'
}
updateGitlabCommitStatus name: 'Init_Data', state: 'failed'
}
success {
script {
INIT_EXISTED_TEST = 'SUCCESS'
}
updateGitlabCommitStatus name: 'Init_Data', state: 'success'
}
}
}
stage('make_check_Existed_Test') {
steps {
catchError() {
sh """
rm -rf make_check_existed_test.out || true
docker exec -u postgres postgresserver_for_mysql_existed_test /bin/bash -c '/tmp/mysql_existed_test.sh ${env.GIT_BRANCH}'
docker exec -w /home/postgres/postgresql-13beta2/contrib/mysql_fdw postgresserver_for_mysql_existed_test /bin/bash -c 'su -c "make clean && make" postgres'
docker exec -w /home/postgres/postgresql-13beta2/contrib/mysql_fdw postgresserver_for_mysql_existed_test /bin/bash -c 'su -c "export LD_LIBRARY_PATH=":/usr/lib64/mysql/" && export LANGUAGE="en_US.UTF-8" && export LANG="en_US.UTF-8" && export LC_ALL="en_US.UTF-8" && make check | tee make_check.out" postgres'
docker cp postgresserver_for_mysql_existed_test:/home/postgres/postgresql-13beta2/contrib/mysql_fdw/make_check.out make_check_existed_test.out
"""
}
script {
status = sh(returnStatus: true, script: "grep -q 'All [0-9]* tests passed' 'make_check_existed_test.out'")
if (status != 0) {
unstable(message: "Set UNSTABLE result")
sh 'docker cp postgresserver_for_mysql_existed_test:/home/postgres/postgresql-13beta2/contrib/mysql_fdw/regression.diffs regression.diffs'
sh 'cat regression.diffs || true'
updateGitlabCommitStatus name: 'make_check', state: 'failed'
} else {
updateGitlabCommitStatus name: 'make_check', state: 'success'
}
}
}
}
stage('Start_containers_Enhance_Test') {
steps {
catchError() {
sh """
cd ${ENHANCE_TEST_DOCKER_PATH}
docker-compose up --build -d
"""
}
}
post {
failure {
script {
START_ENHANCE_TEST = 'FAILED'
}
updateGitlabCommitStatus name: 'Build', state: 'failed'
}
success {
script {
START_ENHANCE_TEST = 'SUCCESS'
}
updateGitlabCommitStatus name: 'Build', state: 'success'
}
}
}
stage('Initialize_for_Enhance_Test') {
steps {
catchError() {
sh """
docker exec mysqlserver1_enhance_test /bin/bash -c '/tmp/start_enhance_test.sh'
docker exec mysqlserver2_enhance_test /bin/bash -c '/tmp/start_enhance_test.sh'
docker exec postgresserver1_enhance_test /bin/bash -c '/tmp/start_enhance_test_1.sh'
docker exec postgresserver2_enhance_test /bin/bash -c '/tmp/start_enhance_test_2.sh'
docker exec tinybraceserver1_enhance_test /bin/bash -c '/tmp/start_enhance_test_1.sh'
docker exec -d -w /usr/local/tinybrace tinybraceserver1_enhance_test /bin/bash -c 'bin/tbserver &'
docker exec tinybraceserver2_enhance_test /bin/bash -c '/tmp/start_enhance_test_2.sh'
docker exec -d -w /usr/local/tinybrace tinybraceserver2_enhance_test /bin/bash -c 'bin/tbserver &'
docker exec influxserver1_enhance_test /bin/bash -c '/tmp/start_enhance_test.sh'
docker exec influxserver2_enhance_test /bin/bash -c '/tmp/start_enhance_test.sh'
docker exec -d gridserver1_enhance_test /bin/bash -c '/tmp/start_enhance_test_1.sh'
sleep 10
docker exec -d gridserver2_enhance_test /bin/bash -c '/tmp/start_enhance_test_2.sh'
sleep 10
docker exec pgspiderserver1_enhance_test /bin/bash -c 'su -c "/tmp/start_enhance_test.sh ${env.GIT_BRANCH} ${TEST_TYPE}" pgspider'
"""
}
}
post {
failure {
script {
INIT_ENHANCE_TEST = 'FAILED'
}
updateGitlabCommitStatus name: 'Init_Data', state: 'failed'
}
success {
script {
INIT_ENHANCE_TEST = 'SUCCESS'
}
updateGitlabCommitStatus name: 'Init_Data', state: 'success'
}
}
}
stage('make_check_Enhance_Test') {
steps {
catchError() {
sh """
rm -rf make_check_enhance_test.out regression.diffs || true
docker exec -w /home/pgspider/GIT/PGSpider/contrib/pgspider_core_fdw pgspiderserver1_enhance_test /bin/bash -c 'su -c "chmod a+x *.sh" pgspider'
docker exec -w /home/pgspider/GIT/PGSpider/contrib/pgspider_core_fdw pgspiderserver1_enhance_test /bin/bash -c "sed -i 's/enhance\\\\\\\\\\/BasicFeature1_File_4ARG enhance\\\\\\\\\\/BasicFeature1_File_AllARG enhance\\\\\\\\\\/BasicFeature1_GridDB_4ARG enhance\\\\\\\\\\/BasicFeature1_GridDB_AllARG enhance\\\\\\\\\\/BasicFeature1_InfluxDB_4ARG enhance\\\\\\\\\\/BasicFeature1_InfluxDB_AllARG enhance\\\\\\\\\\/BasicFeature1_MySQL_4ARG enhance\\\\\\\\\\/BasicFeature1_MySQL_AllARG enhance\\\\\\\\\\/BasicFeature1_PostgreSQL_4ARG enhance\\\\\\\\\\/BasicFeature1_PostgreSQL_AllARG enhance\\\\\\\\\\/BasicFeature1_SQLite_4ARG enhance\\\\\\\\\\/BasicFeature1_SQLite_AllARG enhance\\\\\\\\\\/BasicFeature1_TinyBrace_4ARG enhance\\\\\\\\\\/BasicFeature1_TinyBrace_AllARG enhance\\\\\\\\\\/BasicFeature1_t_max_range enhance\\\\\\\\\\/BasicFeature1_tmp_t15_4ARG enhance\\\\\\\\\\/BasicFeature1_tmp_t15_AllARG enhance\\\\\\\\\\/BasicFeature2_JOIN_Multi_Tbl enhance\\\\\\\\\\/BasicFeature2_SELECT_Muli_Tbl enhance\\\\\\\\\\/BasicFeature2_UNION_Multi_Tbl enhance\\\\\\\\\\/BasicFeature_Additional_Test enhance\\\\\\\\\\/BasicFeature_ComplexCommand enhance\\\\\\\\\\/BasicFeature_For_Bug_54 enhance\\\\\\\\\\/BasicFeature_For_Bug_60/enhance\\\\\\\\\\/BasicFeature1_MySQL_4ARG enhance\\\\\\\\\\/BasicFeature1_MySQL_AllARG/g' test_enhance.sh"
docker exec -w /home/pgspider/GIT/PGSpider/contrib/pgspider_core_fdw pgspiderserver1_enhance_test /bin/bash -c 'su -c "./test_enhance.sh" pgspider'
docker cp pgspiderserver1_enhance_test:/home/pgspider/GIT/PGSpider/contrib/pgspider_core_fdw/make_check.out make_check_enhance_test.out
"""
}
script {
status = sh(returnStatus: true, script: "grep -q 'All [0-9]* tests passed' 'make_check_enhance_test.out'")
if (status != 0) {
unstable(message: "Set UNSTABLE result")
sh 'docker cp pgspiderserver1_enhance_test:/home/pgspider/GIT/PGSpider/contrib/pgspider_core_fdw/regression.diffs regression.diffs'
sh 'cat regression.diffs || true'
updateGitlabCommitStatus name: 'make_check', state: 'failed'
} else {
updateGitlabCommitStatus name: 'make_check', state: 'success'
}
}
}
}
}
post {
success {
script {
prevResult = 'SUCCESS'
if (currentBuild.previousBuild != null) {
prevResult = currentBuild.previousBuild.result.toString()
}
if (prevResult != 'SUCCESS') {
emailext subject: '[CI MYSQL_FDW] InfluxDB_Test BACK TO NORMAL on ' + BRANCH_NAME, body: BUILD_INFO + '\n---------EXISTED_TEST---------\n' + '${FILE,path="make_check_existed_test.out"}' + '\n---------ENHANCE_TEST---------\n' + '${FILE,path="make_check_enhance_test.out"}', to: "${MAIL_TO}", attachLog: false
}
}
}
unsuccessful {
script {
if (START_EXISTED_TEST == 'FAILED') {
if (START_ENHANCE_TEST == 'FAILED') {
emailext subject: '[CI MYSQL_FDW] EXISTED_TEST: Start Containers FAILED | ENHANCE_TEST: Start Containers FAILED ' + BRANCH_NAME, body: BUILD_INFO + '${BUILD_LOG, maxLines=200, escapeHtml=false}', to: "${MAIL_TO}", attachLog: false
} else if (INIT_ENHANCE_TEST == 'FAILED') {
emailext subject: '[CI MYSQL_FDW] EXISTED_TEST: Start Containers FAILED | ENHANCE_TEST: Initialize FAILED ' + BRANCH_NAME, body: BUILD_INFO + '${BUILD_LOG, maxLines=200, escapeHtml=false}', to: "${MAIL_TO}", attachLog: false
} else {
emailext subject: '[CI MYSQL_FDW] EXISTED_TEST: Start Containers FAILED | ENHANCE_TEST: Result make check ' + BRANCH_NAME, body: BUILD_INFO + '${FILE,path="make_check_enhance_test.out"}', to: "${MAIL_TO}", attachLog: false
}
} else if (INIT_EXISTED_TEST == 'FAILED') {
if (START_ENHANCE_TEST == 'FAILED') {
emailext subject: '[CI MYSQL_FDW] EXISTED_TEST: Initialize FAILED | ENHANCE_TEST: Start Containers FAILED ' + BRANCH_NAME, body: BUILD_INFO + '${BUILD_LOG, maxLines=200, escapeHtml=false}', to: "${MAIL_TO}", attachLog: false
} else if (INIT_ENHANCE_TEST == 'FAILED') {
emailext subject: '[CI MYSQL_FDW] EXISTED_TEST: Initialize FAILED | ENHANCE_TEST: Initialize FAILED ' + BRANCH_NAME, body: BUILD_INFO + '${BUILD_LOG, maxLines=200, escapeHtml=false}', to: "${MAIL_TO}", attachLog: false
} else {
emailext subject: '[CI MYSQL_FDW] EXISTED_TEST: Initialize FAILED | ENHANCE_TEST: Result make check ' + BRANCH_NAME, body: BUILD_INFO + '${FILE,path="make_check_enhance_test.out"}', to: "${MAIL_TO}", attachLog: false
}
} else {
if (START_ENHANCE_TEST == 'FAILED') {
emailext subject: '[CI MYSQL_FDW] EXISTED_TEST: Result make check | ENHANCE_TEST: Start Containers FAILED ' + BRANCH_NAME, body: BUILD_INFO + '${FILE,path="make_check_existed_test.out"}', to: "${MAIL_TO}", attachLog: false
} else if (INIT_ENHANCE_TEST == 'FAILED') {
emailext subject: '[CI MYSQL_FDW] EXISTED_TEST: Result make check | ENHANCE_TEST: Initialize FAILED ' + BRANCH_NAME, body: BUILD_INFO + '${FILE,path="make_check_existed_test.out"}', to: "${MAIL_TO}", attachLog: false
} else {
emailext subject: '[CI MYSQL_FDW] EXISTED_TEST: Result make check | ENHANCE_TEST: Result make check ' + BRANCH_NAME, body: BUILD_INFO + '\n---------EXISTED_TEST---------\n' + '${FILE,path="make_check_existed_test.out"}' + '\n---------ENHANCE_TEST---------\n' + '${FILE,path="make_check_enhance_test.out"}', to: "${MAIL_TO}", attachLog: false
}
}
}
}
always {
sh """
cd ${MYSQL_DOCKER_PATH}
docker-compose down
cd ${ENHANCE_TEST_DOCKER_PATH}
docker-compose down
"""
}
}
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MySQL Foreign Data Wrapper for PostgreSQL

Copyright (c) 2011 - 2019, EnterpriseDB Corporation
Copyright (c) 2011-2020, EnterpriseDB Corporation.

Permission to use, copy, modify, and distribute this software and its
documentation for any purpose, without fee, and without a written agreement is
Expand Down
18 changes: 5 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
######################################################################-------------------------------------------------------------------------
#
# mysql_fdw.c
# Foreign-data wrapper for remote MySQL servers
# mysql_fdw/Makefile
#
# Portions Copyright (c) 2012-2014, PostgreSQL Global Development Group
# Portions Copyright (c) 2004-2020, EnterpriseDB Corporation.
#
# Portions Copyright (c) 2004-2014, EnterpriseDB Corporation.
#
# IDENTIFICATION
# mysql_fdw.c
#
##########################################################################

MODULE_big = mysql_fdw
OBJS = connection.o option.o deparse.o mysql_query.o mysql_fdw.o

EXTENSION = mysql_fdw
DATA = mysql_fdw--1.0.sql mysql_fdw--1.1.sql mysql_fdw--1.0--1.1.sql

REGRESS = mysql_fdw
REGRESS = server_options connection_validation dml select pushdown selectfunc

MYSQL_CONFIG = mysql_config
PG_CPPFLAGS := $(shell $(MYSQL_CONFIG) --include)
Expand Down Expand Up @@ -48,8 +40,8 @@ include $(PGXS)
ifndef MAJORVERSION
MAJORVERSION := $(basename $(VERSION))
endif
ifeq (,$(findstring $(MAJORVERSION), 9.3 9.4 9.5 9.6 10 11 12))
$(error PostgreSQL 9.3, 9.4, 9.5, 9.6 10 11 12 is required to compile this extension)
ifeq (,$(findstring $(MAJORVERSION), 9.5 9.6 10 11 12 13))
$(error PostgreSQL 9.5, 9.6, 10, 11, 12, or 13 is required to compile this extension)
endif

else
Expand Down
Loading

0 comments on commit 65364c3

Please sign in to comment.