diff --git a/GNUmakefile.in b/GNUmakefile.in index c9039bbf9e1c35e17b08374442d002efa93aa127..d37de48367feb6f7073981dae7b328da56115bef 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -26,8 +26,16 @@ world-contrib-recurse: world-src-recurse html man: $(MAKE) -C doc $@ + +ifeq ($(enable_mysql_fdw), yes) +install_mysql_fdw: + $(MAKE) -C contrib/mysql_fdw install +else +install_mysql_fdw: +endif + ifeq ($(enable_multiple_nodes), yes) -install: +install: install_mysql_fdw $(MAKE) -C contrib/hstore $@ $(MAKE) -C src/distribute/kernel/extension/packages $@ $(MAKE) -C contrib/pagehack $@ @@ -37,7 +45,7 @@ install: $(MAKE) -C src/distribute/kernel/extension/tsdb $@ +@echo "PostgreSQL installation complete." else -install: +install: install_mysql_fdw +@echo "openGauss installation complete." endif diff --git a/README.md b/README.md index e2aced10cd0c77822017ceadd806de94bdc563db..5d42be4f12fbf331ed03519d5ffef49e4b0b57b8 100644 --- a/README.md +++ b/README.md @@ -513,6 +513,7 @@ Compilation log: **make_compile.log** > 2. On the ARM-based platform, **-D__USE_NUMA** needs to be added to **CFLAGS**. > 3. On the **ARMv8.1** platform or a later version (for example, Kunpeng 920), **-D__ARM_LSE** needs to be added to **CFLAGS**. > 4. If **binarylibs** is moved to **openGauss-server** or a soft link to **binarylibs** is created in **openGauss-server**, you do not need to specify the **--3rd** parameter. However, if you do so, please note that the file is easy to be deleted by the `git clean` command. + > 5. To build with mysql_fdw, add **--enable-mysql-fdw** when configure. Note that before build mysql_fdw, MariaDB's C client library is needed. 4. Run the following commands to compile openGauss: diff --git a/configure b/configure index dc77cd5d5ae1d6400bc95de994a5e1c36a73dd27..e72c69476e2fd2d1a3cb51fb8f9dcf2ecb2eb50a 100755 --- a/configure +++ b/configure @@ -743,6 +743,7 @@ enable_jemalloc enable_jemalloc_debug enable_multiple_nodes enable_memory_check +enable_mysql_fdw enable_thread_check enable_shared default_gs_version @@ -819,6 +820,7 @@ enable_jemalloc enable_jemalloc_debug enable_multiple_nodes enable_memory_check +enable_mysql_fdw enable_thread_check enable_spinlocks enable_debug @@ -2845,6 +2847,28 @@ _ACEOF fi +# Check whether --enable-mysql-fdw was given. +if test "${enable_mysql_fdw+set}" = set; then + enableval=$enable_mysql_fdw; + case $enableval in + yes) + : + ;; + no) + : + ;; + *) + { { $as_echo "$as_me:$LINENO: error: no argument expected for --enable-mysql-fdw option" >&5 +$as_echo "$as_me: error: no argument expected for --enable-mysql-fdw option" >&2;} + { (exit 1); exit 1; }; } + ;; + esac + +else + enable_mysql_fdw=no + +fi + # Check whether --enable-thread-check was given. if test "${enable_thread_check+set}" = set; then enableval=$enable_thread_check; diff --git a/contrib/mysql_fdw/Makefile b/contrib/mysql_fdw/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..aaf59b8859487009c0bde10ef52e0e4d063c71ed --- /dev/null +++ b/contrib/mysql_fdw/Makefile @@ -0,0 +1,54 @@ +# +# Copyright (c) 2020 Huawei Technologies Co.,Ltd. +# +# openGauss is licensed under Mulan PSL v2. +# You can use this software according to the terms and conditions of the Mulan PSL v2. +# You may obtain a copy of Mulan PSL v2 at: +# +# http://license.coscl.org.cn/MulanPSL2 +# +# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, +# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, +# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. +# See the Mulan PSL v2 for more details. +# --------------------------------------------------------------------------------------- +# +# Makefile +# Makefile for the mysql_fdw +# +# IDENTIFICATION +# contrib/mysql_fdw/Makefile +# +# --------------------------------------------------------------------------------------- + +all:mysql_fdw_target +install:install-data + +top_builddir ?= ../../ +MYSQL_FDW_DIR=$(top_builddir)/third_party/dependency/mysql_fdw +MYSQL_FDW_PACKAGE=mysql_fdw-REL-2_5_3 +MYSQL_FDW_PATCH=huawei_mysql_fdw-2.5.3_patch +MYSQL_FDW_MEGRED_SOURCES_DIR=$(MYSQL_FDW_DIR)/code + +.PHONY: mysql_fdw_target +mysql_fdw_target: + @$(call create_mysql_fdw_sources) + @make -C $(MYSQL_FDW_MEGRED_SOURCES_DIR)/$(MYSQL_FDW_PACKAGE) USE_PGXS=1 + +.PHONY: install-data +install-data: + @$(call create_mysql_fdw_sources) + @make -C $(MYSQL_FDW_MEGRED_SOURCES_DIR)/$(MYSQL_FDW_PACKAGE) USE_PGXS=1 install + +uninstall distclean clean: + @rm -rf $(MYSQL_FDW_MEGRED_SOURCES_DIR) + +MYSQL_FDW_RELEVANT_SOURCES = connection.c deparse.c mysql_fdw.c mysql_query.c option.c + +define create_mysql_fdw_sources + rm -rf $(MYSQL_FDW_MEGRED_SOURCES_DIR); \ + mkdir $(MYSQL_FDW_MEGRED_SOURCES_DIR); \ + tar xfzv $(MYSQL_FDW_DIR)/$(MYSQL_FDW_PACKAGE).tar.gz -C $(MYSQL_FDW_MEGRED_SOURCES_DIR) &> /dev/null; \ + rename ".c" ".cpp" $(MYSQL_FDW_MEGRED_SOURCES_DIR)/$(MYSQL_FDW_PACKAGE)/*.c; \ + patch -d $(MYSQL_FDW_MEGRED_SOURCES_DIR)/$(MYSQL_FDW_PACKAGE) < $(MYSQL_FDW_DIR)/$(MYSQL_FDW_PATCH).patch &> /dev/null; +endef diff --git a/src/Makefile b/src/Makefile index 16b7170cbe2282276159425aa8a8b629140a1598..23534197a737b58460c99acf9b479a196349e1c8 100644 --- a/src/Makefile +++ b/src/Makefile @@ -68,6 +68,7 @@ install-local: installdirs-local $(INSTALL_DATA) Makefile.port '$(DESTDIR)$(pgxsdir)/$(subdir)/Makefile.port' $(INSTALL_DATA) $(srcdir)/Makefile.shlib '$(DESTDIR)$(pgxsdir)/$(subdir)/Makefile.shlib' $(INSTALL_DATA) $(srcdir)/nls-global.mk '$(DESTDIR)$(pgxsdir)/$(subdir)/nls-global.mk' + $(INSTALL_DATA) get_PlatForm_str.sh '$(DESTDIR)$(pgxsdir)/$(subdir)/get_PlatForm_str.sh' installdirs: installdirs-local @@ -77,7 +78,7 @@ installdirs-local: uninstall: uninstall-local uninstall-local: - rm -f $(addprefix '$(DESTDIR)$(pgxsdir)/$(subdir)'/, Makefile.global Makefile.port Makefile.shlib nls-global.mk) + rm -f $(addprefix '$(DESTDIR)$(pgxsdir)/$(subdir)'/, Makefile.global Makefile.port Makefile.shlib nls-global.mk get_PlatForm_str.sh) distprep: $(MAKE) -C test/isolation $@ diff --git a/src/Makefile.global.in b/src/Makefile.global.in index 0855a5ee9c3add269a649a4a62b7e7b1a0faf01a..23f197a14a9c072c33d099f034d07287f7f96e32 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -171,6 +171,7 @@ enable_cassert = @enable_cassert@ enable_jemalloc = @enable_jemalloc@ enable_jemalloc_debug = @enable_jemalloc_debug@ enable_multiple_nodes = @enable_multiple_nodes@ +enable_mysql_fdw = @enable_mysql_fdw@ enable_memory_check = @enable_memory_check@ enable_memory_check_core = @enable_memory_check_core@ enable_thread_check = @enable_thread_check@ diff --git a/src/common/backend/parser/analyze.cpp b/src/common/backend/parser/analyze.cpp index dffed5cf1d41ce633fb82077f6d6c21d4ec7853c..68386f168c8d8a7ac8c0754e8a9249539cfa1cae 100644 --- a/src/common/backend/parser/analyze.cpp +++ b/src/common/backend/parser/analyze.cpp @@ -868,7 +868,7 @@ static void CheckUnsupportInsertSelectClause(Query* query) AssertEreport(query->commandType == CMD_INSERT, MOD_OPT, "Only deal with CMD_INSERT commondType here"); if (result->relkind == RELKIND_FOREIGN_TABLE) { - if (isMOTFromTblOid(result->relid)) + if (isMOTFromTblOid(result->relid) || isMysqlFDWFromTblOid(result->relid)) return; if (list_length(query->rtable) == 1) diff --git a/src/gausskernel/Makefile b/src/gausskernel/Makefile index 5524d0c49f03eb3c19831bb3340a21e7fa390c47..ef68c13e92d0db2a52587c40fff31e08c0d279f4 100644 --- a/src/gausskernel/Makefile +++ b/src/gausskernel/Makefile @@ -27,6 +27,10 @@ SUBDIRS = ../common/backend bootstrap cbb optimizer process runtime security $(top_builddir)/contrib/file_fdw $(top_builddir)/contrib/hdfs_fdw \ $(top_builddir)/contrib/log_fdw $(top_builddir)/contrib/test_decoding $(top_builddir)/contrib/mppdb_decoding +ifeq ($(enable_mysql_fdw), yes) + SUBDIRS += $(top_builddir)/contrib/mysql_fdw +endif + ifeq ($(enable_multiple_nodes), yes) SUBDIRS += ../distribute/kernel ../distribute/kernel/extension/roach_api ../distribute/kernel/extension/dimsearch/main \ ../distribute/kernel/extension/tsdb diff --git a/src/gausskernel/optimizer/commands/extension.cpp b/src/gausskernel/optimizer/commands/extension.cpp index 8c5c528015d2106e35542c290f36f88d52397103..01a785876adb8f3ec1b1d79e1ec4ae96ed99eca8 100755 --- a/src/gausskernel/optimizer/commands/extension.cpp +++ b/src/gausskernel/optimizer/commands/extension.cpp @@ -1087,15 +1087,9 @@ void CreateExtension(CreateExtensionStmt* stmt) errmsg("extension \"%s\" already exists in schema \"%s\", skipping", stmt->extname, schemaName))); return; } else { - /* - * Currently extension only support postgis. - */ - if (strstr(stmt->extname, "postgis")) - ereport(ERROR, - (errcode(ERRCODE_DUPLICATE_OBJECT), - errmsg("extension \"%s\" already exists in schema \"%s\"", stmt->extname, schemaName))); - else - FEATURE_NOT_PUBLIC_ERROR("EXTENSION is not yet supported."); + ereport(ERROR, + (errcode(ERRCODE_DUPLICATE_OBJECT), + errmsg("extension \"%s\" already exists in schema \"%s\"", stmt->extname, schemaName))); } } diff --git a/src/gausskernel/optimizer/commands/functioncmds.cpp b/src/gausskernel/optimizer/commands/functioncmds.cpp index 9026aaceb7e6b845baea5bcc0d6ad151133b82e4..b053047cbf342e1c9297c67cef28d70871ce6f27 100755 --- a/src/gausskernel/optimizer/commands/functioncmds.cpp +++ b/src/gausskernel/optimizer/commands/functioncmds.cpp @@ -901,24 +901,6 @@ void CreateFunction(CreateFunctionStmt* stmt, const char* queryString) : 0))); languageOid = HeapTupleGetOid(languageTuple); - if (languageOid == JavalanguageId || (languageOid == ClanguageId && !IsInitdb)) { - /* - * single node dose not support Java UDF or other fenced functions. - * check it here because users may not know the Java UDF is fenced by default, - * so it's better to report detailed error messages for different senarios. - */ - if (IS_SINGLE_NODE) { - ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("C/JAVA UDF is not yet supported in current version."))); - } - - /* only support fenced mode Java UDF */ - if (!fenced) { - ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("C/Java UDF dose not support NOT FENCED functions."))); - } - } - languageStruct = (Form_pg_language)GETSTRUCT(languageTuple); /* Check user's privilege regardless of whether langugae is a trust type */ diff --git a/src/gausskernel/optimizer/plan/createplan.cpp b/src/gausskernel/optimizer/plan/createplan.cpp index bfd6424870ec1e49a8f25287fcc43d827b2a0596..d356ff9454f7762531187dc20b883add1ce00bef 100644 --- a/src/gausskernel/optimizer/plan/createplan.cpp +++ b/src/gausskernel/optimizer/plan/createplan.cpp @@ -8462,7 +8462,7 @@ ModifyTable* make_modifytable(CmdType operation, bool canSetTag, List* resultRel Plan* subplan = (Plan*)(linitial(subplans)); ForeignScan* fscan = NULL; if ((fscan = (ForeignScan*)FindForeignScan(subplan)) != NULL) { - if (!isMOTFromTblOid(fscan->scan_relid)) + if (!isMOTFromTblOid(fscan->scan_relid) && !isMysqlFDWFromTblOid(fscan->scan_relid)) ereport(ERROR, (errmodule(MOD_OPT), errcode(ERRCODE_FEATURE_NOT_SUPPORTED), diff --git a/src/gausskernel/process/tcop/utility.cpp b/src/gausskernel/process/tcop/utility.cpp index 0ffb60dbdbb9a255d3aae754aab7d2a6a5fa4dfc..0524a4d4655c1b1d95b0e871a7b6b960ec537766 100755 --- a/src/gausskernel/process/tcop/utility.cpp +++ b/src/gausskernel/process/tcop/utility.cpp @@ -2572,14 +2572,6 @@ void standard_ProcessUtility(Node* parse_tree, const char* query_string, ParamLi break; case T_CreateForeignTableStmt: - if (!IsInitdb && IS_SINGLE_NODE && - !isMOTTableFromSrvName(((CreateForeignTableStmt*)parse_tree)->servername)) { - ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("Current mode does not support FOREIGN table yet"), - errdetail("The feature is not currently supported"))); - } - /* fall through */ case T_CreateStmt: { #ifdef PGXC CreateCommand((CreateStmt*)parse_tree, query_string, params, is_top_level, sent_to_remote); @@ -2702,15 +2694,6 @@ void standard_ProcessUtility(Node* parse_tree, const char* query_string, ParamLi break; case T_CreateFdwStmt: -#ifdef PGXC - /* enable CREATE FOREIGN DATA WRAPPER when initdb */ - if (!IsInitdb && !u_sess->attr.attr_common.IsInplaceUpgrade) { - ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("Postgres-XC does not support FOREIGN DATA WRAPPER yet"), - errdetail("The feature is not currently supported"))); - } -#endif CreateForeignDataWrapper((CreateFdwStmt*)parse_tree); #ifdef PGXC @@ -2720,22 +2703,10 @@ void standard_ProcessUtility(Node* parse_tree, const char* query_string, ParamLi break; case T_AlterFdwStmt: -#ifdef PGXC - ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("Postgres-XC does not support FOREIGN DATA WRAPPER yet"), - errdetail("The feature is not currently supported"))); -#endif AlterForeignDataWrapper((AlterFdwStmt*)parse_tree); break; case T_CreateForeignServerStmt: - if (!IsInitdb && IS_SINGLE_NODE && (strcmp(((CreateForeignServerStmt*)parse_tree)->fdwname, MOT_FDW) != 0)) { - ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("Current mode does not support FOREIGN server yet"), - errdetail("The feature is not currently supported"))); - } CreateForeignServer((CreateForeignServerStmt*)parse_tree); #ifdef PGXC if (IS_PGXC_COORDINATOR && !IsConnFromCoord() && !IsInitdb) @@ -2752,32 +2723,14 @@ void standard_ProcessUtility(Node* parse_tree, const char* query_string, ParamLi break; case T_CreateUserMappingStmt: -#ifdef PGXC - ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("Postgres-XC does not support USER MAPPING yet"), - errdetail("The feature is not currently supported"))); -#endif CreateUserMapping((CreateUserMappingStmt*)parse_tree); break; case T_AlterUserMappingStmt: -#ifdef PGXC - ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("Postgres-XC does not support USER MAPPING yet"), - errdetail("The feature is not currently supported"))); -#endif AlterUserMapping((AlterUserMappingStmt*)parse_tree); break; case T_DropUserMappingStmt: -#ifdef PGXC - ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("Postgres-XC does not support USER MAPPING yet"), - errdetail("The feature is not currently supported"))); -#endif RemoveUserMapping((DropUserMappingStmt*)parse_tree); break; @@ -8664,7 +8617,7 @@ bool CheckExtensionInWhiteList(const char* extension_name, uint32 hash_value, bo } } - return false; + return true; } #ifdef ENABLE_MULTIPLE_NODES diff --git a/src/include/Makefile b/src/include/Makefile index bb5ee978b3f286344042271d9ed71b73ec183a63..58e559111fb336a4b571b612f96a8a1b9d572cc4 100755 --- a/src/include/Makefile +++ b/src/include/Makefile @@ -24,9 +24,10 @@ SUBDIRS = bootstrap catalog commands datatype executor foreign lib libpq mb \ port/win32/arpa port/win32/netinet port/win32/sys \ portability \ gtm \ - storage vecexecutor access tsdb \ + storage vecexecutor access access/obs tsdb \ hotpatch\ gstrace\ + knl knl/knl_guc threadpool workload\ # Install all headers install: all installdirs # These headers are needed by the public headers of the interfaces. @@ -48,6 +49,25 @@ install: all installdirs $(INSTALL_DATA) pg_config_os.h '$(DESTDIR)$(includedir_server)' $(INSTALL_DATA) utils/errcodes.h '$(DESTDIR)$(includedir_server)/utils' $(INSTALL_DATA) utils/fmgroids.h '$(DESTDIR)$(includedir_server)/utils' +# These headers are needed by fdw + $(INSTALL_DATA) gssignal/gs_signal.h '$(DESTDIR)$(includedir_server)/gssignal/gs_signal.h' + $(INSTALL_DATA) libcomm/libcomm.h '$(DESTDIR)$(includedir_server)/libcomm/libcomm.h' + $(INSTALL_DATA) cm/etcdapi.h '$(DESTDIR)$(includedir_server)/cm/etcdapi.h' + $(INSTALL_DATA) access/parallel_recovery/redo_item.h '$(DESTDIR)$(includedir_server)/access/parallel_recovery/redo_item.h' + $(INSTALL_DATA) access/parallel_recovery/posix_semaphore.h '$(DESTDIR)$(includedir_server)/access/parallel_recovery/posix_semaphore.h' + $(INSTALL_DATA) access/dfs/dfs_am.h '$(DESTDIR)$(includedir_server)/access/dfs/dfs_am.h' + $(INSTALL_DATA) alarm/alarm.h '$(DESTDIR)$(includedir_server)/alarm/alarm.h' + $(INSTALL_DATA) bulkload/dist_fdw.h '$(DESTDIR)$(includedir_server)/bulkload/dist_fdw.h' + $(INSTALL_DATA) bulkload/importerror.h '$(DESTDIR)$(includedir_server)/bulkload/importerror.h' + $(INSTALL_DATA) bulkload/utils.h '$(DESTDIR)$(includedir_server)/bulkload/utils.h' + $(INSTALL_DATA) ssl/gs_openssl_client.h '$(DESTDIR)$(includedir_server)/ssl/gs_openssl_client.h' + $(INSTALL_DATA) instruments/list.h '$(DESTDIR)$(includedir_server)/instruments/list.h' + $(INSTALL_DATA) instruments/instr_event.h '$(DESTDIR)$(includedir_server)/instruments/instr_event.h' + $(INSTALL_DATA) storage/dfs/dfs_connector.h '$(DESTDIR)$(includedir_server)/storage/dfs/dfs_connector.h' + $(INSTALL_DATA) distributelayer/streamConsumer.h '$(DESTDIR)$(includedir_server)/distributelayer/streamConsumer.h' + $(INSTALL_DATA) distributelayer/streamCore.h '$(DESTDIR)$(includedir_server)/distributelayer/streamCore.h' + $(INSTALL_DATA) distributelayer/streamProducer.h '$(DESTDIR)$(includedir_server)/distributelayer/streamProducer.h' + $(INSTALL_DATA) distributelayer/streamTransportCore.h '$(DESTDIR)$(includedir_server)/distributelayer/streamTransportCore.h' # We don't use INSTALL_DATA for performance reasons --- there are a lot of files cp $(srcdir)/*.h '$(DESTDIR)$(includedir_server)'/ || exit; \ chmod $(INSTALL_DATA_MODE) '$(DESTDIR)$(includedir_server)'/*.h || exit; \ diff --git a/src/include/foreign/foreign.h b/src/include/foreign/foreign.h index 832d0629db4485269ac4bf161de06b8ec9690f1a..2b270f54839c2769dfd9f3280a00d160d85184d6 100644 --- a/src/include/foreign/foreign.h +++ b/src/include/foreign/foreign.h @@ -282,6 +282,9 @@ bool isWriteOnlyFt(Oid relid); #define isMOTTableFromSrvName(srvName) \ (IsSpecifiedFDW(srvName, MOT_FDW)) +#define isMysqlFDWFromTblOid(relId) \ + (IsSpecifiedFDWFromRelid(relId, MYSQL_FDW)) + #define IS_OBS_CSV_TXT_FOREIGN_TABLE(relId) \ (IsSpecifiedFDWFromRelid(relId, DIST_FDW) && (is_obs_protocol(HdfsGetOptionValue(relId, optLocation)))) diff --git a/src/include/postgres.h b/src/include/postgres.h index 6866592ebc81509f7f6ad29752b440196df99c7d..f907032e7c4751549ef66ab29da12aa1dd851482 100644 --- a/src/include/postgres.h +++ b/src/include/postgres.h @@ -74,6 +74,10 @@ #define DIST_FDW "dist_fdw" #endif +#ifndef MYSQL_FDW +#define MYSQL_FDW "mysql_fdw" +#endif + #ifndef MOT_FDW #define MOT_FDW "mot_fdw" #endif diff --git a/src/test/regress/expected/create_view1.out b/src/test/regress/expected/create_view1.out index ea3ff9bef52b3e22fa94022b41fa799fabb0deff..66fa917cddd427d3474ed8c92bb996858d18cd84 100644 --- a/src/test/regress/expected/create_view1.out +++ b/src/test/regress/expected/create_view1.out @@ -18,11 +18,10 @@ CREATE VIEW iexit AS interpt_pp(ih.thepath, r.thepath) AS exit FROM ihighway ih, ramp r WHERE ih.thepath ## r.thepath; -ERROR: function interpt_pp(path, path) does not exist -LINE 3: interpt_pp(ih.thepath, r.thepath) AS exit - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. -CONTEXT: referenced column: exit +ERROR: operator does not exist: path ## path +LINE 5: WHERE ih.thepath ## r.thepath; + ^ +HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. CREATE VIEW toyemp AS SELECT name, age, location, 12*salary AS annualsal FROM emp; diff --git a/src/test/regress/expected/hw_sql_llt.out b/src/test/regress/expected/hw_sql_llt.out index de323244a34fde97d50c5166c1675db836566ffc..63f70a1e4c802d780b42ca96dacf46ab680c800b 100644 --- a/src/test/regress/expected/hw_sql_llt.out +++ b/src/test/regress/expected/hw_sql_llt.out @@ -375,13 +375,13 @@ CREATE OR REPLACE FUNCTION my_union(internal, internal) RETURNS test_func_user.internal AS 'MODULE_PATHNAME' LANGUAGE C STRICT; -ERROR: C/JAVA UDF is not yet supported in current version. +ERROR: type "test_func_user.internal" does not exist set enforce_a_behavior=off; CREATE OR REPLACE FUNCTION my_union(internal, internal) RETURNS test_func_user.internal AS 'MODULE_PATHNAME' LANGUAGE C STRICT; -ERROR: C/JAVA UDF is not yet supported in current version. +ERROR: type "test_func_user.internal" does not exist reset enforce_a_behavior; --function CreateFunction revoke create on schema test_func_user from test_func_user; diff --git a/src/test/regress/output/create_basetype.source b/src/test/regress/output/create_basetype.source index 23fc80247b0596d8becd8eea89287fbe50ee97d4..867499dbe6874f9ab61e22b7490d8e296d63820d 100644 --- a/src/test/regress/output/create_basetype.source +++ b/src/test/regress/output/create_basetype.source @@ -3,22 +3,22 @@ CREATE FUNCTION complex_in(cstring) RETURNS complex AS '@libdir@/regress@DLSUFFIX@','complex_in' LANGUAGE C IMMUTABLE STRICT not fenced; -ERROR: C/JAVA UDF is not yet supported in current version. +NOTICE: return type complex is only a shell CREATE FUNCTION complex_out(complex) RETURNS cstring AS '@libdir@/regress@DLSUFFIX@','complex_out' LANGUAGE C IMMUTABLE STRICT not fenced; -ERROR: C/JAVA UDF is not yet supported in current version. +NOTICE: argument type complex is only a shell CREATE FUNCTION complex_recv(internal) RETURNS complex AS '@libdir@/regress@DLSUFFIX@','complex_recv' LANGUAGE C IMMUTABLE STRICT not fenced; -ERROR: C/JAVA UDF is not yet supported in current version. +NOTICE: return type complex is only a shell CREATE FUNCTION complex_send(complex) RETURNS bytea AS '@libdir@/regress@DLSUFFIX@','complex_send' LANGUAGE C IMMUTABLE STRICT not fenced; -ERROR: C/JAVA UDF is not yet supported in current version. +NOTICE: argument type complex is only a shell CREATE TYPE complex ( internallength = 16, input = complex_in, @@ -27,73 +27,56 @@ CREATE TYPE complex ( send = complex_send, alignment = double ); -ERROR: function complex_in(cstring) does not exist create table t1 ( sk int, a complex, b complex ) WITH (orientation=row); -ERROR: type "complex" is only a shell -LINE 3: a complex, - ^ insert into t1 values(1,'(1,2)','(2,3)'); -ERROR: relation "t1" does not exist on datanode1 -LINE 1: insert into t1 values(1,'(1,2)','(2,3)'); - ^ insert into t1 values(1,'(3,4)','(4,5)'); -ERROR: relation "t1" does not exist on datanode1 -LINE 1: insert into t1 values(1,'(3,4)','(4,5)'); - ^ select * from t1; -ERROR: relation "t1" does not exist on datanode1 -LINE 1: select * from t1; - ^ + sk | a | b +----+-------+------- + 1 | (1,2) | (2,3) + 1 | (3,4) | (4,5) +(2 rows) + create table t1_rep ( sk int, a complex, b complex ) WITH (orientation=row) ; -ERROR: type "complex" is only a shell -LINE 3: a complex, - ^ insert into t1_rep values(1,'(1,2)','(2,3)'); -ERROR: relation "t1_rep" does not exist on datanode1 -LINE 1: insert into t1_rep values(1,'(1,2)','(2,3)'); - ^ insert into t1_rep values(1,'(3,4)','(4,5)'); -ERROR: relation "t1_rep" does not exist on datanode1 -LINE 1: insert into t1_rep values(1,'(3,4)','(4,5)'); - ^ select * from t1_rep; -ERROR: relation "t1_rep" does not exist on datanode1 -LINE 1: select * from t1_rep; - ^ + sk | a | b +----+-------+------- + 1 | (1,2) | (2,3) + 1 | (3,4) | (4,5) +(2 rows) + insert into t1 values(1,'(1,2)','(2,3)'); -ERROR: relation "t1" does not exist on datanode1 -LINE 1: insert into t1 values(1,'(1,2)','(2,3)'); - ^ insert into t1 values(1,'(3,4)','(4,5)'); -ERROR: relation "t1" does not exist on datanode1 -LINE 1: insert into t1 values(1,'(3,4)','(4,5)'); - ^ CREATE FUNCTION test_type(complex) RETURNS complex AS 'select $1;' LANGUAGE SQL; -ERROR: SQL function cannot accept shell type complex call test_type(cast('(1,2)' as complex)); -ERROR: function "test_type" doesn't exist + test_type +----------- + (1,2) +(1 row) + create schema schema1; alter type complex set schema schema1; -ERROR: type "complex" is only a shell create table t1_schema_test1 ( sk int, a complex, b complex ) WITH (orientation=row); -ERROR: type "complex" is only a shell +ERROR: type "complex" does not exist LINE 3: a complex, ^ set current_schema = schema1; @@ -103,22 +86,27 @@ a complex, b complex ) WITH (orientation=row); -ERROR: type "complex" does not exist -LINE 3: a complex, - ^ alter type complex set schema public; -ERROR: type "complex" does not exist set current_schema = public; alter type complex rename to complex_1; -ERROR: type "complex" is only a shell alter type complex_1 rename to complex; -ERROR: type "complex_1" does not exist drop type complex cascade; +NOTICE: drop cascades to 11 other objects +DETAIL: drop cascades to function complex_in(cstring) +drop cascades to function complex_out(complex) +drop cascades to function complex_recv(internal) +drop cascades to function complex_send(complex) +drop cascades to table t1 column a +drop cascades to table t1 column b +drop cascades to table t1_rep column a +drop cascades to table t1_rep column b +drop cascades to function test_type(complex) +drop cascades to table schema1.t1_schema_test2 column a +drop cascades to table schema1.t1_schema_test2 column b drop schema schema1 cascade; +NOTICE: drop cascades to table schema1.t1_schema_test2 drop table t1; -ERROR: table "t1" does not exist drop table t1_rep; -ERROR: table "t1_rep" does not exist \h create type Command: CREATE TYPE Description: define a new data type diff --git a/src/test/regress/output/create_c_function.source b/src/test/regress/output/create_c_function.source index 6855ae1bfde7621d5244a1e7db06572b0726c827..252b193136db59536159dcdfe999ca00b0411666 100644 --- a/src/test/regress/output/create_c_function.source +++ b/src/test/regress/output/create_c_function.source @@ -7,54 +7,59 @@ CREATE FUNCTION vec_int4add_0() RETURNS int4 AS '@abs_srcdir@/regress.so', 'vec_int4add_0' LANGUAGE C IMMUTABLE not fenced; -ERROR: C/JAVA UDF is not yet supported in current version. CREATE FUNCTION vec_int4add_0_strict() RETURNS int4 AS '@abs_srcdir@/regress.so', 'vec_int4add_0' LANGUAGE C strict IMMUTABLE not fenced; -ERROR: C/JAVA UDF is not yet supported in current version. select * from test_vec_int4add where vec_int4add_0() > 0 order by 1,2,3,4; -ERROR: function vec_int4add_0() does not exist -LINE 1: select * from test_vec_int4add where vec_int4add_0() > 0 o... - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. + t1 | t2 | t3 | t4 +----+----+----+---- + 1 | 2 | 3 | 4 + 5 | 6 | 7 | 8 +(2 rows) + select * from test_vec_int4add where vec_int4add_0_strict() > 0 order by 1,2,3,4; -ERROR: function vec_int4add_0_strict() does not exist -LINE 1: select * from test_vec_int4add where vec_int4add_0_strict(... - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. + t1 | t2 | t3 | t4 +----+----+----+---- + 1 | 2 | 3 | 4 + 5 | 6 | 7 | 8 +(2 rows) + CREATE FUNCTION vec_int4add_1(int) RETURNS int4 AS '@abs_srcdir@/regress.so', 'vec_int4add_0' LANGUAGE C IMMUTABLE not fenced; -ERROR: C/JAVA UDF is not yet supported in current version. select * from test_vec_int4add where vec_int4add_1(t1) > 0 order by 1,2,3,4; -ERROR: function vec_int4add_1(integer) does not exist -LINE 1: select * from test_vec_int4add where vec_int4add_1(t1) > 0... - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. + t1 | t2 | t3 | t4 +----+----+----+---- + 1 | 2 | 3 | 4 + 5 | 6 | 7 | 8 +(2 rows) + CREATE FUNCTION vec_int4add_11(int4, int4,int4,int4,int4,int4,int4,int4,int4,int4,int4) RETURNS int4 AS '@abs_srcdir@/regress.so', 'vec_int4add_0' LANGUAGE C IMMUTABLE not fenced; -ERROR: C/JAVA UDF is not yet supported in current version. CREATE FUNCTION vec_int4add_11_strict(int4, int4,int4,int4,int4,int4,int4,int4,int4,int4,int4) RETURNS int4 AS '@abs_srcdir@/regress.so', 'vec_int4add_0' LANGUAGE C strict IMMUTABLE not fenced; -ERROR: C/JAVA UDF is not yet supported in current version. select * from test_vec_int4add where vec_int4add_11(t1,t2,t3,t4,t1,t2,t3,t4,t1,t2,t3) > 0 order by 1,2,3,4; -ERROR: function vec_int4add_11(integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer) does not exist -LINE 1: select * from test_vec_int4add where vec_int4add_11(t1,t2,... - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. + t1 | t2 | t3 | t4 +----+----+----+---- + 1 | 2 | 3 | 4 + 5 | 6 | 7 | 8 +(2 rows) + select * from test_vec_int4add where vec_int4add_11_strict(t1,t2,t3,t4,t1,t2,t3,t4,t1,t2,t3) > 0 order by 1,2,3,4; -ERROR: function vec_int4add_11_strict(integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer) does not exist -LINE 1: select * from test_vec_int4add where vec_int4add_11_strict... - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. + t1 | t2 | t3 | t4 +----+----+----+---- + 1 | 2 | 3 | 4 + 5 | 6 | 7 | 8 +(2 rows) + CREATE FUNCTION vec_int4add_32 (int4,int4,int4,int4,int4,int4,int4,int4 ,int4,int4,int4,int4,int4,int4,int4,int4 @@ -63,7 +68,6 @@ CREATE FUNCTION vec_int4add_32 RETURNS int4 AS '@abs_srcdir@/regress.so', 'vec_int4add_0' LANGUAGE C IMMUTABLE not fenced; -ERROR: C/JAVA UDF is not yet supported in current version. CREATE FUNCTION vec_int4add_32_strict (int4,int4,int4,int4,int4,int4,int4,int4 ,int4,int4,int4,int4,int4,int4,int4,int4 @@ -72,25 +76,28 @@ CREATE FUNCTION vec_int4add_32_strict RETURNS int4 AS '@abs_srcdir@/regress.so', 'vec_int4add_0' LANGUAGE C strict IMMUTABLE not fenced; -ERROR: C/JAVA UDF is not yet supported in current version. select * from test_vec_int4add where vec_int4add_32 (t1,t2,t3,t4,t1,t2,t3,t4 ,t1,t2,t3,t4,t1,t2,t3,t4 ,t1,t2,t3,t4,t1,t2,t3,t4 ,t1,t2,t3,t4,t1,t2,t3,t4) > 0 order by 1,2,3,4; -ERROR: function vec_int4add_32(integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer) does not exist -LINE 1: select * from test_vec_int4add where vec_int4add_32 - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. + t1 | t2 | t3 | t4 +----+----+----+---- + 1 | 2 | 3 | 4 + 5 | 6 | 7 | 8 +(2 rows) + select * from test_vec_int4add where vec_int4add_32 (t1,t2,t3,t4,t1,t2,t3,t4 ,t1,t2,t3,t4,t1,t2,t3,t4 ,t1,t2,t3,t4,t1,t2,t3,t4 ,t1,t2,t3,t4,t1,t2,t3,t4) > 0 order by 1,2,3,4; -ERROR: function vec_int4add_32(integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer) does not exist -LINE 1: select * from test_vec_int4add where vec_int4add_32 - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. + t1 | t2 | t3 | t4 +----+----+----+---- + 1 | 2 | 3 | 4 + 5 | 6 | 7 | 8 +(2 rows) + CREATE FUNCTION vec_int4add_33 (int4,int4,int4,int4,int4,int4,int4,int4 ,int4,int4,int4,int4,int4,int4,int4,int4 @@ -100,52 +107,51 @@ CREATE FUNCTION vec_int4add_33 RETURNS int4 AS '@abs_srcdir@/regress.so', 'vec_int4add_0' LANGUAGE C IMMUTABLE not fenced; -ERROR: C/JAVA UDF is not yet supported in current version. select * from test_vec_int4add where vec_int4add_33 (t1,t2,t3,t4,t1,t2,t3,t4 ,t1,t2,t3,t4,t1,t2,t3,t4 ,t1,t2,t3,t4,t1,t2,t3,t4 ,t1,t2,t3,t4,t1,t2,t3,t4 ,t1) > 0 order by 1,2,3,4; -ERROR: function vec_int4add_33(integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer, integer) does not exist -LINE 1: select * from test_vec_int4add where vec_int4add_33 - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. + t1 | t2 | t3 | t4 +----+----+----+---- + 1 | 2 | 3 | 4 + 5 | 6 | 7 | 8 +(2 rows) + CREATE FUNCTION test_int4add_0() RETURNS int4 AS '@abs_srcdir@/regress.so', 'vec_int4add_0' LANGUAGE C IMMUTABLE not fenced; -ERROR: C/JAVA UDF is not yet supported in current version. CREATE OR REPLACE FUNCTION func(text) RETURNS text AS '@abs_srcdir@/regress.so', 'funcA' LANGUAGE C STABLE not fenced; -ERROR: C/JAVA UDF is not yet supported in current version. CREATE OR REPLACE FUNCTION func(int) RETURNS text AS '@abs_srcdir@/regress.so', 'funcB' LANGUAGE C STABLE not fenced; -ERROR: C/JAVA UDF is not yet supported in current version. select func(1); -ERROR: function func(integer) does not exist -LINE 1: select func(1); - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. -CONTEXT: referenced column: func + func +------- + funcB +(1 row) + select func('1'); -ERROR: function func(unknown) does not exist -LINE 1: select func('1'); - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. -CONTEXT: referenced column: func + func +------- + funcA +(1 row) + CREATE OR REPLACE FUNCTION funcC(int) RETURNS text AS '@abs_srcdir@/regress.so', 'funcC' LANGUAGE C STABLE not fenced; -ERROR: C/JAVA UDF is not yet supported in current version. +WARNING: Function "funcC" is not declared as PG_FUNCTION_INFO_V1() +HINT: SQL-callable C-functions recommends accompanying PG_FUNCTION_INFO_V1(funcC). select funcC(1); -ERROR: function funcc(integer) does not exist -LINE 1: select funcC(1); - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. -CONTEXT: referenced column: funcc + funcc +------- + funcC +(1 row) + --test for enable normal user create c function create user c_function_user1 password 'ttest@123'; create user c_function_user2 password 'ttest@123'; @@ -154,18 +160,16 @@ CREATE OR REPLACE FUNCTION c_function_user1.funcA(text,name) RETURNS tid AS '@abs_srcdir@/regress.so', 'funcA' LANGUAGE C STABLE NOT FENCED; -ERROR: C/JAVA UDF is not yet supported in current version. CREATE OR REPLACE FUNCTION c_function_user2.funcA(text,name) RETURNS tid AS '@abs_srcdir@/regress.so', 'funcA' LANGUAGE C STABLE NOT FENCED; -ERROR: C/JAVA UDF is not yet supported in current version. set role c_function_user1 password 'ttest@123'; CREATE OR REPLACE FUNCTION funcA(text,name) RETURNS tid AS '@abs_srcdir@/regress.so', 'funcA' LANGUAGE C STABLE NOT FENCED; -ERROR: C/JAVA UDF is not yet supported in current version. +ERROR: permission denied for language c grant usage on language c to c_function_user1; ERROR: permission denied for language c reset role; @@ -188,12 +192,10 @@ CREATE OR REPLACE FUNCTION funcA(text,name) RETURNS tid AS '@abs_srcdir@/regress.so', 'funcA' LANGUAGE C STABLE NOT FENCED; -ERROR: C/JAVA UDF is not yet supported in current version. CREATE OR REPLACE FUNCTION c_function_user2.funcA(text,name) RETURNS tid AS '@abs_srcdir@/regress.so', 'funcA' LANGUAGE C STABLE NOT FENCED; -ERROR: C/JAVA UDF is not yet supported in current version. reset role; select proname,proowner,rolname from pg_proc a inner join pg_authid b on a.proowner = b.oid where proname = 'funcA'; proname | proowner | rolname @@ -221,4 +223,17 @@ select has_language_privilege('c_function_user2','c','USAGE'); drop user c_function_user1 cascade; drop user c_function_user2 cascade; drop schema vec_function_call cascade; -NOTICE: drop cascades to table test_vec_int4add +NOTICE: drop cascades to 13 other objects +DETAIL: drop cascades to table test_vec_int4add +drop cascades to function vec_int4add_0() +drop cascades to function vec_int4add_0_strict() +drop cascades to function vec_int4add_1(integer) +drop cascades to function vec_int4add_11(integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer) +drop cascades to function vec_int4add_11_strict(integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer) +drop cascades to function vec_int4add_32(integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer) +drop cascades to function vec_int4add_32_strict(integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer) +drop cascades to function vec_int4add_33(integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer,integer) +drop cascades to function test_int4add_0() +drop cascades to function func(text) +drop cascades to function func(integer) +drop cascades to function funcc(integer) diff --git a/src/test/regress/output/create_function_1.source b/src/test/regress/output/create_function_1.source index d14b4a4389d180c5c8b4be0c84baa3d2c1fcab8d..f44be820eb5a13e23539bfb613f7a76f11e9f9e7 100644 --- a/src/test/regress/output/create_function_1.source +++ b/src/test/regress/output/create_function_1.source @@ -5,57 +5,50 @@ CREATE FUNCTION widget_in(cstring) RETURNS widget AS '@libdir@/regress@DLSUFFIX@' LANGUAGE C STRICT NOT FENCED; -ERROR: C/JAVA UDF is not yet supported in current version. +ERROR: type "widget" does not exist CREATE FUNCTION widget_out(widget) RETURNS cstring AS '@libdir@/regress@DLSUFFIX@' LANGUAGE C STRICT NOT FENCED; -ERROR: C/JAVA UDF is not yet supported in current version. +ERROR: type widget does not exist CREATE FUNCTION int44in(cstring) RETURNS city_budget AS '@libdir@/regress@DLSUFFIX@' LANGUAGE C STRICT NOT FENCED; -ERROR: C/JAVA UDF is not yet supported in current version. +ERROR: type "city_budget" does not exist CREATE FUNCTION int44out(city_budget) RETURNS cstring AS '@libdir@/regress@DLSUFFIX@' LANGUAGE C STRICT NOT FENCED; -ERROR: C/JAVA UDF is not yet supported in current version. +ERROR: type city_budget does not exist CREATE FUNCTION check_primary_key () RETURNS trigger AS '@libdir@/refint@DLSUFFIX@' LANGUAGE C NOT FENCED; -ERROR: C/JAVA UDF is not yet supported in current version. CREATE FUNCTION check_foreign_key () RETURNS trigger AS '@libdir@/refint@DLSUFFIX@' LANGUAGE C NOT FENCED; -ERROR: C/JAVA UDF is not yet supported in current version. CREATE FUNCTION autoinc () RETURNS trigger AS '@libdir@/autoinc@DLSUFFIX@' LANGUAGE C NOT FENCED; -ERROR: C/JAVA UDF is not yet supported in current version. CREATE FUNCTION funny_dup17 () RETURNS trigger AS '@libdir@/regress@DLSUFFIX@' LANGUAGE C NOT FENCED; -ERROR: C/JAVA UDF is not yet supported in current version. CREATE FUNCTION ttdummy () RETURNS trigger AS '@libdir@/regress@DLSUFFIX@' LANGUAGE C NOT FENCED; -ERROR: C/JAVA UDF is not yet supported in current version. CREATE FUNCTION set_ttdummy (int4) RETURNS int4 AS '@libdir@/regress@DLSUFFIX@' LANGUAGE C STRICT NOT FENCED; -ERROR: C/JAVA UDF is not yet supported in current version. CREATE FUNCTION test_atomic_ops() RETURNS bool AS '@libdir@/regress@DLSUFFIX@' LANGUAGE C STRICT NOT FENCED; -ERROR: C/JAVA UDF is not yet supported in current version. -- Things that shouldn't work: CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL AS 'SELECT ''not an integer'';'; @@ -82,10 +75,10 @@ CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL ERROR: only one AS item needed for language "sql" CREATE FUNCTION test1 (int) RETURNS int LANGUAGE C AS 'nosuchfile'; -ERROR: C/JAVA UDF is not yet supported in current version. +ERROR: could not access file "nosuchfile": No such file or directory CREATE FUNCTION test1 (int) RETURNS int LANGUAGE C AS '@libdir@/regress@DLSUFFIX@', 'nosuchsymbol' NOT FENCED; -ERROR: C/JAVA UDF is not yet supported in current version. +--?ERROR: could not find function "nosuchsymbol" in file "@libdir@/.*regress@DLSUFFIX@" CREATE FUNCTION test1 (int) RETURNS int LANGUAGE internal AS 'nosuch'; ERROR: there is no built-in function named "nosuch" diff --git a/src/test/regress/output/misc.source b/src/test/regress/output/misc.source index eb355c80b61c4149a76aeee9c83fc3eed0d79585..035dcda6b0529ef5204e5b62e3fd45efdae044bc 100644 --- a/src/test/regress/output/misc.source +++ b/src/test/regress/output/misc.source @@ -27,21 +27,11 @@ UPDATE tmp FROM onek WHERE onek.stringu1 = 'JBAAAA' and onek.stringu1 = tmp.stringu1; -ERROR: function reverse_name(name) does not exist -LINE 2: SET stringu1 = reverse_name(onek.stringu1) - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. -CONTEXT: referenced column: stringu1 UPDATE tmp SET stringu1 = reverse_name(onek2.stringu1) FROM onek2 WHERE onek2.stringu1 = 'JCAAAA' and onek2.stringu1 = tmp.stringu1; -ERROR: function reverse_name(name) does not exist -LINE 2: SET stringu1 = reverse_name(onek2.stringu1) - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. -CONTEXT: referenced column: stringu1 DROP TABLE tmp; --UPDATE person* -- SET age = age + 1; @@ -388,30 +378,30 @@ SELECT user_relns() AS user_relns onek onek2 person - pg_cudesc_17900 - pg_cudesc_part_17746 - pg_cudesc_part_17747 - pg_cudesc_part_17748 - pg_cudesc_part_17749 - pg_cudesc_part_17750 - pg_cudesc_part_17751 - pg_cudesc_part_17752 - pg_cudesc_part_17753 - pg_cudesc_part_17754 - pg_cudesc_part_17755 - pg_cudesc_part_17756 - pg_delta_17900 - pg_delta_part_17746 - pg_delta_part_17747 - pg_delta_part_17748 - pg_delta_part_17749 - pg_delta_part_17750 - pg_delta_part_17751 - pg_delta_part_17752 - pg_delta_part_17753 - pg_delta_part_17754 - pg_delta_part_17755 - pg_delta_part_17756 + pg_cudesc_17913 + pg_cudesc_part_17759 + pg_cudesc_part_17760 + pg_cudesc_part_17761 + pg_cudesc_part_17762 + pg_cudesc_part_17763 + pg_cudesc_part_17764 + pg_cudesc_part_17765 + pg_cudesc_part_17766 + pg_cudesc_part_17767 + pg_cudesc_part_17768 + pg_cudesc_part_17769 + pg_delta_17913 + pg_delta_part_17759 + pg_delta_part_17760 + pg_delta_part_17761 + pg_delta_part_17762 + pg_delta_part_17763 + pg_delta_part_17764 + pg_delta_part_17765 + pg_delta_part_17766 + pg_delta_part_17767 + pg_delta_part_17768 + pg_delta_part_17769 ramp real_city road @@ -487,11 +477,13 @@ SELECT person as hobbies_by_name from hobbies_r where name = 'basketball' order (2 rows) SELECT name, overpaid(emp.*) FROM emp ORDER BY 1,2; -ERROR: function overpaid(emp) does not exist -LINE 1: SELECT name, overpaid(emp.*) FROM emp ORDER BY 1,2; - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. -CONTEXT: referenced column: overpaid + name | overpaid +--------+---------- + bill | t + sam | t + sharon | t +(3 rows) + -- -- Try a few cases with SQL-spec row constructor expressions -- @@ -536,11 +528,14 @@ insert into oldstyle_test values(0,'12'); insert into oldstyle_test values(1000,'12'); insert into oldstyle_test values(0, repeat('x', 50000)); select i, length(t), octet_length(t), oldstyle_length(i,t) from oldstyle_test ORDER BY 1,2,3; -ERROR: function oldstyle_length(integer, text) does not exist -LINE 1: select i, length(t), octet_length(t), oldstyle_length(i,t) f... - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. -CONTEXT: referenced column: oldstyle_length + i | length | octet_length | oldstyle_length +------+--------+--------------+----------------- + 0 | 2 | 2 | 822333 + 0 | 50000 | 50000 | 581 + 1000 | 2 | 2 | 823333 + | | | +(4 rows) + drop table oldstyle_test; select pg_terminate_backend(9999999999); WARNING: PID 9999999999 is not a gaussdb server thread diff --git a/src/test/regress/output/single_node_create_function_1.source b/src/test/regress/output/single_node_create_function_1.source index 28aa1154150ad797b4157e898741c5bae6c013e2..27cb085c3e3832d0c56f01dcf1e4a7c33c612a6d 100644 --- a/src/test/regress/output/single_node_create_function_1.source +++ b/src/test/regress/output/single_node_create_function_1.source @@ -5,52 +5,46 @@ CREATE FUNCTION widget_in(cstring) RETURNS widget AS '@libdir@/regress@DLSUFFIX@' LANGUAGE C STRICT; -ERROR: C/JAVA UDF is not yet supported in current version. +ERROR: type "widget" does not exist CREATE FUNCTION widget_out(widget) RETURNS cstring AS '@libdir@/regress@DLSUFFIX@' LANGUAGE C STRICT; -ERROR: C/JAVA UDF is not yet supported in current version. +ERROR: type widget does not exist CREATE FUNCTION int44in(cstring) RETURNS city_budget AS '@libdir@/regress@DLSUFFIX@' LANGUAGE C STRICT; -ERROR: C/JAVA UDF is not yet supported in current version. +ERROR: type "city_budget" does not exist CREATE FUNCTION int44out(city_budget) RETURNS cstring AS '@libdir@/regress@DLSUFFIX@' LANGUAGE C STRICT; -ERROR: C/JAVA UDF is not yet supported in current version. +ERROR: type city_budget does not exist CREATE FUNCTION check_primary_key () RETURNS trigger AS '@libdir@/refint@DLSUFFIX@' LANGUAGE C; -ERROR: C/JAVA UDF is not yet supported in current version. CREATE FUNCTION check_foreign_key () RETURNS trigger AS '@libdir@/refint@DLSUFFIX@' LANGUAGE C; -ERROR: C/JAVA UDF is not yet supported in current version. CREATE FUNCTION autoinc () RETURNS trigger AS '@libdir@/autoinc@DLSUFFIX@' LANGUAGE C; -ERROR: C/JAVA UDF is not yet supported in current version. CREATE FUNCTION funny_dup17 () RETURNS trigger AS '@libdir@/regress@DLSUFFIX@' LANGUAGE C; -ERROR: C/JAVA UDF is not yet supported in current version. CREATE FUNCTION ttdummy () RETURNS trigger AS '@libdir@/regress@DLSUFFIX@' LANGUAGE C; -ERROR: C/JAVA UDF is not yet supported in current version. CREATE FUNCTION set_ttdummy (int4) RETURNS int4 AS '@libdir@/regress@DLSUFFIX@' LANGUAGE C STRICT; -ERROR: C/JAVA UDF is not yet supported in current version. -- Things that shouldn't work: CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL AS 'SELECT ''not an integer'';'; @@ -77,10 +71,10 @@ CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL ERROR: only one AS item needed for language "sql" CREATE FUNCTION test1 (int) RETURNS int LANGUAGE C AS 'nosuchfile'; -ERROR: C/JAVA UDF is not yet supported in current version. +ERROR: could not access file "nosuchfile": No such file or directory CREATE FUNCTION test1 (int) RETURNS int LANGUAGE C AS '@libdir@/regress@DLSUFFIX@', 'nosuchsymbol'; -ERROR: C/JAVA UDF is not yet supported in current version. +--?ERROR: could not find function "nosuchsymbol" in file "@libdir@/.*regress@DLSUFFIX@" CREATE FUNCTION test1 (int) RETURNS int LANGUAGE internal AS 'nosuch'; ERROR: there is no built-in function named "nosuch" diff --git a/src/test/regress/output/single_node_forbidden.source b/src/test/regress/output/single_node_forbidden.source index ee9747c1018429c35e27703e4015b6b5da5606e6..4f782a678535a34203be462bc70f8fb7f0230804 100644 --- a/src/test/regress/output/single_node_forbidden.source +++ b/src/test/regress/output/single_node_forbidden.source @@ -16,7 +16,6 @@ CREATE FUNCTION java_getSystemProperty(VARCHAR) RETURNS VARCHAR AS 'java.lang.System.getProperty' LANGUAGE java NOT FENCED; -ERROR: C/JAVA UDF is not yet supported in current version. CREATE FUNCTION java_getSystemProperty(VARCHAR) RETURNS VARCHAR AS 'java.lang.System.getProperty' diff --git a/src/test/regress/output/temp__3.source b/src/test/regress/output/temp__3.source index b54ac733b4fa2f2c8587f1eb3b5c0be78f2f95cb..83be3c33c53b75a5820882067b71761d6fc56d6a 100644 --- a/src/test/regress/output/temp__3.source +++ b/src/test/regress/output/temp__3.source @@ -2,12 +2,12 @@ CREATE FUNCTION int44in(cstring) RETURNS city_budget AS '@libdir@/regress@DLSUFFIX@' LANGUAGE C STRICT; -ERROR: C/JAVA UDF is not yet supported in current version. +ERROR: type "city_budget" does not exist CREATE FUNCTION int44out(city_budget) RETURNS cstring AS '@libdir@/regress@DLSUFFIX@' LANGUAGE C STRICT; -ERROR: C/JAVA UDF is not yet supported in current version. +ERROR: type city_budget does not exist CREATE TYPE city_budget ( internallength = 16, diff --git a/src/test/regress/output/temp__4.source b/src/test/regress/output/temp__4.source index abeb6edabd3cbc057d9b1212f11e3e4a9b333d6f..c3ae7d409a433338ac85c5085f240581e238acaf 100644 --- a/src/test/regress/output/temp__4.source +++ b/src/test/regress/output/temp__4.source @@ -2,17 +2,15 @@ CREATE FUNCTION pt_in_widget(point, widget) RETURNS bool AS '@libdir@/regress@DLSUFFIX@' LANGUAGE C not fenced; -ERROR: C/JAVA UDF is not yet supported in current version. +ERROR: type widget does not exist CREATE FUNCTION interpt_pp(path, path) RETURNS point AS '@libdir@/regress@DLSUFFIX@' LANGUAGE C not fenced; -ERROR: C/JAVA UDF is not yet supported in current version. CREATE FUNCTION reverse_name(name) RETURNS name AS '@libdir@/regress@DLSUFFIX@' LANGUAGE C not fenced; -ERROR: C/JAVA UDF is not yet supported in current version. CREATE FUNCTION user_relns() RETURNS setof name AS 'select relname @@ -42,7 +40,6 @@ CREATE FUNCTION overpaid(emp) RETURNS bool AS '@libdir@/regress@DLSUFFIX@' LANGUAGE C not fenced; -ERROR: C/JAVA UDF is not yet supported in current version. CREATE FUNCTION equipment(hobbies_r) RETURNS setof equipment_r AS 'select * from equipment_r where hobby = $1.name' @@ -51,7 +48,6 @@ CREATE FUNCTION oldstyle_length(int4, text) RETURNS int4 AS '@libdir@/regress@DLSUFFIX@' LANGUAGE C not fenced; -ERROR: C/JAVA UDF is not yet supported in current version. CREATE FUNCTION equipment_named(hobby hobbies_r) RETURNS setof equipment_r AS 'select * from equipment_r where equipment_r.hobby = equipment_named.hobby.name' diff --git a/src/test/regress/output/udf_crem.source b/src/test/regress/output/udf_crem.source index 6ab030fc134a5c9cf1ac3e15f98cb92d8c9037ff..7ebfe3a3b69879d4f5bff52f1954531be374f145 100644 --- a/src/test/regress/output/udf_crem.source +++ b/src/test/regress/output/udf_crem.source @@ -9,14 +9,12 @@ CREATE OR REPLACE FUNCTION PUBLIC.trunc(int, int) RETURNS int AS '@libdir@/regress@DLSUFFIX@','truncInt' LANGUAGE c IMMUTABLE; -ERROR: C/JAVA UDF is not yet supported in current version. DROP FUNCTION IF EXISTS PUBLIC.trunc(float4, int); NOTICE: function public.trunc(float4,pg_catalog.int4) does not exist, skipping CREATE OR REPLACE FUNCTION PUBLIC.trunc(float4, int) RETURNS float8 AS '@libdir@/regress@DLSUFFIX@','truncFloat' LANGUAGE c IMMUTABLE; -ERROR: C/JAVA UDF is not yet supported in current version. DROP FUNCTION IF EXISTS public.trunc(numeric, int); NOTICE: function public.trunc(pg_catalog.numeric,pg_catalog.int4) does not exist, skipping CREATE OR REPLACE FUNCTION public.trunc(numeric, int default 0) RETURNS numeric @@ -28,42 +26,36 @@ CREATE OR REPLACE FUNCTION PUBLIC.TransDate(varchar(50), int, varchar(50)) RETURNS varchar(50) AS '@libdir@/regress@DLSUFFIX@','TransDate' LANGUAGE c IMMUTABLE; -ERROR: C/JAVA UDF is not yet supported in current version. DROP FUNCTION IF EXISTS PUBLIC.TransTimestamp(varchar(50), int, varchar(50)); NOTICE: function public.transtimestamp(pg_catalog.varchar,pg_catalog.int4,pg_catalog.varchar) does not exist, skipping CREATE OR REPLACE FUNCTION PUBLIC.TransTimestamp(varchar(50), int, varchar(50)) RETURNS varchar(50) AS '@libdir@/regress@DLSUFFIX@','TransTimestamp' LANGUAGE c IMMUTABLE; -ERROR: C/JAVA UDF is not yet supported in current version. DROP FUNCTION IF EXISTS PUBLIC.sign(float4); NOTICE: function public.sign(float4) does not exist, skipping CREATE OR REPLACE FUNCTION PUBLIC.sign(float4) RETURNS int AS '@libdir@/regress@DLSUFFIX@','signf' LANGUAGE c strict IMMUTABLE; -ERROR: C/JAVA UDF is not yet supported in current version. DROP FUNCTION IF EXISTS PUBLIC.sign(int); NOTICE: function public.sign(pg_catalog.int4) does not exist, skipping CREATE OR REPLACE FUNCTION PUBLIC.sign(int) RETURNS int AS '@libdir@/regress@DLSUFFIX@','signi' LANGUAGE c strict IMMUTABLE; -ERROR: C/JAVA UDF is not yet supported in current version. DROP FUNCTION IF EXISTS PUBLIC.rpad(text, numeric, text); NOTICE: function public.rpad(text,pg_catalog.numeric,text) does not exist, skipping CREATE OR REPLACE FUNCTION PUBLIC.rpad(text, numeric, text default ' ') RETURNS text AS '@libdir@/regress@DLSUFFIX@','rpad_f' LANGUAGE c strict IMMUTABLE; -ERROR: C/JAVA UDF is not yet supported in current version. DROP FUNCTION IF EXISTS PUBLIC.round(int, int); NOTICE: function public.round(pg_catalog.int4,pg_catalog.int4) does not exist, skipping CREATE OR REPLACE FUNCTION PUBLIC.round(int, int default 0) RETURNS int AS '@libdir@/regress@DLSUFFIX@','RoundInt' LANGUAGE c strict IMMUTABLE; -ERROR: C/JAVA UDF is not yet supported in current version. DROP FUNCTION IF EXISTS PUBLIC.round(float, int); NOTICE: function public.round(pg_catalog.float8,pg_catalog.int4) does not exist, skipping CREATE OR REPLACE FUNCTION PUBLIC.round(float, int default 0) @@ -87,17 +79,11 @@ CREATE OR REPLACE FUNCTION PUBLIC.NormsDistInner(NUMERIC) RETURNS NUMERIC AS '@libdir@/regress@DLSUFFIX@','normsdist' LANGUAGE c strict IMMUTABLE; -ERROR: C/JAVA UDF is not yet supported in current version. DROP FUNCTION IF EXISTS PUBLIC.NormsDist; NOTICE: function public.normsdist() does not exist, skipping CREATE FUNCTION PUBLIC.NormsDist(NUMERIC(18,15)) RETURNS NUMERIC(18,15) AS 'select public.NormsDistInner($1)::NUMERIC(18,15)' LANGUAGE SQL strict IMMUTABLE; -ERROR: function public.normsdistinner(numeric) does not exist -LINE 2: AS 'select public.NormsDistInner($1)::NUMERIC(18,15)' - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. -CONTEXT: referenced column: normsdistinner -- DROP FUNCTION IF EXISTS PUBLIC.months_between_inner(date, date); NOTICE: function public.months_between_inner(pg_catalog.timestamp,pg_catalog.timestamp) does not exist, skipping @@ -105,99 +91,65 @@ CREATE OR REPLACE FUNCTION PUBLIC.months_between_inner(date, date) RETURNS FLOAT4 AS '@libdir@/regress@DLSUFFIX@','months_between_dd' LANGUAGE c strict IMMUTABLE; -ERROR: C/JAVA UDF is not yet supported in current version. DROP FUNCTION IF EXISTS PUBLIC.months_between(date, date); NOTICE: function public.months_between(pg_catalog.timestamp,pg_catalog.timestamp) does not exist, skipping CREATE OR REPLACE FUNCTION PUBLIC.months_between(date, date) RETURNS NUMERIC(18,2) AS 'select (public.months_between_inner($1, $2)::float)::NUMERIC(18,2)' LANGUAGE SQL strict IMMUTABLE; -ERROR: function public.months_between_inner(timestamp without time zone, timestamp without time zone) does not exist -LINE 2: AS 'select (public.months_between_inner($1, $2)::float):... - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. -CONTEXT: referenced column: months_between_inner -- DROP FUNCTION IF EXISTS PUBLIC.months_between_inner(date, timestamp); -NOTICE: function public.months_between_inner(pg_catalog.timestamp,pg_catalog.timestamp) does not exist, skipping CREATE OR REPLACE FUNCTION PUBLIC.months_between_inner(date, timestamp) RETURNS FLOAT4 AS '@libdir@/regress@DLSUFFIX@','months_between_dt' LANGUAGE c strict IMMUTABLE; -ERROR: C/JAVA UDF is not yet supported in current version. DROP FUNCTION IF EXISTS PUBLIC.months_between(date, timestamp); -NOTICE: function public.months_between(pg_catalog.timestamp,pg_catalog.timestamp) does not exist, skipping CREATE OR REPLACE FUNCTION PUBLIC.months_between(date, timestamp) RETURNS NUMERIC(18,2) AS 'select (public.months_between_inner($1, $2)::float)::NUMERIC(18,2)' LANGUAGE SQL strict IMMUTABLE; -ERROR: function public.months_between_inner(timestamp without time zone, timestamp without time zone) does not exist -LINE 2: AS 'select (public.months_between_inner($1, $2)::float):... - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. -CONTEXT: referenced column: months_between_inner -- DROP FUNCTION IF EXISTS PUBLIC.months_between_inner(timestamp, date); -NOTICE: function public.months_between_inner(pg_catalog.timestamp,pg_catalog.timestamp) does not exist, skipping CREATE OR REPLACE FUNCTION PUBLIC.months_between_inner(timestamp, date) RETURNS FLOAT4 AS '@libdir@/regress@DLSUFFIX@','months_between_td' LANGUAGE c strict IMMUTABLE; -ERROR: C/JAVA UDF is not yet supported in current version. DROP FUNCTION IF EXISTS PUBLIC.months_between(timestamp, date); -NOTICE: function public.months_between(pg_catalog.timestamp,pg_catalog.timestamp) does not exist, skipping CREATE OR REPLACE FUNCTION PUBLIC.months_between(timestamp, date) RETURNS NUMERIC(18,2) AS 'select (public.months_between_inner($1, $2)::float)::NUMERIC(18,2)' LANGUAGE SQL strict IMMUTABLE; -ERROR: function public.months_between_inner(timestamp without time zone, timestamp without time zone) does not exist -LINE 2: AS 'select (public.months_between_inner($1, $2)::float):... - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. -CONTEXT: referenced column: months_between_inner -- DROP FUNCTION IF EXISTS PUBLIC.months_between_inner(timestamp, timestamp); -NOTICE: function public.months_between_inner(pg_catalog.timestamp,pg_catalog.timestamp) does not exist, skipping CREATE OR REPLACE FUNCTION PUBLIC.months_between_inner(timestamp, timestamp) RETURNS FLOAT4 AS '@libdir@/regress@DLSUFFIX@','months_between_tt' LANGUAGE c strict IMMUTABLE; -ERROR: C/JAVA UDF is not yet supported in current version. DROP FUNCTION IF EXISTS PUBLIC.months_between(timestamp, timestamp); -NOTICE: function public.months_between(pg_catalog.timestamp,pg_catalog.timestamp) does not exist, skipping CREATE OR REPLACE FUNCTION PUBLIC.months_between(timestamp, timestamp) RETURNS NUMERIC(18,2) AS 'select (public.months_between_inner($1, $2)::float)::NUMERIC(18,2)' LANGUAGE SQL strict IMMUTABLE; -ERROR: function public.months_between_inner(timestamp without time zone, timestamp without time zone) does not exist -LINE 2: AS 'select (public.months_between_inner($1, $2)::float):... - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. -CONTEXT: referenced column: months_between_inner DROP FUNCTION IF EXISTS PUBLIC.lpad(text, numeric, text); NOTICE: function public.lpad(text,pg_catalog.numeric,text) does not exist, skipping CREATE OR REPLACE FUNCTION PUBLIC.lpad(text, numeric, text default ' ') RETURNS text AS '@libdir@/regress@DLSUFFIX@','lpad_f' LANGUAGE c strict IMMUTABLE; -ERROR: C/JAVA UDF is not yet supported in current version. DROP FUNCTION IF EXISTS public.FUNC_III_CS0507_3; NOTICE: function public.func_iii_cs0507_3() does not exist, skipping CREATE FUNCTION FUNC_III_CS0507_3(in NUMERIC(18,4)) returns text as '@libdir@/regress@DLSUFFIX@','FUNC_III_CS0507_3' language c IMMUTABLE; -ERROR: C/JAVA UDF is not yet supported in current version. DROP FUNCTION IF EXISTS public.FUNC_III_CS0507; NOTICE: function public.func_iii_cs0507() does not exist, skipping CREATE FUNCTION FUNC_III_CS0507(in NUMERIC(18,4)) returns text as '@libdir@/regress@DLSUFFIX@','FUNC_III_CS0507' language c IMMUTABLE; -ERROR: C/JAVA UDF is not yet supported in current version. DROP FUNCTION IF EXISTS public.FUNC_II_JUDGE_DF_AGE; NOTICE: function public.func_ii_judge_df_age() does not exist, skipping CREATE FUNCTION FUNC_II_JUDGE_DF_AGE(in NUMERIC(18,4), in NUMERIC(18,4), in NUMERIC(18,4), in NUMERIC(18,4), in NUMERIC(18,4), in NUMERIC(18,4), in NUMERIC(18,4), in NUMERIC(18,4), in NUMERIC(18,4), in NUMERIC(18,4), in NUMERIC(18,4), in NUMERIC(18,4)) returns int as '@libdir@/regress@DLSUFFIX@','FUNC_II_JUDGE_DF_AGE' language c IMMUTABLE; -ERROR: C/JAVA UDF is not yet supported in current version. -- FUNC_TRANS_MOBCODE DROP FUNCTION IF EXISTS public.FUNC_TRANS_MOBCODE; NOTICE: function public.func_trans_mobcode() does not exist, skipping @@ -205,7 +157,6 @@ CREATE FUNCTION FUNC_TRANS_MOBCODE(in NUMERIC(18,4)) returns text as '@libdir@/regress@DLSUFFIX@','FUNC_TRANS_MOBCODE' language c IMMUTABLE; -ERROR: C/JAVA UDF is not yet supported in current version. -- FUNC_TRANS_RISKCODE DROP FUNCTION IF EXISTS public.FUNC_TRANS_RISKCODE; NOTICE: function public.func_trans_riskcode() does not exist, skipping @@ -213,7 +164,6 @@ CREATE FUNCTION FUNC_TRANS_RISKCODE(in text, in NUMERIC(18,4)) returns text as '@libdir@/regress@DLSUFFIX@','FUNC_TRANS_RISKCODE' language c IMMUTABLE; -ERROR: C/JAVA UDF is not yet supported in current version. -- FUNC_XW_FIX_DPD DROP FUNCTION IF EXISTS public.FUNC_XW_FIX_DPD; NOTICE: function public.func_xw_fix_dpd() does not exist, skipping @@ -221,7 +171,6 @@ CREATE FUNCTION FUNC_XW_FIX_DPD(in text, in NUMERIC(18,4)) returns int as '@libdir@/regress@DLSUFFIX@','FUNC_XW_FIX_DPD' language c IMMUTABLE; -ERROR: C/JAVA UDF is not yet supported in current version. -- FUNC_ZERO_NULL DROP FUNCTION IF EXISTS public.FUNC_ZERO_NULL; NOTICE: function public.func_zero_null() does not exist, skipping @@ -229,36 +178,23 @@ CREATE FUNCTION FUNC_ZERO_NULL(in NUMERIC(18,4)) returns NUMERIC(18,4) as '@libdir@/regress@DLSUFFIX@','FUNC_ZERO_NULL' language c strict IMMUTABLE; -ERROR: C/JAVA UDF is not yet supported in current version. DROP FUNCTION IF EXISTS PUBLIC.trunc(int); DROP FUNCTION IF EXISTS PUBLIC.trunc(int, int); -NOTICE: function public.trunc(pg_catalog.int4,pg_catalog.int4) does not exist, skipping DROP FUNCTION IF EXISTS PUBLIC.trunc(float4, int); -NOTICE: function public.trunc(float4,pg_catalog.int4) does not exist, skipping DROP FUNCTION IF EXISTS public.trunc(numeric, int); DROP FUNCTION IF EXISTS PUBLIC.TransDate(varchar(50), int, varchar(50)); -NOTICE: function public.transdate(pg_catalog.varchar,pg_catalog.int4,pg_catalog.varchar) does not exist, skipping DROP FUNCTION IF EXISTS PUBLIC.TransTimestamp(varchar(50), int, varchar(50)); -NOTICE: function public.transtimestamp(pg_catalog.varchar,pg_catalog.int4,pg_catalog.varchar) does not exist, skipping DROP FUNCTION IF EXISTS PUBLIC.sign(float4); -NOTICE: function public.sign(float4) does not exist, skipping DROP FUNCTION IF EXISTS PUBLIC.sign(int); -NOTICE: function public.sign(pg_catalog.int4) does not exist, skipping DROP FUNCTION IF EXISTS PUBLIC.rpad(text, numeric, text); -NOTICE: function public.rpad(text,pg_catalog.numeric,text) does not exist, skipping DROP FUNCTION IF EXISTS PUBLIC.round(int, int); -NOTICE: function public.round(pg_catalog.int4,pg_catalog.int4) does not exist, skipping DROP FUNCTION IF EXISTS PUBLIC.round(float, int); DROP FUNCTION IF EXISTS PUBLIC.round(numeric, int); DROP FUNCTION IF EXISTS PUBLIC.oreplace; DROP FUNCTION IF EXISTS PUBLIC.NormsDistInner; -NOTICE: function public.normsdistinner() does not exist, skipping DROP FUNCTION IF EXISTS PUBLIC.NormsDist; -NOTICE: function public.normsdist() does not exist, skipping DROP FUNCTION IF EXISTS PUBLIC.months_between_inner(date, date); -NOTICE: function public.months_between_inner(pg_catalog.timestamp,pg_catalog.timestamp) does not exist, skipping DROP FUNCTION IF EXISTS PUBLIC.months_between(date, date); -NOTICE: function public.months_between(pg_catalog.timestamp,pg_catalog.timestamp) does not exist, skipping DROP FUNCTION IF EXISTS PUBLIC.months_between_inner(date, timestamp); NOTICE: function public.months_between_inner(pg_catalog.timestamp,pg_catalog.timestamp) does not exist, skipping DROP FUNCTION IF EXISTS PUBLIC.months_between(date, timestamp); @@ -272,7 +208,6 @@ NOTICE: function public.months_between_inner(pg_catalog.timestamp,pg_catalog.ti DROP FUNCTION IF EXISTS PUBLIC.months_between(timestamp, timestamp); NOTICE: function public.months_between(pg_catalog.timestamp,pg_catalog.timestamp) does not exist, skipping DROP FUNCTION IF EXISTS PUBLIC.lpad(text, numeric, text); -NOTICE: function public.lpad(text,pg_catalog.numeric,text) does not exist, skipping DROP FUNCTION IF EXISTS PUBLIC.FUNC_JUDGE_ACC; NOTICE: function public.func_judge_acc() does not exist, skipping DROP FUNCTION IF EXISTS PUBLIC.FUNC_GREAST_MOB24; @@ -376,11 +311,8 @@ NOTICE: function public.func_iii_cs0507_2() does not exist, skipping DROP FUNCTION IF EXISTS public.FUNC_II_GREAST_VAR_MOB12; NOTICE: function public.func_ii_greast_var_mob12() does not exist, skipping DROP FUNCTION IF EXISTS public.FUNC_III_CS0507_3; -NOTICE: function public.func_iii_cs0507_3() does not exist, skipping DROP FUNCTION IF EXISTS public.FUNC_III_CS0507; -NOTICE: function public.func_iii_cs0507() does not exist, skipping DROP FUNCTION IF EXISTS public.FUNC_II_JUDGE_DF_AGE; -NOTICE: function public.func_ii_judge_df_age() does not exist, skipping DROP FUNCTION IF EXISTS public.FUNC_II_LEAST_CL_MOB6; NOTICE: function public.func_ii_least_cl_mob6() does not exist, skipping DROP FUNCTION IF EXISTS public.FUNC_II_LEAST_MOB12; @@ -448,10 +380,6 @@ NOTICE: function public.func_sum_mob9() does not exist, skipping DROP FUNCTION IF EXISTS public.FUNC_SUM_MOB12; NOTICE: function public.func_sum_mob12() does not exist, skipping DROP FUNCTION IF EXISTS public.FUNC_TRANS_MOBCODE; -NOTICE: function public.func_trans_mobcode() does not exist, skipping DROP FUNCTION IF EXISTS public.FUNC_TRANS_RISKCODE; -NOTICE: function public.func_trans_riskcode() does not exist, skipping DROP FUNCTION IF EXISTS public.FUNC_XW_FIX_DPD; -NOTICE: function public.func_xw_fix_dpd() does not exist, skipping DROP FUNCTION IF EXISTS public.FUNC_ZERO_NULL; -NOTICE: function public.func_zero_null() does not exist, skipping diff --git a/third_party/dependency/mysql_fdw/huawei_mysql_fdw-2.5.3_patch.patch b/third_party/dependency/mysql_fdw/huawei_mysql_fdw-2.5.3_patch.patch new file mode 100644 index 0000000000000000000000000000000000000000..70fe628c1f21dec8ec29a23e4b69c3b97683ea72 --- /dev/null +++ b/third_party/dependency/mysql_fdw/huawei_mysql_fdw-2.5.3_patch.patch @@ -0,0 +1,743 @@ +diff --git a/code/mysql_fdw-REL-2_5_3/Makefile b/code/mysql_fdw-REL-2_5_3/Makefile +index d5e7b36..157a6cf 100644 +--- a/code/mysql_fdw-REL-2_5_3/Makefile ++++ b/code/mysql_fdw-REL-2_5_3/Makefile +@@ -31,6 +31,8 @@ else + MYSQL_LIB = mysqlclient + endif + ++MYSQL_LIB = mariadb ++ + UNAME = uname + OS := $(shell $(UNAME)) + ifeq ($(OS), Darwin) +@@ -39,7 +41,7 @@ else + DLSUFFIX = .so + endif + +-PG_CPPFLAGS += -D _MYSQL_LIBNAME=\"lib$(MYSQL_LIB)$(DLSUFFIX)\" ++PG_CPPFLAGS += -D _MYSQL_LIBNAME=\"lib$(MYSQL_LIB)$(DLSUFFIX)\" -Wno-parentheses + + ifdef USE_PGXS + PG_CONFIG = pg_config +@@ -48,8 +50,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.2 9.3 9.4 9.5 9.6 10 11 12)) ++$(error PostgreSQL 9.2 9.3, 9.4, 9.5, 9.6 10 11 12 is required to compile this extension) + endif + + else +diff --git a/code/mysql_fdw-REL-2_5_3/connection.cpp b/code/mysql_fdw-REL-2_5_3/connection.cpp +index 6b18027..0a9e40f 100644 +--- a/code/mysql_fdw-REL-2_5_3/connection.cpp ++++ b/code/mysql_fdw-REL-2_5_3/connection.cpp +@@ -22,6 +22,7 @@ + #include "utils/hsearch.h" + #include "utils/memutils.h" + #include "utils/resowner.h" ++#include "storage/ipc.h" + + /* Length of host */ + #define HOST_LEN 256 +@@ -48,8 +49,13 @@ typedef struct ConnCacheEntry + /* + * Connection cache (initialized on first use) + */ +-static HTAB *ConnectionHash = NULL; ++static THR_LOCAL HTAB *ConnectionHash = NULL; + ++static void ++mysql_fdw_exit(int code, Datum arg) ++{ ++ mysql_cleanup_connection(); ++} + /* + * mysql_get_connection: + * Get a connection which can be used to execute queries on +@@ -73,10 +79,11 @@ mysql_get_connection(ForeignServer *server, UserMapping *user, mysql_opt *opt) + ctl.hash = tag_hash; + + /* allocate ConnectionHash in the cache context */ +- ctl.hcxt = CacheMemoryContext; ++ ctl.hcxt = u_sess->cache_mem_cxt; + ConnectionHash = hash_create("mysql_fdw connections", 8, + &ctl, + HASH_ELEM | HASH_FUNCTION | HASH_CONTEXT); ++ on_proc_exit(&mysql_fdw_exit, PointerGetDatum(NULL)); + } + + /* Create hash key for the entry. Assume no pad bytes in key struct */ +@@ -86,7 +93,7 @@ mysql_get_connection(ForeignServer *server, UserMapping *user, mysql_opt *opt) + /* + * Find or create cached entry for requested connection. + */ +- entry = hash_search(ConnectionHash, &key, HASH_ENTER, &found); ++ entry = (ConnCacheEntry*)hash_search(ConnectionHash, &key, HASH_ENTER, &found); + if (!found) + { + /* initialize new hashtable entry (key is already filled in) */ +@@ -137,6 +144,9 @@ mysql_cleanup_connection(void) + _mysql_close(entry->conn); + entry->conn = NULL; + } ++ /* clean-up memory */ ++ hash_destroy(ConnectionHash); ++ ConnectionHash = NULL; + } + + /* +diff --git a/code/mysql_fdw-REL-2_5_3/deparse.cpp b/code/mysql_fdw-REL-2_5_3/deparse.cpp +index a75c270..94b1799 100644 +--- a/code/mysql_fdw-REL-2_5_3/deparse.cpp ++++ b/code/mysql_fdw-REL-2_5_3/deparse.cpp +@@ -20,7 +20,7 @@ + #include "pgtime.h" + + #include "access/heapam.h" +-#include "access/htup_details.h" ++#include "access/htup.h" + #include "access/sysattr.h" + #include "access/transam.h" + #include "catalog/pg_collation.h" +@@ -169,7 +169,7 @@ mysql_deparse_relation(StringInfo buf, Relation rel) + static char * + mysql_quote_identifier(const char *s , char q) + { +- char *result = palloc(strlen(s) * 2 + 3); ++ char *result = (char*)palloc(strlen(s) * 2 + 3); + char *r = result; + + *r++ = q; +@@ -451,7 +451,7 @@ mysql_deparse_string(StringInfo buf, const char *val, bool isstr) + * Remove '{', '}' and \" character from the string. Because + * this syntax is not recognize by the remote MySQL server. + */ +- if ((ch == '{' && i == 0) || (ch == '}' && (i == (strlen(val) - 1))) || ch == '\"') ++ if ((ch == '{' && i == 0) || (ch == '}' && ((unsigned int)i == (strlen(val) - 1))) || ch == '\"') + continue; + + if (ch == ',' && isstr) +@@ -869,11 +869,11 @@ mysql_deparse_array_ref(SubscriptingRef *node, deparse_expr_cxt *context) + appendStringInfoChar(buf, '['); + if (lowlist_item) + { +- deparseExpr(lfirst(lowlist_item), context); ++ deparseExpr((Expr*)lfirst(lowlist_item), context); + appendStringInfoChar(buf, ':'); + lowlist_item = lnext(lowlist_item); + } +- deparseExpr(lfirst(uplist_item), context); ++ deparseExpr((Expr*)lfirst(uplist_item), context); + appendStringInfoChar(buf, ']'); + } + +@@ -965,7 +965,7 @@ mysql_deparse_op_expr(OpExpr *node, deparse_expr_cxt *context) + if (oprkind == 'r' || oprkind == 'b') + { + arg = list_head(node->args); +- deparseExpr(lfirst(arg), context); ++ deparseExpr((Expr*)lfirst(arg), context); + appendStringInfoChar(buf, ' '); + } + +@@ -977,7 +977,7 @@ mysql_deparse_op_expr(OpExpr *node, deparse_expr_cxt *context) + { + arg = list_tail(node->args); + appendStringInfoChar(buf, ' '); +- deparseExpr(lfirst(arg), context); ++ deparseExpr((Expr*)lfirst(arg), context); + } + + appendStringInfoChar(buf, ')'); +@@ -1056,9 +1056,9 @@ mysql_deparse_distinct_expr(DistinctExpr *node, deparse_expr_cxt *context) + Assert(list_length(node->args) == 2); + + appendStringInfoChar(buf, '('); +- deparseExpr(linitial(node->args), context); ++ deparseExpr((Expr*)linitial(node->args), context); + appendStringInfoString(buf, " IS DISTINCT FROM "); +- deparseExpr(lsecond(node->args), context); ++ deparseExpr((Expr*)lsecond(node->args), context); + appendStringInfoChar(buf, ')'); + } + +@@ -1089,7 +1089,7 @@ mysql_deparse_scalar_array_op_expr(ScalarArrayOpExpr *node, deparse_expr_cxt *co + Assert(list_length(node->args) == 2); + + /* Deparse left operand. */ +- arg1 = linitial(node->args); ++ arg1 = (Expr*)linitial(node->args); + deparseExpr(arg1, context); + appendStringInfoChar(buf, ' '); + +@@ -1101,7 +1101,7 @@ mysql_deparse_scalar_array_op_expr(ScalarArrayOpExpr *node, deparse_expr_cxt *co + appendStringInfo(buf, " IN ("); + + /* Deparse right operand. */ +- arg2 = lsecond(node->args); ++ arg2 = (Expr*)lsecond(node->args); + switch (nodeTag((Node*)arg2)) + { + case T_Const: +@@ -1116,7 +1116,7 @@ mysql_deparse_scalar_array_op_expr(ScalarArrayOpExpr *node, deparse_expr_cxt *co + switch (c->consttype) + { + case INT4ARRAYOID: +- case OIDARRAYOID: ++ // case OIDARRAYOID: + mysql_deparse_string(buf, extval, false); + break; + default: +@@ -1172,7 +1172,7 @@ mysql_deparse_bool_expr(BoolExpr *node, deparse_expr_cxt *context) + break; + case NOT_EXPR: + appendStringInfoString(buf, "(NOT "); +- deparseExpr(linitial(node->args), context); ++ deparseExpr((Expr*)linitial(node->args), context); + appendStringInfoChar(buf, ')'); + return; + } +@@ -1220,7 +1220,7 @@ mysql_deparse_array_expr(ArrayExpr *node, deparse_expr_cxt *context) + { + if (!first) + appendStringInfoString(buf, ", "); +- deparseExpr(lfirst(lc), context); ++ deparseExpr((Expr*)lfirst(lc), context); + first = false; + } + appendStringInfoChar(buf, ']'); +diff --git a/code/mysql_fdw-REL-2_5_3/mysql_fdw.cpp b/code/mysql_fdw-REL-2_5_3/mysql_fdw.cpp +index f1e26c3..49243d1 100644 +--- a/code/mysql_fdw-REL-2_5_3/mysql_fdw.cpp ++++ b/code/mysql_fdw-REL-2_5_3/mysql_fdw.cpp +@@ -53,7 +53,7 @@ + #include "utils/timestamp.h" + #include "utils/formatting.h" + #include "utils/memutils.h" +-#include "access/htup_details.h" ++#include "access/htup.h" + #include "access/sysattr.h" + #include "commands/defrem.h" + #include "commands/explain.h" +@@ -108,15 +108,57 @@ typedef struct MySQLFdwRelationInfo + } MySQLFdwRelationInfo; + + +-extern Datum mysql_fdw_handler(PG_FUNCTION_ARGS); ++extern "C" Datum mysql_fdw_handler(PG_FUNCTION_ARGS); ++extern "C" Datum mysql_fdw_version(PG_FUNCTION_ARGS); + extern PGDLLEXPORT void _PG_init(void); + + bool mysql_load_library(void); +-static void mysql_fdw_exit(int code, Datum arg); + + PG_FUNCTION_INFO_V1(mysql_fdw_handler); + PG_FUNCTION_INFO_V1(mysql_fdw_version); + ++int ((*_mysql_options)(MYSQL *mysql,enum mysql_option option, const void *arg)); ++int ((*_mysql_stmt_execute)(MYSQL_STMT *stmt)); ++int ((*_mysql_stmt_fetch)(MYSQL_STMT *stmt)); ++int ((*_mysql_stmt_prepare)(MYSQL_STMT *stmt, const char *query, unsigned long length)); ++int ((*_mysql_query)(MYSQL *mysql, const char *q)); ++bool ((*_mysql_stmt_attr_set)(MYSQL_STMT *stmt, enum enum_stmt_attr_type attr_type, const void *attr)); ++bool ((*_mysql_stmt_close)(MYSQL_STMT * stmt)); ++bool ((*_mysql_stmt_reset)(MYSQL_STMT * stmt)); ++bool ((*_mysql_free_result)(MYSQL_RES *result)); ++bool ((*_mysql_stmt_bind_param)(MYSQL_STMT *stmt, MYSQL_BIND * bnd)); ++bool ((*_mysql_stmt_bind_result)(MYSQL_STMT *stmt, MYSQL_BIND * bnd)); ++ ++MYSQL_STMT *((*_mysql_stmt_init)(MYSQL *mysql)); ++MYSQL_RES *((*_mysql_stmt_result_metadata)(MYSQL_STMT *stmt)); ++int ((*_mysql_stmt_store_result)(MYSQL *mysql)); ++MYSQL_ROW ((*_mysql_fetch_row)(MYSQL_RES *result)); ++MYSQL_FIELD *((*_mysql_fetch_field)(MYSQL_RES *result)); ++MYSQL_FIELD *((*_mysql_fetch_fields)(MYSQL_RES *result)); ++const char *((*_mysql_error)(MYSQL *mysql)); ++void ((*_mysql_close)(MYSQL *sock)); ++MYSQL_RES* ((*_mysql_store_result)(MYSQL *mysql)); ++ ++MYSQL *((*_mysql_init)(MYSQL *mysql)); ++bool ((*_mysql_ssl_set)(MYSQL *mysql, const char *key, const char *cert, const char *ca, const char *capath, const char *cipher)); ++MYSQL *((*_mysql_real_connect)(MYSQL *mysql, ++ const char *host, ++ const char *user, ++ const char *passwd, ++ const char *db, ++ unsigned int port, ++ const char *unix_socket, ++ unsigned long clientflag)); ++ ++const char *((*_mysql_get_host_info)(MYSQL *mysql)); ++const char *((*_mysql_get_server_info)(MYSQL *mysql)); ++int ((*_mysql_get_proto_info)(MYSQL *mysql)); ++ ++unsigned int ((*_mysql_stmt_errno)(MYSQL_STMT *stmt)); ++unsigned int ((*_mysql_errno)(MYSQL *mysql)); ++unsigned int ((*_mysql_num_fields)(MYSQL_RES *result)); ++unsigned int ((*_mysql_num_rows)(MYSQL_RES *result)); ++ + /* + * FDW callback routines + */ +@@ -219,36 +261,36 @@ mysql_load_library(void) + if(mysql_dll_handle == NULL) + return false; + +- _mysql_stmt_bind_param = dlsym(mysql_dll_handle, "mysql_stmt_bind_param"); +- _mysql_stmt_bind_result = dlsym(mysql_dll_handle, "mysql_stmt_bind_result"); +- _mysql_stmt_init = dlsym(mysql_dll_handle, "mysql_stmt_init"); +- _mysql_stmt_prepare = dlsym(mysql_dll_handle, "mysql_stmt_prepare"); +- _mysql_stmt_execute = dlsym(mysql_dll_handle, "mysql_stmt_execute"); +- _mysql_stmt_fetch = dlsym(mysql_dll_handle, "mysql_stmt_fetch"); +- _mysql_query = dlsym(mysql_dll_handle, "mysql_query"); +- _mysql_stmt_result_metadata = dlsym(mysql_dll_handle, "mysql_stmt_result_metadata"); +- _mysql_stmt_store_result = dlsym(mysql_dll_handle, "mysql_stmt_store_result"); +- _mysql_fetch_row = dlsym(mysql_dll_handle, "mysql_fetch_row"); +- _mysql_fetch_field = dlsym(mysql_dll_handle, "mysql_fetch_field"); +- _mysql_fetch_fields = dlsym(mysql_dll_handle, "mysql_fetch_fields"); +- _mysql_stmt_close = dlsym(mysql_dll_handle, "mysql_stmt_close"); +- _mysql_stmt_reset = dlsym(mysql_dll_handle, "mysql_stmt_reset"); +- _mysql_free_result = dlsym(mysql_dll_handle, "mysql_free_result"); +- _mysql_error = dlsym(mysql_dll_handle, "mysql_error"); +- _mysql_options = dlsym(mysql_dll_handle, "mysql_options"); +- _mysql_ssl_set = dlsym(mysql_dll_handle, "mysql_ssl_set"); +- _mysql_real_connect = dlsym(mysql_dll_handle, "mysql_real_connect"); +- _mysql_close = dlsym(mysql_dll_handle, "mysql_close"); +- _mysql_init = dlsym(mysql_dll_handle, "mysql_init"); +- _mysql_stmt_attr_set = dlsym(mysql_dll_handle, "mysql_stmt_attr_set"); +- _mysql_store_result = dlsym(mysql_dll_handle, "mysql_store_result"); +- _mysql_stmt_errno = dlsym(mysql_dll_handle, "mysql_stmt_errno"); +- _mysql_errno = dlsym(mysql_dll_handle, "mysql_errno"); +- _mysql_num_fields = dlsym(mysql_dll_handle, "mysql_num_fields"); +- _mysql_num_rows = dlsym(mysql_dll_handle, "mysql_num_rows"); +- _mysql_get_host_info = dlsym(mysql_dll_handle, "mysql_get_host_info"); +- _mysql_get_server_info = dlsym(mysql_dll_handle, "mysql_get_server_info"); +- _mysql_get_proto_info = dlsym(mysql_dll_handle, "mysql_get_proto_info"); ++ _mysql_stmt_bind_param = (bool (*)(st_mysql_stmt*, st_mysql_bind*))dlsym(mysql_dll_handle, "mysql_stmt_bind_param"); ++ _mysql_stmt_bind_result = (bool (*)(st_mysql_stmt*, st_mysql_bind*))dlsym(mysql_dll_handle, "mysql_stmt_bind_result"); ++ _mysql_stmt_init = (st_mysql_stmt* (*)(st_mysql*))dlsym(mysql_dll_handle, "mysql_stmt_init"); ++ _mysql_stmt_prepare = (int (*)(st_mysql_stmt*, const char*, long unsigned int))dlsym(mysql_dll_handle, "mysql_stmt_prepare"); ++ _mysql_stmt_execute = (int (*)(st_mysql_stmt*))dlsym(mysql_dll_handle, "mysql_stmt_execute"); ++ _mysql_stmt_fetch = (int (*)(st_mysql_stmt*))dlsym(mysql_dll_handle, "mysql_stmt_fetch"); ++ _mysql_query = (int (*)(st_mysql*, const char*))dlsym(mysql_dll_handle, "mysql_query"); ++ _mysql_stmt_result_metadata = (st_mysql_res* (*)(st_mysql_stmt*))dlsym(mysql_dll_handle, "mysql_stmt_result_metadata"); ++ _mysql_stmt_store_result = (int (*)(st_mysql*))dlsym(mysql_dll_handle, "mysql_stmt_store_result"); ++ _mysql_fetch_row = (char** (*)(st_mysql_res*))dlsym(mysql_dll_handle, "mysql_fetch_row"); ++ _mysql_fetch_field = (st_mysql_field* (*)(st_mysql_res*))dlsym(mysql_dll_handle, "mysql_fetch_field"); ++ _mysql_fetch_fields = (st_mysql_field* (*)(st_mysql_res*))dlsym(mysql_dll_handle, "mysql_fetch_fields"); ++ _mysql_stmt_close = (bool (*)(st_mysql_stmt*))dlsym(mysql_dll_handle, "mysql_stmt_close"); ++ _mysql_stmt_reset = (bool (*)(st_mysql_stmt*))dlsym(mysql_dll_handle, "mysql_stmt_reset"); ++ _mysql_free_result = (bool (*)(st_mysql_res*))dlsym(mysql_dll_handle, "mysql_free_result"); ++ _mysql_error = (const char* (*)(st_mysql*))dlsym(mysql_dll_handle, "mysql_error"); ++ _mysql_options = (int (*)(st_mysql*, mysql_option, const void*))dlsym(mysql_dll_handle, "mysql_options"); ++ _mysql_ssl_set = (bool (*)(st_mysql*, const char*, const char*, const char*, const char*, const char*))dlsym(mysql_dll_handle, "mysql_ssl_set"); ++ _mysql_real_connect = (st_mysql* (*)(st_mysql*, const char*, const char*, const char*, const char*, unsigned int, const char*, long unsigned int))dlsym(mysql_dll_handle, "mysql_real_connect"); ++ _mysql_close = (void (*)(st_mysql*))dlsym(mysql_dll_handle, "mysql_close"); ++ _mysql_init = (st_mysql* (*)(st_mysql*))dlsym(mysql_dll_handle, "mysql_init"); ++ _mysql_stmt_attr_set = (bool (*)(st_mysql_stmt*, enum_stmt_attr_type, const void*))dlsym(mysql_dll_handle, "mysql_stmt_attr_set"); ++ _mysql_store_result = (st_mysql_res* (*)(st_mysql*))dlsym(mysql_dll_handle, "mysql_store_result"); ++ _mysql_stmt_errno = (unsigned int (*)(st_mysql_stmt*))dlsym(mysql_dll_handle, "mysql_stmt_errno"); ++ _mysql_errno = (unsigned int (*)(st_mysql*))dlsym(mysql_dll_handle, "mysql_errno"); ++ _mysql_num_fields = (unsigned int (*)(st_mysql_res*))dlsym(mysql_dll_handle, "mysql_num_fields"); ++ _mysql_num_rows = (unsigned int (*)(st_mysql_res*))dlsym(mysql_dll_handle, "mysql_num_rows"); ++ _mysql_get_host_info = (const char* (*)(st_mysql*))dlsym(mysql_dll_handle, "mysql_get_host_info"); ++ _mysql_get_server_info = (const char* (*)(st_mysql*))dlsym(mysql_dll_handle, "mysql_get_server_info"); ++ _mysql_get_proto_info = (int (*)(st_mysql*))dlsym(mysql_dll_handle, "mysql_get_proto_info"); + + if (_mysql_stmt_bind_param == NULL || + _mysql_stmt_bind_result == NULL || +@@ -297,43 +339,37 @@ _PG_init(void) + errmsg("failed to load the mysql query: \n%s", dlerror()), + errhint("export LD_LIBRARY_PATH to locate the library"))); + +- DefineCustomIntVariable("mysql_fdw.wait_timeout", +- "Server-side wait_timeout", +- "Set the maximum wait_timeout" +- "use to set the MySQL session timeout", +- &wait_timeout, +- WAIT_TIMEOUT, +- 0, +- INT_MAX, +- PGC_USERSET, +- 0, +- NULL, +- NULL, +- NULL); +- +- DefineCustomIntVariable("mysql_fdw.interactive_timeout", +- "Server-side interactive timeout", +- "Set the maximum interactive timeout" +- "use to set the MySQL session timeout", +- &interactive_timeout, +- INTERACTIVE_TIMEOUT, +- 0, +- INT_MAX, +- PGC_USERSET, +- 0, +- NULL, +- NULL, +- NULL); +- on_proc_exit(&mysql_fdw_exit, PointerGetDatum(NULL)); +-} ++ if (GetConfigOption("mysql_fdw.wait_timeout", true, true) == NULL) { ++ DefineCustomIntVariable("mysql_fdw.wait_timeout", ++ "Server-side wait_timeout", ++ "Set the maximum wait_timeout" ++ "use to set the MySQL session timeout", ++ &wait_timeout, ++ WAIT_TIMEOUT, ++ 0, ++ INT_MAX, ++ PGC_USERSET, ++ 0, ++ NULL, ++ NULL, ++ NULL); ++ } + +-/* +- * mysql_fdw_exit: Exit callback function. +- */ +-static void +-mysql_fdw_exit(int code, Datum arg) +-{ +- mysql_cleanup_connection(); ++ if (GetConfigOption("mysql_fdw.interactive_timeout", true, true) == NULL) { ++ DefineCustomIntVariable("mysql_fdw.interactive_timeout", ++ "Server-side interactive timeout", ++ "Set the maximum interactive timeout" ++ "use to set the MySQL session timeout", ++ &interactive_timeout, ++ INTERACTIVE_TIMEOUT, ++ 0, ++ INT_MAX, ++ PGC_USERSET, ++ 0, ++ NULL, ++ NULL, ++ NULL); ++ } + } + + /* +@@ -348,7 +384,7 @@ mysql_fdw_handler(PG_FUNCTION_ARGS) + /* Callback functions for readable FDW */ + fdwroutine->GetForeignRelSize = mysqlGetForeignRelSize; + fdwroutine->GetForeignPaths = mysqlGetForeignPaths; +- fdwroutine->AnalyzeForeignTable = mysqlAnalyzeForeignTable; ++ fdwroutine->AnalyzeForeignTable = (bool (*)(Relation relation, AcquireSampleRowsFunc* func, BlockNumber* totalpages, void* additionalData, bool estimate_table_rownum))mysqlAnalyzeForeignTable; + fdwroutine->GetForeignPlan = mysqlGetForeignPlan; + fdwroutine->ExplainForeignScan = mysqlExplainForeignScan; + fdwroutine->BeginForeignScan = mysqlBeginForeignScan; +@@ -427,7 +463,7 @@ mysqlBeginForeignScan(ForeignScanState *node, int eflags) + + /* Stash away the state info we have already */ + festate->query = strVal(list_nth(fsplan->fdw_private, 0)); +- festate->retrieved_attrs = list_nth(fsplan->fdw_private, 1); ++ festate->retrieved_attrs = (List*)list_nth(fsplan->fdw_private, 1); + festate->conn = conn; + festate->cursor_exists = false; + +@@ -1047,12 +1083,12 @@ mysqlGetForeignPaths(PlannerInfo *root,RelOptInfo *baserel,Oid foreigntableid) + mysqlEstimateCosts(root, baserel, &startup_cost, &total_cost, foreigntableid); + + /* Create a ForeignPath node and add it as only possible path */ +- add_path(baserel, (Path *) ++ add_path(root, baserel, (Path *) + create_foreignscan_path(root, baserel, + #if PG_VERSION_NUM >= 90600 + NULL, /* default pathtarget */ +-#endif + baserel->rows, ++#endif + startup_cost, + total_cost, + NIL, /* no pathkeys */ +@@ -1155,7 +1191,7 @@ mysqlGetForeignPlan( + mysql_append_where_clause(&sql, root, baserel, remote_conds, + true, ¶ms_list); + +- if (baserel->relid == root->parse->resultRelation && ++ if (baserel->relid == (unsigned int)root->parse->resultRelation && + (root->parse->commandType == CMD_UPDATE || + root->parse->commandType == CMD_DELETE)) + { +@@ -1319,7 +1355,7 @@ mysqlPlanForeignModify(PlannerInfo *root, + #if PG_VERSION_NUM >= 90500 + Bitmapset *tmpset = bms_copy(rte->updatedCols); + #else +- Bitmapset *tmpset = bms_copy(rte->modifiedCols); ++ Bitmapset *tmpset = bms_copy(rte->updatedCols); + #endif + AttrNumber col; + +@@ -1633,7 +1669,7 @@ mysqlExecForeignUpdate(EState *estate, + n_params = list_length(fmstate->retrieved_attrs); + + mysql_bind_buffer = (MYSQL_BIND*) palloc0(sizeof(MYSQL_BIND) * n_params); +- isnull = palloc0(sizeof(bool) * n_params); ++ isnull = (bool*)palloc0(sizeof(bool) * n_params); + + /* Bind the values */ + foreach(lc, fmstate->retrieved_attrs) +@@ -1822,7 +1858,7 @@ mysqlExecForeignDelete(EState *estate, + static void + mysqlEndForeignModify(EState *estate, ResultRelInfo *resultRelInfo) + { +- MySQLFdwExecState *festate = resultRelInfo->ri_FdwState; ++ MySQLFdwExecState *festate = (MySQLFdwExecState*)resultRelInfo->ri_FdwState; + + if (festate && festate->stmt) + { +diff --git a/code/mysql_fdw-REL-2_5_3/mysql_fdw.h b/code/mysql_fdw-REL-2_5_3/mysql_fdw.h +index 5b543cd..b2a7011 100644 +--- a/code/mysql_fdw-REL-2_5_3/mysql_fdw.h ++++ b/code/mysql_fdw-REL-2_5_3/mysql_fdw.h +@@ -135,31 +135,31 @@ extern bool is_foreign_expr(PlannerInfo *root, + Expr *expr); + + +-int ((*_mysql_options)(MYSQL *mysql,enum mysql_option option, const void *arg)); +-int ((*_mysql_stmt_prepare)(MYSQL_STMT *stmt, const char *query, unsigned long length)); +-int ((*_mysql_stmt_execute)(MYSQL_STMT *stmt)); +-int ((*_mysql_stmt_fetch)(MYSQL_STMT *stmt)); +-int ((*_mysql_query)(MYSQL *mysql, const char *q)); +-bool ((*_mysql_stmt_attr_set)(MYSQL_STMT *stmt, enum enum_stmt_attr_type attr_type, const void *attr)); +-bool ((*_mysql_stmt_close)(MYSQL_STMT * stmt)); +-bool ((*_mysql_stmt_reset)(MYSQL_STMT * stmt)); +-bool ((*_mysql_free_result)(MYSQL_RES *result)); +-bool ((*_mysql_stmt_bind_param)(MYSQL_STMT *stmt, MYSQL_BIND * bnd)); +-bool ((*_mysql_stmt_bind_result)(MYSQL_STMT *stmt, MYSQL_BIND * bnd)); +- +-MYSQL_STMT *((*_mysql_stmt_init)(MYSQL *mysql)); +-MYSQL_RES *((*_mysql_stmt_result_metadata)(MYSQL_STMT *stmt)); +-int ((*_mysql_stmt_store_result)(MYSQL *mysql)); +-MYSQL_ROW ((*_mysql_fetch_row)(MYSQL_RES *result)); +-MYSQL_FIELD *((*_mysql_fetch_field)(MYSQL_RES *result)); +-MYSQL_FIELD *((*_mysql_fetch_fields)(MYSQL_RES *result)); +-const char *((*_mysql_error)(MYSQL *mysql)); +-void ((*_mysql_close)(MYSQL *sock)); +-MYSQL_RES* ((*_mysql_store_result)(MYSQL *mysql)); +- +-MYSQL *((*_mysql_init)(MYSQL *mysql)); +-bool ((*_mysql_ssl_set)(MYSQL *mysql, const char *key, const char *cert, const char *ca, const char *capath, const char *cipher)); +-MYSQL *((*_mysql_real_connect)(MYSQL *mysql, ++extern int ((*_mysql_options)(MYSQL *mysql,enum mysql_option option, const void *arg)); ++extern int ((*_mysql_stmt_execute)(MYSQL_STMT *stmt)); ++extern int ((*_mysql_stmt_fetch)(MYSQL_STMT *stmt)); ++extern int ((*_mysql_stmt_prepare)(MYSQL_STMT *stmt, const char *query, unsigned long length)); ++extern int ((*_mysql_query)(MYSQL *mysql, const char *q)); ++extern bool ((*_mysql_stmt_attr_set)(MYSQL_STMT *stmt, enum enum_stmt_attr_type attr_type, const void *attr)); ++extern bool ((*_mysql_stmt_close)(MYSQL_STMT * stmt)); ++extern bool ((*_mysql_stmt_reset)(MYSQL_STMT * stmt)); ++extern bool ((*_mysql_free_result)(MYSQL_RES *result)); ++extern bool ((*_mysql_stmt_bind_param)(MYSQL_STMT *stmt, MYSQL_BIND * bnd)); ++extern bool ((*_mysql_stmt_bind_result)(MYSQL_STMT *stmt, MYSQL_BIND * bnd)); ++ ++extern MYSQL_STMT *((*_mysql_stmt_init)(MYSQL *mysql)); ++extern MYSQL_RES *((*_mysql_stmt_result_metadata)(MYSQL_STMT *stmt)); ++extern int ((*_mysql_stmt_store_result)(MYSQL *mysql)); ++extern MYSQL_ROW ((*_mysql_fetch_row)(MYSQL_RES *result)); ++extern MYSQL_FIELD *((*_mysql_fetch_field)(MYSQL_RES *result)); ++extern MYSQL_FIELD *((*_mysql_fetch_fields)(MYSQL_RES *result)); ++extern const char *((*_mysql_error)(MYSQL *mysql)); ++extern void ((*_mysql_close)(MYSQL *sock)); ++extern MYSQL_RES* ((*_mysql_store_result)(MYSQL *mysql)); ++ ++extern MYSQL *((*_mysql_init)(MYSQL *mysql)); ++extern bool ((*_mysql_ssl_set)(MYSQL *mysql, const char *key, const char *cert, const char *ca, const char *capath, const char *cipher)); ++extern MYSQL *((*_mysql_real_connect)(MYSQL *mysql, + const char *host, + const char *user, + const char *passwd, +@@ -168,14 +168,14 @@ MYSQL *((*_mysql_real_connect)(MYSQL *mysql, + const char *unix_socket, + unsigned long clientflag)); + +-const char *((*_mysql_get_host_info)(MYSQL *mysql)); +-const char *((*_mysql_get_server_info)(MYSQL *mysql)); +-int ((*_mysql_get_proto_info)(MYSQL *mysql)); ++extern const char *((*_mysql_get_host_info)(MYSQL *mysql)); ++extern const char *((*_mysql_get_server_info)(MYSQL *mysql)); ++extern int ((*_mysql_get_proto_info)(MYSQL *mysql)); + +-unsigned int ((*_mysql_stmt_errno)(MYSQL_STMT *stmt)); +-unsigned int ((*_mysql_errno)(MYSQL *mysql)); +-unsigned int ((*_mysql_num_fields)(MYSQL_RES *result)); +-unsigned int ((*_mysql_num_rows)(MYSQL_RES *result)); ++extern unsigned int ((*_mysql_stmt_errno)(MYSQL_STMT *stmt)); ++extern unsigned int ((*_mysql_errno)(MYSQL *mysql)); ++extern unsigned int ((*_mysql_num_fields)(MYSQL_RES *result)); ++extern unsigned int ((*_mysql_num_rows)(MYSQL_RES *result)); + + + /* option.c headers */ +diff --git a/code/mysql_fdw-REL-2_5_3/mysql_query.cpp b/code/mysql_fdw-REL-2_5_3/mysql_query.cpp +index 8c25f5c..6093a5a 100644 +--- a/code/mysql_fdw-REL-2_5_3/mysql_query.cpp ++++ b/code/mysql_fdw-REL-2_5_3/mysql_query.cpp +@@ -21,7 +21,7 @@ + #include + + #include +-#include ++#include + + #include "access/reloptions.h" + #include "catalog/pg_type.h" +@@ -48,7 +48,7 @@ + #include "utils/timestamp.h" + #include "utils/formatting.h" + #include "utils/memutils.h" +-#include "access/htup_details.h" ++#include "access/htup.h" + #include "access/sysattr.h" + #include "commands/defrem.h" + #include "commands/explain.h" +@@ -226,6 +226,7 @@ mysql_from_pgtyp(Oid type) + break; + } + } ++ return MAX_NO_FIELD_TYPES; + } + + /* +@@ -238,8 +239,8 @@ mysql_bind_sql_var(Oid type, int attnum, Datum value, MYSQL_BIND *binds, bool *i + /* Clear the bind buffer and attributes */ + memset(&binds[attnum], 0x0, sizeof(MYSQL_BIND)); + +- binds[attnum].buffer_type = mysql_from_pgtyp(type); +- binds[attnum].is_null = isnull; ++ binds[attnum].buffer_type = (enum_field_types)mysql_from_pgtyp(type); ++ binds[attnum].is_null = (my_bool*)isnull; + + /* Avoid to bind buffer in case value is NULL */ + if (*isnull) +@@ -250,7 +251,7 @@ mysql_bind_sql_var(Oid type, int attnum, Datum value, MYSQL_BIND *binds, bool *i + case INT2OID: + { + int16 dat = DatumGetInt16(value); +- int16 *bufptr = palloc0(sizeof(int16)); ++ int16 *bufptr = (int16*)palloc0(sizeof(int16)); + memcpy(bufptr, (char*)&dat, sizeof(int16)); + + binds[attnum].buffer = bufptr; +@@ -259,7 +260,7 @@ mysql_bind_sql_var(Oid type, int attnum, Datum value, MYSQL_BIND *binds, bool *i + case INT4OID: + { + int32 dat = DatumGetInt32(value); +- int32 *bufptr = palloc0(sizeof(int32)); ++ int32 *bufptr = (int32*)palloc0(sizeof(int32)); + memcpy(bufptr, (char*)&dat, sizeof(int32)); + + binds[attnum].buffer = bufptr; +@@ -268,7 +269,7 @@ mysql_bind_sql_var(Oid type, int attnum, Datum value, MYSQL_BIND *binds, bool *i + case INT8OID: + { + int64 dat = DatumGetInt64(value); +- int64 *bufptr = palloc0(sizeof(int64)); ++ int64 *bufptr = (int64*)palloc0(sizeof(int64)); + memcpy(bufptr, (char*)&dat, sizeof(int64)); + + binds[attnum].buffer = bufptr; +@@ -277,7 +278,7 @@ mysql_bind_sql_var(Oid type, int attnum, Datum value, MYSQL_BIND *binds, bool *i + case FLOAT4OID: + { + float4 dat = DatumGetFloat4(value); +- float4 *bufptr = palloc0(sizeof(float4)); ++ float4 *bufptr = (float4*)palloc0(sizeof(float4)); + memcpy(bufptr, (char*)&dat, sizeof(float4)); + + binds[attnum].buffer = bufptr; +@@ -286,7 +287,7 @@ mysql_bind_sql_var(Oid type, int attnum, Datum value, MYSQL_BIND *binds, bool *i + case FLOAT8OID: + { + float8 dat = DatumGetFloat8(value); +- float8 *bufptr = palloc0(sizeof(float8)); ++ float8 *bufptr = (float8*)palloc0(sizeof(float8)); + memcpy(bufptr, (char*)&dat, sizeof(float8)); + + binds[attnum].buffer = bufptr; +@@ -296,7 +297,7 @@ mysql_bind_sql_var(Oid type, int attnum, Datum value, MYSQL_BIND *binds, bool *i + { + Datum valueDatum = DirectFunctionCall1(numeric_float8, value); + float8 dat = DatumGetFloat8(valueDatum); +- float8 *bufptr = palloc0(sizeof(float8)); ++ float8 *bufptr = (float8*)palloc0(sizeof(float8)); + memcpy(bufptr, (char*)&dat, sizeof(float8)); + + binds[attnum].buffer = bufptr; +@@ -305,7 +306,7 @@ mysql_bind_sql_var(Oid type, int attnum, Datum value, MYSQL_BIND *binds, bool *i + case BOOLOID: + { + int32 dat = DatumGetInt32(value); +- int32 *bufptr = palloc0(sizeof(int32)); ++ int32 *bufptr = (int32*)palloc0(sizeof(int32)); + memcpy(bufptr, (char*)&dat, sizeof(int32)); + + binds[attnum].buffer = bufptr; +@@ -348,7 +349,7 @@ mysql_bind_sql_var(Oid type, int attnum, Datum value, MYSQL_BIND *binds, bool *i + + Datum valueDatum = DirectFunctionCall1(date_timestamp, value); + Timestamp valueTimestamp = DatumGetTimestamp(valueDatum); +- MYSQL_TIME* ts = palloc0(sizeof(MYSQL_TIME)); ++ MYSQL_TIME* ts = (MYSQL_TIME*)palloc0(sizeof(MYSQL_TIME)); + + timestamp2tm(valueTimestamp, &tz, tm, &fsec, &tzn, pg_tzset("UTC")); + +@@ -364,7 +365,7 @@ mysql_bind_sql_var(Oid type, int attnum, Datum value, MYSQL_BIND *binds, bool *i + case TIMESTAMPTZOID: + { + Timestamp valueTimestamp = DatumGetTimestamp(value); +- MYSQL_TIME* ts = palloc0(sizeof(MYSQL_TIME)); ++ MYSQL_TIME* ts = (MYSQL_TIME*)palloc0(sizeof(MYSQL_TIME)); + + int tz; + struct pg_tm tt, +@@ -384,7 +385,7 @@ mysql_bind_sql_var(Oid type, int attnum, Datum value, MYSQL_BIND *binds, bool *i + case BITOID: + { + int32 dat; +- int32 *bufptr = palloc0(sizeof(int32)); ++ int32 *bufptr = (int32*)palloc0(sizeof(int32)); + char *outputString = NULL; + Oid outputFunctionId = InvalidOid; + bool typeVarLength = false; +@@ -412,7 +413,7 @@ mysql_bind_sql_var(Oid type, int attnum, Datum value, MYSQL_BIND *binds, bool *i + len = VARSIZE_4B(result) - VARHDRSZ; + dat = VARDATA_4B(result); + } +- bufptr = palloc0(len); ++ bufptr = (char*)palloc0(len); + memcpy(bufptr, (char*)dat, len); + binds[attnum].buffer = bufptr; + binds[attnum].buffer_length = len; +@@ -438,9 +439,9 @@ void + mysql_bind_result(Oid pgtyp, int pgtypmod, MYSQL_FIELD *field, mysql_column *column) + { + MYSQL_BIND *mbind = column->_mysql_bind; +- mbind->is_null = &column->is_null; ++ mbind->is_null = (my_bool*)&column->is_null; + mbind->length = &column->length; +- mbind->error = &column->error; ++ mbind->error = (my_bool*)&column->error; + + switch (pgtyp) + { +diff --git a/code/mysql_fdw-REL-2_5_3/option.cpp b/code/mysql_fdw-REL-2_5_3/option.cpp +index 880d984..f3b77f7 100644 +--- a/code/mysql_fdw-REL-2_5_3/option.cpp ++++ b/code/mysql_fdw-REL-2_5_3/option.cpp +@@ -81,7 +81,7 @@ static struct MySQLFdwOption valid_options[] = + { NULL, InvalidOid } + }; + +-extern Datum mysql_fdw_validator(PG_FUNCTION_ARGS); ++extern "C" Datum mysql_fdw_validator(PG_FUNCTION_ARGS); + + PG_FUNCTION_INFO_V1(mysql_fdw_validator); + diff --git a/third_party/dependency/mysql_fdw/mysql_fdw-REL-2_5_3.tar.gz b/third_party/dependency/mysql_fdw/mysql_fdw-REL-2_5_3.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..1409e687d71cdc2991b89de757ba8d3e21be83ae Binary files /dev/null and b/third_party/dependency/mysql_fdw/mysql_fdw-REL-2_5_3.tar.gz differ