提交 0b5113bf 编写于 作者: H Heikki Linnakangas

Fix 'orafce' to work on GPDB.

The previous commit updated 'orafce' module to new upstream version.
This commit fixes it so that it works with GPDB. We carried many of these
diffs against the old version too, but some are new with the new orafce
version.

Old differences, put back in this commit:

- In the 'finish no data found' NOTICEs, GPDB strips trailing spaces

- GPDB doesn't allow SQL_ASCII as database encoding. Use 'iso-8859-1' in
  the 'nlssort' test instead.

- Don't install dbms_alert. It doesn't work in GPDB.

- GPDB doesn't have 'tts_tableOid' field in TupleTableSlot

New differences:

- Use init_file to suppress extra NOTICEs about distribution keys and such
  that GPDB prints. (Previously, we had changed the expected outputs to
  include the NOTICEs, but this seems nicer.)

- GPDB has built-in DECODE() support, so don't install the orafce decode()
  compatibility functions. The DECODE() is transformed to a CASE-WHEN
  construct, so fix all the regression tests that had 'decode' as the
  result column name now into 'case' instead. A few tests are now erroring
  out because of missing casts between text and other datatypes, but that's
  expected / accepted because the GPDB implementation of DECODE() is
  different.
上级 3f0e2baf
......@@ -15,6 +15,7 @@ REGRESS = orafce orafce2 dbms_output dbms_utility files varchar2 nvarchar2 aggre
#REGRESS_OPTS = --load-language=plpgsql --schedule=parallel_schedule --encoding=utf8
REGRESS_OPTS = --schedule=parallel_schedule --encoding=utf8
REGRESS_OPTS += --init-file=init_file
#override CFLAGS += -Wextra -Wimplicit-fallthrough=0
......
......@@ -172,7 +172,7 @@ NOTICE: [11] >>[1=1, 2=2, 3=3, 4=4, 5=5]<<
NOTICE: >>1234<<
NOTICE: >>5678<<
NOTICE: >>90<<
NOTICE: finish no data found
NOTICE: finish no data found
NOTICE: is_open = t
NOTICE: is_open = f
read_file
......@@ -237,7 +237,7 @@ NOTICE: [11] >>[1=1, 2=2, 3=3, 4=4, 5=5]<<
NOTICE: >>1234<<
NOTICE: >>5678<<
NOTICE: >>90<<
NOTICE: finish no data found
NOTICE: finish no data found
NOTICE: is_open = t
NOTICE: is_open = f
read_file
......
......@@ -172,7 +172,7 @@ NOTICE: [11] >>[1=1, 2=2, 3=3, 4=4, 5=5]<<
NOTICE: >>1234<<
NOTICE: >>5678<<
NOTICE: >>90<<
NOTICE: finish no data found
NOTICE: finish no data found
NOTICE: is_open = t
NOTICE: is_open = f
read_file
......@@ -237,7 +237,7 @@ NOTICE: [11] >>[1=1, 2=2, 3=3, 4=4, 5=5]<<
NOTICE: >>1234<<
NOTICE: >>5678<<
NOTICE: >>90<<
NOTICE: finish no data found
NOTICE: finish no data found
NOTICE: is_open = t
NOTICE: is_open = f
read_file
......
......@@ -21,8 +21,14 @@
(1 row)
ERROR: failed to set the requested LC_COLLATE value [invalid]
CONTEXT: SQL function "nlssort" statement 1
name
--------
Purple
brown
red
yellow
(4 rows)
set_nls_sort
--------------
......
-- 2) fails and throws error: 'ERROR: could not determine polymorphic type
-- because input has type "unknown"'
select decode('2012-01-01', '2012-01-01', 23, '2012-01-02', 24);
ERROR: could not determine polymorphic type because input has type unknown
case
------
23
(1 row)
-- 2) fails and throws error: 'ERROR: could not determine polymorphic type
-- because input has type "unknown"'
select decode('2012-01-01', '2012-01-01', 23, '2012-01-02', 24);
ERROR: could not determine polymorphic type because input has type "unknown"
case
------
23
(1 row)
-- This file contains global patterns of messages that should be ignored or
-- masked out, when comparing test results with the expected output.
-- Individual tests can contain additional patterns specific to the test.
-- start_matchignore
# There are a number of NOTICE and HINT messages around table distribution,
# for example to inform the user that the database will pick a particular
# column in order to distribute the data. Merging tests from postgres will
# cause the tests to output these messages and we would need to manually
# modify the corresponding expected output. Hence we want to ignore these.
# Some of the messages include:
#
# NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named '<colname>' as the Greenplum Database data distribution key for this table.
# NOTICE: Table doesn't have 'DISTRIBUTED BY' clause, defaulting to distribution columns from LIKE table
# HINT: The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
#
# The following regex is intended to cover all permutations of the above set
# of messages.
m/^(?:HINT|NOTICE):\s+.+\'DISTRIBUTED BY\' clause.*/
# The following NOTICE is generated when creating a role. It is to inform the
# user that the database will assign the default resource queue to the role if
# the user has not explicitly specified one. Merging tests from postgres will
# cause the tests to output these messages and we would need to manually modify
# the corresponding expected output. Hence we want to ignore these.
m/^NOTICE:.*resource queue required -- using default resource queue ".*"/
-- end_matchignore
......@@ -548,6 +548,9 @@ AS 'MODULE_PATHNAME','ora_nvl2'
LANGUAGE C IMMUTABLE;
COMMENT ON FUNCTION nvl2(anyelement, anyelement, anyelement) IS '';
-- decode functions are left out in GPDB, because GPDB has a built-in parser
-- hack to transform DECODE() into CASE-WHEN.
/*
CREATE FUNCTION public.decode(anyelement, anyelement, text)
RETURNS text
AS 'MODULE_PATHNAME', 'ora_decode'
......@@ -817,7 +820,7 @@ CREATE FUNCTION public.decode(anyelement, anyelement, timestamptz, anyelement, t
RETURNS timestamptz
AS 'MODULE_PATHNAME', 'ora_decode'
LANGUAGE C IMMUTABLE;
*/
CREATE SCHEMA dbms_pipe;
......@@ -1474,8 +1477,9 @@ AS $$ SELECT TRANSLATE($1, 'A'||$2, 'A'); $$
LANGUAGE SQL IMMUTABLE STRICT;
COMMENT ON FUNCTION plvchr.stripped(text, text) IS 'Strips a string of all instances of the specified characters';
-- dbms_alert
-- dbms_alert is removed in GPDB because it is not possible to run it in MPP
-- environments as implemented in postgres.
/*
CREATE SCHEMA dbms_alert;
CREATE FUNCTION dbms_alert.register(name text)
......@@ -1531,6 +1535,7 @@ RETURNS void
AS 'MODULE_PATHNAME','dbms_alert_signal'
LANGUAGE C SECURITY DEFINER;
COMMENT ON FUNCTION dbms_alert.signal(text, text) IS 'Emit signal to all recipients';
*/
CREATE SCHEMA plvsubst;
......@@ -2283,6 +2288,14 @@ CREATE CAST (interval AS varchar2)
WITH INOUT
AS IMPLICIT;
-- XXX: This is disabled in gpdb because we have no way of dispatching this
-- change to the segments. There is no DDL to support setting a protransform
-- function in upstream, because of security concerns. We need to understand
-- exactly what these security concerns are, and have a strategy to deal with
-- the (probably rare) cases where a user might want to use this feature in
-- GPDB.
--SET allow_system_table_mods=true;
/*
do $$
BEGIN
IF EXISTS(SELECT * FROM pg_settings WHERE name = 'server_version_num' AND setting::int >= 120000) THEN
......@@ -2292,6 +2305,8 @@ BEGIN
END IF;
END
$$;
*/
--RESET allow_system_table_mods;
-- string functions for varchar2 type
-- these are 'byte' versions of corresponsing text/varchar functions
......@@ -2497,6 +2512,8 @@ CREATE CAST (interval AS nvarchar2)
WITH INOUT
AS IMPLICIT;
-- disabled in GPDB; see similar chunk on varchar2_transform above
/*
do $$
BEGIN
IF EXISTS(SELECT * FROM pg_settings WHERE name = 'server_version_num' AND setting::int >= 120000) THEN
......@@ -2506,6 +2523,7 @@ BEGIN
END IF;
END
$$;
*/
/*
* Note - a procedure keyword is depraceted from PostgreSQL 11, but it used
......@@ -3263,7 +3281,7 @@ STRICT IMMUTABLE
;
GRANT USAGE ON SCHEMA dbms_pipe TO PUBLIC;
GRANT USAGE ON SCHEMA dbms_alert TO PUBLIC;
--GRANT USAGE ON SCHEMA dbms_alert TO PUBLIC;
GRANT USAGE ON SCHEMA plvdate TO PUBLIC;
GRANT USAGE ON SCHEMA plvstr TO PUBLIC;
GRANT USAGE ON SCHEMA plvchr TO PUBLIC;
......
test: init
test: dbms_pipe_session_A dbms_pipe_session_B
test: dbms_alert_session_A dbms_alert_session_B dbms_alert_session_C
# dbms_alert is removed in GPDB because it is not possible to run it in MPP
# environments as implemented in postgres.
#test: dbms_alert_session_A dbms_alert_session_B dbms_alert_session_C
......@@ -65,7 +65,7 @@ heap_modify_tuple_by_cols(HeapTuple tuple,
*/
newTuple->t_data->t_ctid = tuple->t_data->t_ctid;
newTuple->t_self = tuple->t_self;
newTuple->t_tableOid = tuple->t_tableOid;
/* newTuple->t_tableOid = tuple->t_tableOid; */
if (tupleDesc->tdhasoid)
HeapTupleSetOid(newTuple, HeapTupleGetOid(tuple));
......
......@@ -2,7 +2,7 @@
\set ECHO none
SET client_min_messages = error;
DROP DATABASE IF EXISTS regression_sort;
CREATE DATABASE regression_sort WITH TEMPLATE = template0 ENCODING='SQL_ASCII' LC_COLLATE='C' LC_CTYPE='C';
CREATE DATABASE regression_sort WITH TEMPLATE = template0 ENCODING='UTF-8' LC_COLLATE='C' LC_CTYPE='C';
\c regression_sort
SET client_min_messages = error;
CREATE EXTENSION orafce;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册