Porting optimizer functional tests to ICG [#120031461]

    Port `dml/triggers`
    Port `olap/groupingfunction`
    Port `functions/builtin`
    Port `dml/functional`
    Port `dml/functional/sql_partiton`
    Port `functions/functionProperty`

    Update optfunctional_schedule with ported tests

    Update the Makefile for optimizer functional tests
上级 c36ecd6f
......@@ -182,6 +182,7 @@ installcheck-optfunctional: all
@echo "================================"
@echo "Installcheck-optfunctional starting ... "
@echo "================================"
export PGOPTIONS='-c optimizer=on' && \
$(pg_regress_call_opt) --psqldir=$(PSQLDIR) --schedule=$(srcdir)/optfunctional/optfunctional_schedule --srcdir=$(abs_srcdir)/optfunctional
testbouncer: all
......
-- ----------------------------------------------------------------------
-- Test: setup.sql
-- ----------------------------------------------------------------------
......@@ -65,22 +64,13 @@ select * from gp_toolkit.gp_stats_missing where smitable like 'arp_%' order by s
analyze_rootpartition | arp_test2_1_prt_1 | f | 2 | 0
analyze_rootpartition | arp_test2_1_prt_2 | f | 2 | 0
analyze_rootpartition | arp_test2_1_prt_3 | f | 2 | 0
analyze_rootpartition | arp_test_1_prt_1 | f | 2 | 0
analyze_rootpartition | arp_test_1_prt_2 | f | 2 | 0
analyze_rootpartition | arp_test_1_prt_3 | f | 2 | 0
(7 rows)
(4 rows)
analyze rootpartition all;
select * from gp_toolkit.gp_stats_missing where smitable like 'arp_%' order by smitable;
smischema | smitable | smisize | smicols | smirecs
-----------------------+-------------------+---------+---------+---------
analyze_rootpartition | arp_test2_1_prt_1 | f | 2 | 0
analyze_rootpartition | arp_test2_1_prt_2 | f | 2 | 0
analyze_rootpartition | arp_test2_1_prt_3 | f | 2 | 0
analyze_rootpartition | arp_test_1_prt_1 | f | 2 | 0
analyze_rootpartition | arp_test_1_prt_2 | f | 2 | 0
analyze_rootpartition | arp_test_1_prt_3 | f | 2 | 0
(6 rows)
smischema | smitable | smisize | smicols | smirecs
-----------+----------+---------+---------+---------
(0 rows)
analyze rootpartition arp_test(a);
-- negative tests below
......@@ -89,7 +79,6 @@ analyze rootpartition;
ERROR: relation "rootpartition" does not exist
-- if a table is specified, it must be a root part
analyze rootpartition arp_test_1_prt_1;
WARNING: skipping "arp_test_1_prt_1" --- cannot analyze a non-root partition using ANALYZE ROOTPARTITION
-- rootpartition cannot be specified with VACUUM
vacuum analyze rootpartition arp_test;
ERROR: ROOTPARTITION option cannot be used together with VACUUM, try ANALYZE ROOTPARTITION
......@@ -132,36 +121,36 @@ insert into arp_test3 select 4, i from generate_series(1226,1600) i;
analyze arp_test3;
select * from pg_stats where tablename like 'arp_test3%' order by tablename, attname;
schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs | histogram_bounds | correlation
! ------------+-------------------+---------+-----------+-----------+------------+------------------+------------------------------------+-------------------------------------------------------------------------------------------------------------------------+-------------
! public | arp_test3 | a | 0 | 4 | 4 | {4,3,2,1} | {0.390625,0.265625,0.1875,0.15625} | {1,2,3,4} |
! public | arp_test3 | b | 0 | 4 | -1 | | | {1,65,129,193,257,321,385,449,513,577,641,705,769,833,897,961,1025,1089,1153,1217,1281,1345,1409,1473,1537,1600} |
! public | arp_test3_1_prt_1 | a | 0 | 4 | 3 | {3,2,1} | {0.435897,0.307692,0.25641} | {1,2,3} |
! public | arp_test3_1_prt_1 | b | 0 | 4 | -1 | | | {1,53,105,157,209,261,313,365,417,469,521,573,625,677,729,781,833,885,937,989,1031,1070,1109,1148,1187,1225} |
! public | arp_test3_1_prt_2 | a | 0 | 4 | 1 | {4} | {1} | {4} |
! public | arp_test3_1_prt_2 | b | 0 | 4 | -1 | | | {3,103,203,303,403,503,603,703,803,903,1226,1251,1276,1301,1326,1351,1376,1401,1426,1451,1476,1501,1526,1551,1576,1600} |
-----------------------+-------------------+---------+-----------+-----------+------------+------------------+------------------------------------+-----------------------------------------------------------------------------------------------------------------------+-------------
analyze_rootpartition | arp_test3 | a | 0 | 4 | 4 | {4,3,2,1} | {0.390625,0.265625,0.1875,0.15625} | | 0.926199
analyze_rootpartition | arp_test3 | b | 0 | 4 | -1 | | | {1,64,128,192,256,320,384,448,512,576,640,704,768,832,896,960,1024,1088,1152,1216,1280,1344,1408,1472,1536,1600} | 0.762744
analyze_rootpartition | arp_test3_1_prt_1 | a | 0 | 4 | 3 | {3,2,1} | {0.435897,0.307692,0.25641} | | 0.673855
analyze_rootpartition | arp_test3_1_prt_1 | b | 0 | 4 | -1 | | | {1,52,104,156,208,260,312,364,416,468,520,572,624,676,728,780,832,884,936,988,1030,1069,1108,1147,1186,1225} | 0.842261
analyze_rootpartition | arp_test3_1_prt_2 | a | 0 | 4 | 1 | {4} | {1} | | 1
analyze_rootpartition | arp_test3_1_prt_2 | b | 0 | 4 | -1 | | | {3,99,199,299,399,499,599,699,799,899,999,1250,1275,1300,1325,1350,1375,1400,1425,1450,1475,1500,1525,1550,1575,1600} | 1
(6 rows)
set allow_system_table_mods="DML";
delete from pg_statistic where starelid='arp_test3'::regclass;
select * from pg_stats where tablename like 'arp_test3%' order by tablename, attname;
schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs | histogram_bounds | correlation
! ------------+-------------------+---------+-----------+-----------+------------+------------------+-----------------------------+-------------------------------------------------------------------------------------------------------------------------+-------------
! public | arp_test3_1_prt_1 | a | 0 | 4 | 3 | {3,2,1} | {0.435897,0.307692,0.25641} | {1,2,3} |
! public | arp_test3_1_prt_1 | b | 0 | 4 | -1 | | | {1,53,105,157,209,261,313,365,417,469,521,573,625,677,729,781,833,885,937,989,1031,1070,1109,1148,1187,1225} |
! public | arp_test3_1_prt_2 | a | 0 | 4 | 1 | {4} | {1} | {4} |
! public | arp_test3_1_prt_2 | b | 0 | 4 | -1 | | | {3,103,203,303,403,503,603,703,803,903,1226,1251,1276,1301,1326,1351,1376,1401,1426,1451,1476,1501,1526,1551,1576,1600} |
-----------------------+-------------------+---------+-----------+-----------+------------+------------------+-----------------------------+-----------------------------------------------------------------------------------------------------------------------+-------------
analyze_rootpartition | arp_test3_1_prt_1 | a | 0 | 4 | 3 | {3,2,1} | {0.435897,0.307692,0.25641} | | 0.673855
analyze_rootpartition | arp_test3_1_prt_1 | b | 0 | 4 | -1 | | | {1,52,104,156,208,260,312,364,416,468,520,572,624,676,728,780,832,884,936,988,1030,1069,1108,1147,1186,1225} | 0.842261
analyze_rootpartition | arp_test3_1_prt_2 | a | 0 | 4 | 1 | {4} | {1} | | 1
analyze_rootpartition | arp_test3_1_prt_2 | b | 0 | 4 | -1 | | | {3,99,199,299,399,499,599,699,799,899,999,1250,1275,1300,1325,1350,1375,1400,1425,1450,1475,1500,1525,1550,1575,1600} | 1
(4 rows)
analyze rootpartition arp_test3;
select * from pg_stats where tablename like 'arp_test3%' order by tablename, attname;
schemaname | tablename | attname | null_frac | avg_width | n_distinct | most_common_vals | most_common_freqs | histogram_bounds | correlation
! ------------+-------------------+---------+-----------+-----------+------------+------------------+------------------------------------+-------------------------------------------------------------------------------------------------------------------------+-------------
! public | arp_test3 | a | 0 | 4 | 4 | {4,3,2,1} | {0.390625,0.265625,0.1875,0.15625} | {1,2,3,4} |
! public | arp_test3 | b | 0 | 4 | -1 | | | {1,65,129,193,257,321,385,449,513,577,641,705,769,833,897,961,1025,1089,1153,1217,1281,1345,1409,1473,1537,1600} |
! public | arp_test3_1_prt_1 | a | 0 | 4 | 3 | {3,2,1} | {0.435897,0.307692,0.25641} | {1,2,3} |
! public | arp_test3_1_prt_1 | b | 0 | 4 | -1 | | | {1,53,105,157,209,261,313,365,417,469,521,573,625,677,729,781,833,885,937,989,1031,1070,1109,1148,1187,1225} |
! public | arp_test3_1_prt_2 | a | 0 | 4 | 1 | {4} | {1} | {4} |
! public | arp_test3_1_prt_2 | b | 0 | 4 | -1 | | | {3,103,203,303,403,503,603,703,803,903,1226,1251,1276,1301,1326,1351,1376,1401,1426,1451,1476,1501,1526,1551,1576,1600} |
-----------------------+-------------------+---------+-----------+-----------+------------+------------------+------------------------------------+-----------------------------------------------------------------------------------------------------------------------+-------------
analyze_rootpartition | arp_test3 | a | 0 | 4 | 4 | {4,3,2,1} | {0.390625,0.265625,0.1875,0.15625} | | 0.926199
analyze_rootpartition | arp_test3 | b | 0 | 4 | -1 | | | {1,64,128,192,256,320,384,448,512,576,640,704,768,832,896,960,1024,1088,1152,1216,1280,1344,1408,1472,1536,1600} | 0.762744
analyze_rootpartition | arp_test3_1_prt_1 | a | 0 | 4 | 3 | {3,2,1} | {0.435897,0.307692,0.25641} | | -0.469378
analyze_rootpartition | arp_test3_1_prt_1 | b | 0 | 4 | -1 | | | {1,52,104,156,208,260,312,364,416,468,520,572,624,676,728,780,832,884,936,988,1030,1069,1108,1147,1186,1225} | 0.270385
analyze_rootpartition | arp_test3_1_prt_2 | a | 0 | 4 | 1 | {4} | {1} | | 1
analyze_rootpartition | arp_test3_1_prt_2 | b | 0 | 4 | -1 | | | {3,99,199,299,399,499,599,699,799,899,999,1250,1275,1300,1325,1350,1375,1400,1425,1450,1475,1500,1525,1550,1575,1600} | 1
(6 rows)
drop table arp_test3;
......
-- start_ignore
create schema builtin_dqa;
set search_path to builtin_dqa;
CREATE TABLE foo (a text, b int, c text, d text, e text);
NOTICE: Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'a' as the Greenplum Database data distribution key for this 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.
INSERT INTO foo VALUES ('foo', 12000, 'pg_default', 'ao_tab1', 'testdb');
INSERT INTO foo VALUES ('bar', 4045, 'pg_default', 'ao_tab2', 'testdb');
INSERT INTO foo VALUES ('ao_tab1', 573, 'pg_default', 'ao_tab1', 'testdb');
INSERT INTO foo VALUES ('ao_tab2', 25730, 'pg_default', 'ao_tab2', 'testdb');
-- end_ignore
-- @description varying_with_generate_series_clock_timestamp.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode ORCA_PLANNER_DIFF
-- @tags functionPropertiesBuiltin HAWQ
SELECT count( distinct i ) FROM (SELECT clock_timestamp() i, generate_series(1, 5) j) t;
count
-------
1
(1 row)
-- @description varying_with_generate_series_random.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode ORCA_PLANNER_DIFF
-- @tags functionPropertiesBuiltin HAWQ
SELECT count( distinct i ) FROM (SELECT random() i, generate_series(1, 5) j) t;
count
-------
1
(1 row)
-- @description varying_with_generate_series_timeofday.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode ORCA_PLANNER_DIFF
-- @tags functionPropertiesBuiltin HAWQ
SELECT count( distinct i ) FROM (SELECT timeofday() i, generate_series(1, 5) j) t;
count
-------
1
(1 row)
-- @description varying_fromtable_clock_timestamp.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode gt1
-- @tags functionPropertiesBuiltin HAWQ
SELECT count( distinct i ) > 1 AS gt1 FROM (SELECT clock_timestamp() i from foo) t;
gt1
-----
t
(1 row)
-- @description varying_fromtable_random.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode gt1
-- @tags functionPropertiesBuiltin HAWQ
SELECT count( distinct i ) > 1 AS gt1 FROM (SELECT random() i from foo) t;
gt1
-----
t
(1 row)
-- @description varying_fromtable_timeofday.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode gt1
-- @tags functionPropertiesBuiltin HAWQ
SELECT count( distinct i ) > 1 AS gt1 FROM (SELECT timeofday() i from foo) t;
gt1
-----
t
(1 row)
-- start_ignore
drop schema builtin_dqa cascade;
NOTICE: drop cascades to table foo
-- end_ignore
-- @description varying_fromtable_now.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode NORMAL
-- @tags functionPropertiesBuiltin HAWQ
-- start_ignore
SET gp_optimizer=on;SET gp_log_optimizer=on;
SET
SET
-- end_ignore
SELECT count( distinct i ) FROM (SELECT now() i from foo) t;
count
-------
1
(1 row)
-- @description varying_join_clock_timestamp.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode NORMAL
-- @tags functionPropertiesBuiltin HAWQ
-- start_ignore
SET gp_optimizer=on;SET gp_log_optimizer=on;
SET
SET
-- end_ignore
SELECT count(distinct i ) FROM clock_timestamp() i, foo j;
count
-------
1
(1 row)
-- @description varying_join_now.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode NORMAL
-- @tags functionPropertiesBuiltin HAWQ
-- start_ignore
SET gp_optimizer=on;SET gp_log_optimizer=on;
SET
SET
-- end_ignore
SELECT count(distinct i ) FROM now() i, foo j;
count
-------
1
(1 row)
-- @description varying_join_random.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode NORMAL
-- @tags functionPropertiesBuiltin HAWQ
-- start_ignore
SET gp_optimizer=on;SET gp_log_optimizer=on;
SET
SET
-- end_ignore
SELECT count(distinct i ) FROM random() i, foo j;
count
-------
1
(1 row)
-- @description varying_join_subqry_clock_timestamp.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode NORMAL
-- @tags functionPropertiesBuiltin HAWQ
-- start_ignore
SET gp_optimizer=on;SET gp_log_optimizer=on;
SET
SET
-- end_ignore
SELECT count(distinct i) FROM foo, (SELECT clock_timestamp() i) t;
count
-------
1
(1 row)
-- @description varying_join_subqry_now.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode NORMAL
-- @tags functionPropertiesBuiltin HAWQ
-- start_ignore
SET gp_optimizer=on;SET gp_log_optimizer=on;
SET
SET
-- end_ignore
SELECT count(distinct i) FROM foo, (SELECT now() i) t;
count
-------
1
(1 row)
-- @description varying_join_subqry_random.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode NORMAL
-- @tags functionPropertiesBuiltin HAWQ
-- start_ignore
SET gp_optimizer=on;SET gp_log_optimizer=on;
SET
SET
-- end_ignore
SELECT count(distinct i) FROM foo, (SELECT random() i) t;
count
-------
1
(1 row)
-- @description varying_join_subqry_timeofday.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode NORMAL
-- @tags functionPropertiesBuiltin HAWQ
-- start_ignore
SET gp_optimizer=on;SET gp_log_optimizer=on;
SET
SET
-- end_ignore
SELECT count(distinct i) FROM foo, (SELECT timeofday() i) t;
count
-------
1
(1 row)
-- @description varying_join_timeofday.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode NORMAL
-- @tags functionPropertiesBuiltin HAWQ
-- start_ignore
SET gp_optimizer=on;SET gp_log_optimizer=on;
SET
SET
-- end_ignore
SELECT count(distinct i ) FROM timeofday() i, foo j;
count
-------
1
(1 row)
-- @description varying_with_generate_series_now.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode NORMAL
-- @tags functionPropertiesBuiltin HAWQ
-- start_ignore
SET gp_optimizer=on;SET gp_log_optimizer=on;
SET
SET
-- end_ignore
SELECT count( distinct i ) FROM (SELECT now() i, generate_series(1, 5) j) t;
count
-------
1
(1 row)
-- start_ignore
create schema triggers;
set search_path to triggers;
-- end_ignore
-- start_ignore
DROP TABLE IF EXISTS dml_trigger_table;
NOTICE: table "dml_trigger_table" does not exist, skipping
CREATE TABLE dml_trigger_table
(
name varchar(10),
age numeric(10),
updated_by varchar
)
distributed by (age)
partition by range (age) (
partition p1 start (1) end (25),
partition p2 start (26) end (50),
partition p3 start (51) end (75)
);
NOTICE: CREATE TABLE will create partition "dml_trigger_table_1_prt_p1" for table "dml_trigger_table"
NOTICE: CREATE TABLE will create partition "dml_trigger_table_1_prt_p2" for table "dml_trigger_table"
NOTICE: CREATE TABLE will create partition "dml_trigger_table_1_prt_p3" for table "dml_trigger_table"
CREATE OR REPLACE FUNCTION dml_function_1() RETURNS trigger AS
$$
BEGIN
NEW.updated_by = 'a';
RETURN NEW;
END
$$ LANGUAGE 'plpgsql';
CREATE TRIGGER dml_trigger_1
BEFORE INSERT or UPDATE
ON dml_trigger_table_1_prt_p1
FOR EACH ROW
EXECUTE PROCEDURE dml_function_1();-- end_ignore
--start_ignore
SET client_min_messages='log';
INSERT INTO dml_trigger_table VALUES('TEST',10);
LOG: statement: INSERT INTO dml_trigger_table VALUES('TEST',10);
LOG: 2016-05-31 11:34:12:208463 PDT,THD000,NOTICE,"Feature not supported by the Pivotal Query Optimizer: INSERT with triggers",
LOG: Planner produced plan :0
SET client_min_messages='notice';
LOG: statement: SET client_min_messages='notice';
--end_ignore
SELECT * FROM dml_trigger_table order by 2;
name | age | updated_by
------+-----+------------
TEST | 10 | a
(1 row)
-- start_ignore
DROP TABLE IF EXISTS dml_trigger_table_1;
NOTICE: table "dml_trigger_table_1" does not exist, skipping
CREATE TABLE dml_trigger_table_1
(
name varchar(10),
age numeric(10)
)
distributed by (age);
INSERT INTO dml_trigger_table_1 VALUES('TEST',10);
CREATE OR REPLACE FUNCTION dml_function_1() RETURNS trigger AS
$$
BEGIN
RETURN OLD;
END
$$ LANGUAGE 'plpgsql';
CREATE TRIGGER dml_trigger_1
BEFORE UPDATE or DELETE
ON dml_trigger_table_1
FOR EACH ROW
EXECUTE PROCEDURE dml_function_1();-- end_ignore
SELECT * FROM dml_trigger_table_1 order by 2;
name | age
------+-----
TEST | 10
(1 row)
--start_ignore
SET client_min_messages='log';
DELETE FROM dml_trigger_table_1 where age=10;
LOG: statement: DELETE FROM dml_trigger_table_1 where age=10;
LOG: 2016-05-31 11:34:12:293158 PDT,THD000,NOTICE,"Feature not supported by the Pivotal Query Optimizer: DELETE with triggers",
LOG: Planner produced plan :0
SET client_min_messages='notice';
LOG: statement: SET client_min_messages='notice';
--end_ignore
SELECT * FROM dml_trigger_table_1 order by 2;
name | age
------+-----
(0 rows)
-- start_ignore
DROP TABLE IF EXISTS dml_trigger_table_1;
CREATE TABLE dml_trigger_table_1
(
name varchar(10),
age numeric(10)
)
distributed by (age);
INSERT INTO dml_trigger_table_1 VALUES('TEST',10);
CREATE OR REPLACE FUNCTION dml_function_1() RETURNS trigger AS
$$
BEGIN
RETURN OLD;
END
$$ LANGUAGE 'plpgsql';
CREATE TRIGGER dml_trigger_1
BEFORE UPDATE or INSERT
ON dml_trigger_table_1
FOR EACH ROW
EXECUTE PROCEDURE dml_function_1();-- end_ignore
SELECT * FROM dml_trigger_table_1 order by 2;
name | age
------+-----
TEST | 10
(1 row)
--start_ignore
SET client_min_messages='log';
DELETE FROM dml_trigger_table_1 where age=10;
LOG: statement: DELETE FROM dml_trigger_table_1 where age=10;
SET client_min_messages='notice';
LOG: statement: SET client_min_messages='notice';
--end_ignore
SELECT * FROM dml_trigger_table_1 order by 2;
name | age
------+-----
(0 rows)
-- start_ignore
DROP TABLE IF EXISTS dml_trigger_table_1;
CREATE TABLE dml_trigger_table_1
(
name varchar(10),
age numeric(10),
updated_by varchar
)
distributed by (age);
CREATE OR REPLACE FUNCTION dml_function_1() RETURNS trigger AS
$$
BEGIN
NEW.updated_by = 'a';
RETURN NEW;
END
$$ LANGUAGE 'plpgsql';
CREATE TRIGGER dml_trigger_1
BEFORE INSERT or UPDATE
ON dml_trigger_table_1
FOR EACH ROW
EXECUTE PROCEDURE dml_function_1();-- end_ignore
--start_ignore
SET client_min_messages='log';
INSERT INTO dml_trigger_table_1 VALUES('TEST',10);
LOG: statement: INSERT INTO dml_trigger_table_1 VALUES('TEST',10);
LOG: 2016-05-31 11:34:12:405269 PDT,THD000,NOTICE,"Feature not supported by the Pivotal Query Optimizer: INSERT with triggers",
LOG: Planner produced plan :0
LOG: 2016-05-31 11:34:12:412075 PDT,THD000,NOTICE,"Feature not supported by the Pivotal Query Optimizer: gp_dist_random",
CONTEXT: SQL statement "select sum(gp_statistics_estimate_reltuples_relpages_oid(c.oid))::float4[] from gp_dist_random('pg_class') c where c.oid=2020720"
LOG: Planner produced plan :0
CONTEXT: SQL statement "select sum(gp_statistics_estimate_reltuples_relpages_oid(c.oid))::float4[] from gp_dist_random('pg_class') c where c.oid=2020720"
SET client_min_messages='notice';
LOG: statement: SET client_min_messages='notice';
--end_ignore
SELECT * FROM dml_trigger_table_1 order by 2;
name | age | updated_by
------+-----+------------
TEST | 10 | a
(1 row)
-- start_ignore
DROP TABLE IF EXISTS dml_trigger_table_1;
CREATE TABLE dml_trigger_table_1
(
name varchar(10),
age numeric(10),
updated_by varchar
)
distributed by (age);
CREATE OR REPLACE FUNCTION dml_function_1() RETURNS trigger AS
$$
BEGIN
NEW.updated_by = 'a';
RETURN NEW;
END
$$ LANGUAGE 'plpgsql';
CREATE TRIGGER dml_trigger_1
AFTER DELETE or UPDATE
ON dml_trigger_table_1
FOR EACH ROW
EXECUTE PROCEDURE dml_function_1();-- end_ignore
--start_ignore
SET client_min_messages='log';
INSERT INTO dml_trigger_table_1 VALUES('TEST',10);
LOG: statement: INSERT INTO dml_trigger_table_1 VALUES('TEST',10);
LOG: 2016-05-31 11:34:12:464587 PDT,THD000,NOTICE,"Feature not supported by the Pivotal Query Optimizer: gp_dist_random",
CONTEXT: SQL statement "select sum(gp_statistics_estimate_reltuples_relpages_oid(c.oid))::float4[] from gp_dist_random('pg_class') c where c.oid=2020750"
LOG: Planner produced plan :0
CONTEXT: SQL statement "select sum(gp_statistics_estimate_reltuples_relpages_oid(c.oid))::float4[] from gp_dist_random('pg_class') c where c.oid=2020750"
SET client_min_messages='notice';
LOG: statement: SET client_min_messages='notice';
--end_ignore
SELECT * FROM dml_trigger_table_1 order by 2;
name | age | updated_by
------+-----+------------
TEST | 10 |
(1 row)
-- start_ignore
DROP TABLE IF EXISTS dml_trigger_table_1;
CREATE TABLE dml_trigger_table_1
(
name varchar(10),
age numeric(10),
updated_by varchar
)
distributed by (age);
INSERT INTO dml_trigger_table_1 VALUES('TEST',10);
CREATE OR REPLACE FUNCTION dml_function_1() RETURNS trigger AS
$$
BEGIN
NEW.updated_by = 'a';
RETURN NEW;
END
$$ LANGUAGE 'plpgsql';
CREATE TRIGGER dml_trigger_1
BEFORE INSERT or UPDATE
ON dml_trigger_table_1
FOR EACH ROW
EXECUTE PROCEDURE dml_function_1();-- end_ignore
SELECT * FROM dml_trigger_table_1 order by 2;
name | age | updated_by
------+-----+------------
TEST | 10 |
(1 row)
--start_ignore
SET client_min_messages='log';
UPDATE dml_trigger_table_1 set name='NEW TEST' where name='TEST';
LOG: statement: UPDATE dml_trigger_table_1 set name='NEW TEST' where name='TEST';
LOG: 2016-05-31 11:34:12:564410 PDT,THD000,NOTICE,"Feature not supported by the Pivotal Query Optimizer: UPDATE with triggers",
LOG: Planner produced plan :0
SET client_min_messages='notice';
LOG: statement: SET client_min_messages='notice';
--end_ignore
SELECT * FROM dml_trigger_table_1 order by 2;
name | age | updated_by
----------+-----+------------
NEW TEST | 10 | a
(1 row)
-- start_ignore
DROP TABLE IF EXISTS dml_trigger_table_1;
CREATE TABLE dml_trigger_table_1
(
name varchar(10),
age numeric(10),
updated_by varchar
)
distributed by (age);
INSERT INTO dml_trigger_table_1 VALUES('TEST',10);
CREATE OR REPLACE FUNCTION dml_function_1() RETURNS trigger AS
$$
BEGIN
NEW.updated_by = 'a';
RETURN NEW;
END
$$ LANGUAGE 'plpgsql';
CREATE TRIGGER dml_trigger_1
BEFORE INSERT or DELETE
ON dml_trigger_table_1
FOR EACH ROW
EXECUTE PROCEDURE dml_function_1();-- end_ignore
SELECT * FROM dml_trigger_table_1 order by 2;
name | age | updated_by
------+-----+------------
TEST | 10 |
(1 row)
--start_ignore
SET client_min_messages='log';
UPDATE dml_trigger_table_1 set name='NEW TEST' where name='TEST';
LOG: statement: UPDATE dml_trigger_table_1 set name='NEW TEST' where name='TEST';
SET client_min_messages='notice';
LOG: statement: SET client_min_messages='notice';
--end_ignore
SELECT * FROM dml_trigger_table_1 order by 2;
name | age | updated_by
----------+-----+------------
NEW TEST | 10 |
(1 row)
-- start_ignore
drop schema triggers cascade;
NOTICE: drop cascades to function dml_function_1()
NOTICE: drop cascades to trigger dml_trigger_1 on table dml_trigger_table_1
NOTICE: drop cascades to trigger dml_trigger_1 on table dml_trigger_table_1_prt_p1
NOTICE: drop cascades to table dml_trigger_table_1
NOTICE: drop cascades to table dml_trigger_table_1_prt_p3
NOTICE: drop cascades to constraint dml_trigger_table_1_prt_p3_check on table dml_trigger_table_1_prt_p3
NOTICE: drop cascades to table dml_trigger_table_1_prt_p2
NOTICE: drop cascades to constraint dml_trigger_table_1_prt_p2_check on table dml_trigger_table_1_prt_p2
NOTICE: drop cascades to table dml_trigger_table_1_prt_p1
NOTICE: drop cascades to constraint dml_trigger_table_1_prt_p1_check on table dml_trigger_table_1_prt_p1
NOTICE: drop cascades to table dml_trigger_table
-- end_ignore
# ----------
# Optimizer functional test suite
# Optimizer functional test suite part 1
# ----------
test: composite_keys_gpdb_1 composite_keys_gpdb_2 composite_keys_gpdb_3
test: composite_keys_gpdb_1 composite_keys_gpdb_2 composite_keys_gpdb_3 builtin_normal builtin_dqa
test: partitionindexes
test: staticselection
test: cte_functest_inlining_enabled cte_queries_inlining_enabled
......@@ -9,3 +9,11 @@ test: cte_queries_inlining_disabled cte_functest_inlining_disabled
test: lastj lastj_hash lineitem create_table_default_distribution_on create_table_default_distribution_off indexapply create_table_as_11_alter_table
test: analyze_rootpartition
# ----------
# Optimizer functional test suite part 2
# ----------
test: of_partition_1 of_partition_2 of_partition_3 of_partition_4 of_partition_5 of_partition_6 of_partition_7 of_partition_8 of_partition_9 of_partition_10 of_partition_11
test: of_triggers of_groupingfunction
test: dml_functional_1 dml_functional_2 dml_functional_3 dml_functional_4 dml_functional_5 dml_functional_6 dml_functional_7
test: functionProperty_01 functionProperty_02 functionProperty_03 functionProperty_04 functionProperty_05 functionProperty_06 functionProperty_07 functionProperty_08 functionProperty_09
test: functionProperty_10 functionProperty_11 functionProperty_12 functionProperty_13 functionProperty_14 functionProperty_15 functionProperty_16 functionProperty_17 functionProperty_18
-- start_ignore
create schema builtin_dqa;
set search_path to builtin_dqa;
CREATE TABLE foo (a text, b int, c text, d text, e text);
INSERT INTO foo VALUES ('foo', 12000, 'pg_default', 'ao_tab1', 'testdb');
INSERT INTO foo VALUES ('bar', 4045, 'pg_default', 'ao_tab2', 'testdb');
INSERT INTO foo VALUES ('ao_tab1', 573, 'pg_default', 'ao_tab1', 'testdb');
INSERT INTO foo VALUES ('ao_tab2', 25730, 'pg_default', 'ao_tab2', 'testdb');
-- end_ignore
-- @description varying_with_generate_series_clock_timestamp.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode ORCA_PLANNER_DIFF
-- @tags functionPropertiesBuiltin HAWQ
SELECT count( distinct i ) FROM (SELECT clock_timestamp() i, generate_series(1, 5) j) t;
-- @description varying_with_generate_series_random.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode ORCA_PLANNER_DIFF
-- @tags functionPropertiesBuiltin HAWQ
SELECT count( distinct i ) FROM (SELECT random() i, generate_series(1, 5) j) t;
-- @description varying_with_generate_series_timeofday.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode ORCA_PLANNER_DIFF
-- @tags functionPropertiesBuiltin HAWQ
SELECT count( distinct i ) FROM (SELECT timeofday() i, generate_series(1, 5) j) t;
-- @description varying_fromtable_clock_timestamp.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode gt1
-- @tags functionPropertiesBuiltin HAWQ
SELECT count( distinct i ) > 1 AS gt1 FROM (SELECT clock_timestamp() i from foo) t;
-- @description varying_fromtable_random.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode gt1
-- @tags functionPropertiesBuiltin HAWQ
SELECT count( distinct i ) > 1 AS gt1 FROM (SELECT random() i from foo) t;
-- @description varying_fromtable_timeofday.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode gt1
-- @tags functionPropertiesBuiltin HAWQ
SELECT count( distinct i ) > 1 AS gt1 FROM (SELECT timeofday() i from foo) t;
-- start_ignore
drop schema builtin_dqa cascade;
-- end_ignore
-- start_ignore
create schema builtin_normal;
set search_path to builtin_normal;
DROP TABLE foo;
DROP TABLE bar;
CREATE TABLE foo (a text, b int, c text, d text, e text);
INSERT INTO foo VALUES ('foo', 12000, 'pg_default', 'ao_tab1', 'testdb');
INSERT INTO foo VALUES ('bar', 4045, 'pg_default', 'ao_tab2', 'testdb');
INSERT INTO foo VALUES ('ao_tab1', 573, 'pg_default', 'ao_tab1', 'testdb');
INSERT INTO foo VALUES ('ao_tab2', 25730, 'pg_default', 'ao_tab2', 'testdb');
CREATE TABLE bar (x int, y int);
INSERT INTO bar SELECT i, i+1 FROM generate_series(1,10) i;
CREATE TABLE ao_tab1 (r int, s int) WITH (appendonly=true, compresslevel=6);
INSERT INTO ao_tab1 SELECT i, i+1 FROM generate_series(1,20) i;
CREATE TABLE ao_tab2 (r int, s int) WITH (appendonly=true);
INSERT INTO ao_tab2 SELECT i, i*100 FROM generate_series(1,200) i;
-- end_ignore
-- @description varying_fromtable_now.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode NORMAL
-- @tags functionPropertiesBuiltin HAWQ
SELECT count( distinct i ) FROM (SELECT now() i from foo) t;
-- @description varying_join_clock_timestamp.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode NORMAL
-- @tags functionPropertiesBuiltin HAWQ
SELECT count(distinct i ) FROM clock_timestamp() i, foo j;
-- @description varying_join_now.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode NORMAL
-- @tags functionPropertiesBuiltin HAWQ
SELECT count(distinct i ) FROM now() i, foo j;
-- @description varying_join_random.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode NORMAL
-- @tags functionPropertiesBuiltin HAWQ
SELECT count(distinct i ) FROM random() i, foo j;
-- @description varying_join_subqry_clock_timestamp.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode NORMAL
-- @tags functionPropertiesBuiltin HAWQ
SELECT count(distinct i) FROM foo, (SELECT clock_timestamp() i) t;
-- @description varying_join_subqry_now.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode NORMAL
-- @tags functionPropertiesBuiltin HAWQ
SELECT count(distinct i) FROM foo, (SELECT now() i) t;
-- @description varying_join_subqry_random.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode NORMAL
-- @tags functionPropertiesBuiltin HAWQ
SELECT count(distinct i) FROM foo, (SELECT random() i) t;
-- @description varying_join_subqry_timeofday.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode NORMAL
-- @tags functionPropertiesBuiltin HAWQ
SELECT count(distinct i) FROM foo, (SELECT timeofday() i) t;
-- @description varying_join_timeofday.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode NORMAL
-- @tags functionPropertiesBuiltin HAWQ
SELECT count(distinct i ) FROM timeofday() i, foo j;
-- @description varying_with_generate_series_now.sql
-- @db_name builtin_functionproperty
-- @author tungs1
-- @modified 2013-04-17 12:00:00
-- @created 2013-04-17 12:00:00
-- @executemode NORMAL
-- @tags functionPropertiesBuiltin HAWQ
SELECT count( distinct i ) FROM (SELECT now() i, generate_series(1, 5) j) t;
-- start_ignore
drop schema builtin_normal cascade;
-- end_ignore
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
-- start_ignore
create schema functionProperty_1701_1714;
set search_path to functionProperty_1701_1714;
CREATE TABLE foo (a int, b int);
INSERT INTO foo select i, i+1 from generate_series(1,10) i;
CREATE TABLE bar (c int, d int);
INSERT INTO bar select i, i+1 from generate_series(1,10) i;
-- func1 IMMUTABLE
CREATE FUNCTION func1_nosql_imm(x int) RETURNS int AS $$
BEGIN
RETURN $1 +1;
END
$$ LANGUAGE plpgsql NO SQL IMMUTABLE;
CREATE FUNCTION func1_sql_int_imm(x int) RETURNS int AS $$
DECLARE
r int;
BEGIN
SELECT $1 + 1 INTO r;
return r;
END
$$ LANGUAGE plpgsql CONTAINS SQL IMMUTABLE;
CREATE FUNCTION func1_sql_setint_imm(x int) RETURNS setof int AS $$
DECLARE
r int;
BEGIN
FOR r in SELECT generate_series($1, $1+5)
LOOP
RETURN NEXT r;
END LOOP;
RETURN;
END
$$ LANGUAGE plpgsql CONTAINS SQL IMMUTABLE;
--CREATE FUNCTION func1_read_int_sql_imm(x int) RETURNS int AS $$
--DECLARE
-- r int;
--BEGIN
-- SELECT d FROM bar WHERE c = $1 LIMIT 1 INTO r;
-- return r;
--END
--$$ LANGUAGE plpgsql IMMUTABLE READS SQL DATA;
--
--CREATE FUNCTION func1_read_setint_sql_imm(x int) RETURNS setof int AS $$
--DECLARE
-- r int;
--BEGIN
-- FOR r in SELECT d FROM bar WHERE c <> $1
-- LOOP
-- RETURN NEXT r;
-- END LOOP;
-- RETURN;
--END
--$$ LANGUAGE plpgsql IMMUTABLE READS SQL DATA;
--
--CREATE FUNCTION func1_mod_int_imm(x int) RETURNS int AS $$
--BEGIN
--UPDATE bar SET d = d+1 WHERE c = $1;
--RETURN $1 + 1;
--END
--$$ LANGUAGE plpgsql IMMUTABLE MODIFIES SQL DATA;
--
--CREATE FUNCTION func1_mod_setint_imm(x int) RETURNS setof int AS $$
--DECLARE
-- r int;
--BEGIN
-- UPDATE bar SET d = d+1 WHERE c > $1;
-- FOR r in SELECT d FROM bar WHERE c > $1
-- LOOP
-- RETURN NEXT r;
-- END LOOP;
-- RETURN;
--END
--$$ LANGUAGE plpgsql MODIFIES SQL DATA IMMUTABLE;
--
----func2 IMMUTABLE
CREATE FUNCTION func2_nosql_imm(x int) RETURNS int AS $$
BEGIN
RETURN $1 + 1;
END
$$ LANGUAGE plpgsql NO SQL IMMUTABLE;
CREATE FUNCTION func2_sql_int_imm(x int) RETURNS int AS $$
DECLARE
r int;
BEGIN
SELECT $1 + 1 INTO r;
RETURN r;
END
$$ LANGUAGE plpgsql CONTAINS SQL IMMUTABLE;
--
--CREATE FUNCTION func2_read_int_imm(x int) RETURNS int AS $$
--DECLARE
-- r int;
--BEGIN
-- SELECT d FROM bar WHERE c = $1 LIMIT 1 INTO r;
-- RETURN r;
--END
--$$ LANGUAGE plpgsql IMMUTABLE READS SQL DATA;
--
--CREATE FUNCTION func2_mod_int_imm(x int) RETURNS int AS $$
--BEGIN
--UPDATE bar SET d = d+1 WHERE c = $1;
--RETURN $1 + 1;
--END
--$$ LANGUAGE plpgsql IMMUTABLE MODIFIES SQL DATA;
-- func1 STABLE
CREATE FUNCTION func1_nosql_stb(x int) RETURNS int AS $$
BEGIN
RETURN $1 +1;
END
$$ LANGUAGE plpgsql STABLE NO SQL;
CREATE FUNCTION func1_sql_int_stb(x int) RETURNS int AS $$
DECLARE
r int;
BEGIN
SELECT $1 + 1 INTO r;
RETURN r;
END
$$ LANGUAGE plpgsql STABLE CONTAINS SQL;
CREATE FUNCTION func1_sql_setint_stb(x int) RETURNS setof int AS $$
DECLARE
r int;
BEGIN
FOR r in SELECT generate_series($1, $1+5)
LOOP
RETURN NEXT r;
END LOOP;
RETURN;
END
$$ LANGUAGE plpgsql STABLE CONTAINS SQL;
CREATE FUNCTION func1_read_int_sql_stb(x int) RETURNS int AS $$
DECLARE
r int;
BEGIN
SELECT d FROM bar WHERE c = $1 LIMIT 1 INTO r;
RETURN r;
END
$$ LANGUAGE plpgsql STABLE READS SQL DATA;
CREATE FUNCTION func1_read_setint_sql_stb(x int) RETURNS setof int AS $$
DECLARE
r int;
BEGIN
FOR r in SELECT d FROM bar WHERE c <> $1
LOOP
RETURN NEXT r;
END LOOP;
RETURN;
END
$$ LANGUAGE plpgsql STABLE READS SQL DATA;
CREATE FUNCTION func1_mod_int_stb(x int) RETURNS int AS $$
BEGIN
UPDATE bar SET d = d+1 WHERE c = $1;
RETURN $1 + 1;
END
$$ LANGUAGE plpgsql STABLE MODIFIES SQL DATA;
CREATE FUNCTION func1_mod_setint_stb(x int) RETURNS setof int AS $$
DECLARE
r int;
BEGIN
UPDATE bar SET d = d+1 WHERE c > $1;
FOR r in SELECT d FROM bar WHERE c > $1
LOOP
RETURN NEXT r;
END LOOP;
RETURN;
END
$$ LANGUAGE plpgsql STABLE MODIFIES SQL DATA;
--func2 STABLE
CREATE FUNCTION func2_nosql_stb(x int) RETURNS int AS $$
BEGIN
RETURN $1 + 1;
END
$$ LANGUAGE plpgsql STABLE NO SQL;
CREATE FUNCTION func2_sql_int_stb(x int) RETURNS int AS $$
DECLARE
r int;
BEGIN
SELECT $1 + 1 INTO r;
RETURN r;
END
$$ LANGUAGE plpgsql STABLE CONTAINS SQL;
CREATE FUNCTION func2_read_int_stb(x int) RETURNS int AS $$
DECLARE
r int;
BEGIN
SELECT d FROM bar WHERE c = $1 LIMIT 1 INTO r;
RETURN r;
END
$$ LANGUAGE plpgsql STABLE READS SQL DATA;
CREATE FUNCTION func2_mod_int_stb(x int) RETURNS int AS $$
BEGIN
UPDATE bar SET d = d+1 WHERE c = $1;
RETURN $1 + 1;
END
$$ LANGUAGE plpgsql STABLE MODIFIES SQL DATA;
-- func1 VOLATILE
CREATE FUNCTION func1_nosql_vol(x int) RETURNS int AS $$
BEGIN
RETURN $1 +1;
END
$$ LANGUAGE plpgsql VOLATILE NO SQL;
CREATE FUNCTION func1_sql_int_vol(x int) RETURNS int AS $$
DECLARE
r int;
BEGIN
SELECT $1 + 1 INTO r;
RETURN r;
END
$$ LANGUAGE plpgsql VOLATILE CONTAINS SQL;
CREATE FUNCTION func1_sql_setint_vol(x int) RETURNS setof int AS $$
DECLARE
r int;
BEGIN
FOR r in SELECT generate_series($1, $1+5)
LOOP
RETURN NEXT r;
END LOOP;
RETURN;
END
$$ LANGUAGE plpgsql VOLATILE CONTAINS SQL;
CREATE FUNCTION func1_read_int_sql_vol(x int) RETURNS int AS $$
DECLARE
r int;
BEGIN
SELECT d FROM bar WHERE c = $1 LIMIT 1 INTO r;
RETURN r;
END
$$ LANGUAGE plpgsql VOLATILE READS SQL DATA;
CREATE FUNCTION func1_read_setint_sql_vol(x int) RETURNS setof int AS $$
DECLARE
r int;
BEGIN
FOR r in SELECT d FROM bar WHERE c <> $1
LOOP
RETURN NEXT r;
END LOOP;
RETURN;
END
$$ LANGUAGE plpgsql VOLATILE READS SQL DATA;
CREATE FUNCTION func1_mod_int_vol(x int) RETURNS int AS $$
BEGIN
UPDATE bar SET d = d+1 WHERE c = $1;
RETURN $1 + 1;
END
$$ LANGUAGE plpgsql VOLATILE MODIFIES SQL DATA;
CREATE FUNCTION func1_mod_setint_vol(x int) RETURNS setof int AS $$
DECLARE
r int;
BEGIN
UPDATE bar SET d = d+1 WHERE c > $1;
FOR r in SELECT d FROM bar WHERE c > $1
LOOP
RETURN NEXT r;
END LOOP;
RETURN;
END
$$ LANGUAGE plpgsql VOLATILE MODIFIES SQL DATA;
--func2 VOLATILE
CREATE FUNCTION func2_nosql_vol(x int) RETURNS int AS $$
BEGIN
RETURN $1 + 1;
END
$$ LANGUAGE plpgsql VOLATILE NO SQL;
CREATE FUNCTION func2_sql_int_vol(x int) RETURNS int AS $$
DECLARE
r int;
BEGIN
SELECT $1 + 1 INTO r;
RETURN r;
END
$$ LANGUAGE plpgsql VOLATILE CONTAINS SQL;
CREATE FUNCTION func2_read_int_vol(x int) RETURNS int AS $$
DECLARE
r int;
BEGIN
SELECT d FROM bar WHERE c = $1 LIMIT 1 INTO r;
RETURN r;
END
$$ LANGUAGE plpgsql VOLATILE READS SQL DATA;
CREATE FUNCTION func2_mod_int_vol(x int) RETURNS int AS $$
BEGIN
UPDATE bar SET d = d+1 WHERE c = $1;
RETURN $1 + 1;
END
$$ LANGUAGE plpgsql VOLATILE MODIFIES SQL DATA;
-- end_ignore
-- start_ignore
DROP TABLE foo;
DROP TABLE bar;
CREATE TABLE foo (a int, b int);
INSERT INTO foo select i, i+1 from generate_series(1,10) i;
CREATE TABLE bar (c int, d int);
INSERT INTO bar select i, i+1 from generate_series(1,10) i;
-- end_ignore
-- @description function_in_with_withfunc2_64.sql
-- @db_name functionproperty
-- @author tungs1
-- @modified 2013-04-03 12:00:00
-- @created 2013-04-03 12:00:00
-- @tags functionProperties
WITH v(a, b) AS (SELECT func1_sql_setint_vol(func2_sql_int_stb(a)), b FROM foo WHERE b < 5) SELECT v1.a, v2.b FROM v AS v1, v AS v2 WHERE v1.a < v2.a order by v1.a, v2.b;
-- start_ignore
DROP TABLE foo;
DROP TABLE bar;
CREATE TABLE foo (a int, b int);
INSERT INTO foo select i, i+1 from generate_series(1,10) i;
CREATE TABLE bar (c int, d int);
INSERT INTO bar select i, i+1 from generate_series(1,10) i;
-- end_ignore
-- @description function_in_with_withfunc2_65.sql
-- @db_name functionproperty
-- @author tungs1
-- @modified 2013-04-03 12:00:00
-- @created 2013-04-03 12:00:00
-- @tags functionProperties
WITH v(a, b) AS (SELECT func1_sql_setint_vol(func2_sql_int_imm(a)), b FROM foo WHERE b < 5) SELECT v1.a, v2.b FROM v AS v1, v AS v2 WHERE v1.a < v2.a order by v1.a, v2.b;
-- start_ignore
DROP TABLE foo;
DROP TABLE bar;
CREATE TABLE foo (a int, b int);
INSERT INTO foo select i, i+1 from generate_series(1,10) i;
CREATE TABLE bar (c int, d int);
INSERT INTO bar select i, i+1 from generate_series(1,10) i;
-- end_ignore
-- @description function_in_with_withfunc2_70.sql
-- @db_name functionproperty
-- @author tungs1
-- @modified 2013-04-03 12:00:00
-- @created 2013-04-03 12:00:00
-- @tags functionProperties
WITH v(a, b) AS (SELECT func1_sql_setint_stb(func2_nosql_vol(a)), b FROM foo WHERE b < 5) SELECT v1.a, v2.b FROM v AS v1, v AS v2 WHERE v1.a < v2.a order by v1.a, v2.b;
-- start_ignore
DROP TABLE foo;
DROP TABLE bar;
CREATE TABLE foo (a int, b int);
INSERT INTO foo select i, i+1 from generate_series(1,10) i;
CREATE TABLE bar (c int, d int);
INSERT INTO bar select i, i+1 from generate_series(1,10) i;
-- end_ignore
-- @description function_in_with_withfunc2_71.sql
-- @db_name functionproperty
-- @author tungs1
-- @modified 2013-04-03 12:00:00
-- @created 2013-04-03 12:00:00
-- @tags functionProperties
WITH v(a, b) AS (SELECT func1_sql_setint_stb(func2_nosql_stb(a)), b FROM foo WHERE b < 5) SELECT v1.a, v2.b FROM v AS v1, v AS v2 WHERE v1.a < v2.a order by v1.a, v2.b;
-- start_ignore
DROP TABLE foo;
DROP TABLE bar;
CREATE TABLE foo (a int, b int);
INSERT INTO foo select i, i+1 from generate_series(1,10) i;
CREATE TABLE bar (c int, d int);
INSERT INTO bar select i, i+1 from generate_series(1,10) i;
-- end_ignore
-- @description function_in_with_withfunc2_72.sql
-- @db_name functionproperty
-- @author tungs1
-- @modified 2013-04-03 12:00:00
-- @created 2013-04-03 12:00:00
-- @tags functionProperties
WITH v(a, b) AS (SELECT func1_sql_setint_stb(func2_nosql_imm(a)), b FROM foo WHERE b < 5) SELECT v1.a, v2.b FROM v AS v1, v AS v2 WHERE v1.a < v2.a order by v1.a, v2.b;
-- start_ignore
DROP TABLE foo;
DROP TABLE bar;
CREATE TABLE foo (a int, b int);
INSERT INTO foo select i, i+1 from generate_series(1,10) i;
CREATE TABLE bar (c int, d int);
INSERT INTO bar select i, i+1 from generate_series(1,10) i;
-- end_ignore
-- @description function_in_with_withfunc2_73.sql
-- @db_name functionproperty
-- @author tungs1
-- @modified 2013-04-03 12:00:00
-- @created 2013-04-03 12:00:00
-- @tags functionProperties
WITH v(a, b) AS (SELECT func1_sql_setint_stb(func2_sql_int_vol(a)), b FROM foo WHERE b < 5) SELECT v1.a, v2.b FROM v AS v1, v AS v2 WHERE v1.a < v2.a order by v1.a, v2.b;
-- start_ignore
DROP TABLE foo;
DROP TABLE bar;
CREATE TABLE foo (a int, b int);
INSERT INTO foo select i, i+1 from generate_series(1,10) i;
CREATE TABLE bar (c int, d int);
INSERT INTO bar select i, i+1 from generate_series(1,10) i;
-- end_ignore
-- @description function_in_with_withfunc2_74.sql
-- @db_name functionproperty
-- @author tungs1
-- @modified 2013-04-03 12:00:00
-- @created 2013-04-03 12:00:00
-- @tags functionProperties
WITH v(a, b) AS (SELECT func1_sql_setint_stb(func2_sql_int_stb(a)), b FROM foo WHERE b < 5) SELECT v1.a, v2.b FROM v AS v1, v AS v2 WHERE v1.a < v2.a order by v1.a, v2.b;
-- start_ignore
DROP TABLE foo;
DROP TABLE bar;
CREATE TABLE foo (a int, b int);
INSERT INTO foo select i, i+1 from generate_series(1,10) i;
CREATE TABLE bar (c int, d int);
INSERT INTO bar select i, i+1 from generate_series(1,10) i;
-- end_ignore
-- @description function_in_with_withfunc2_75.sql
-- @db_name functionproperty
-- @author tungs1
-- @modified 2013-04-03 12:00:00
-- @created 2013-04-03 12:00:00
-- @tags functionProperties
WITH v(a, b) AS (SELECT func1_sql_setint_stb(func2_sql_int_imm(a)), b FROM foo WHERE b < 5) SELECT v1.a, v2.b FROM v AS v1, v AS v2 WHERE v1.a < v2.a order by v1.a, v2.b;
-- start_ignore
DROP TABLE foo;
DROP TABLE bar;
CREATE TABLE foo (a int, b int);
INSERT INTO foo select i, i+1 from generate_series(1,10) i;
CREATE TABLE bar (c int, d int);
INSERT INTO bar select i, i+1 from generate_series(1,10) i;
-- end_ignore
-- @description function_in_with_withfunc2_80.sql
-- @db_name functionproperty
-- @author tungs1
-- @modified 2013-04-03 12:00:00
-- @created 2013-04-03 12:00:00
-- @tags functionProperties
WITH v(a, b) AS (SELECT func1_sql_setint_imm(func2_nosql_vol(a)), b FROM foo WHERE b < 5) SELECT v1.a, v2.b FROM v AS v1, v AS v2 WHERE v1.a < v2.a order by v1.a, v2.b;
-- start_ignore
DROP TABLE foo;
DROP TABLE bar;
CREATE TABLE foo (a int, b int);
INSERT INTO foo select i, i+1 from generate_series(1,10) i;
CREATE TABLE bar (c int, d int);
INSERT INTO bar select i, i+1 from generate_series(1,10) i;
-- end_ignore
-- @description function_in_with_withfunc2_81.sql
-- @db_name functionproperty
-- @author tungs1
-- @modified 2013-04-03 12:00:00
-- @created 2013-04-03 12:00:00
-- @tags functionProperties
WITH v(a, b) AS (SELECT func1_sql_setint_imm(func2_nosql_stb(a)), b FROM foo WHERE b < 5) SELECT v1.a, v2.b FROM v AS v1, v AS v2 WHERE v1.a < v2.a order by v1.a, v2.b;
-- start_ignore
DROP TABLE foo;
DROP TABLE bar;
CREATE TABLE foo (a int, b int);
INSERT INTO foo select i, i+1 from generate_series(1,10) i;
CREATE TABLE bar (c int, d int);
INSERT INTO bar select i, i+1 from generate_series(1,10) i;
-- end_ignore
-- @description function_in_with_withfunc2_82.sql
-- @db_name functionproperty
-- @author tungs1
-- @modified 2013-04-03 12:00:00
-- @created 2013-04-03 12:00:00
-- @tags functionProperties
WITH v(a, b) AS (SELECT func1_sql_setint_imm(func2_nosql_imm(a)), b FROM foo WHERE b < 5) SELECT v1.a, v2.b FROM v AS v1, v AS v2 WHERE v1.a < v2.a order by v1.a, v2.b;
-- start_ignore
DROP TABLE foo;
DROP TABLE bar;
CREATE TABLE foo (a int, b int);
INSERT INTO foo select i, i+1 from generate_series(1,10) i;
CREATE TABLE bar (c int, d int);
INSERT INTO bar select i, i+1 from generate_series(1,10) i;
-- end_ignore
-- @description function_in_with_withfunc2_83.sql
-- @db_name functionproperty
-- @author tungs1
-- @modified 2013-04-03 12:00:00
-- @created 2013-04-03 12:00:00
-- @tags functionProperties
WITH v(a, b) AS (SELECT func1_sql_setint_imm(func2_sql_int_vol(a)), b FROM foo WHERE b < 5) SELECT v1.a, v2.b FROM v AS v1, v AS v2 WHERE v1.a < v2.a order by v1.a, v2.b;
-- start_ignore
DROP TABLE foo;
DROP TABLE bar;
CREATE TABLE foo (a int, b int);
INSERT INTO foo select i, i+1 from generate_series(1,10) i;
CREATE TABLE bar (c int, d int);
INSERT INTO bar select i, i+1 from generate_series(1,10) i;
-- end_ignore
-- @description function_in_with_withfunc2_84.sql
-- @db_name functionproperty
-- @author tungs1
-- @modified 2013-04-03 12:00:00
-- @created 2013-04-03 12:00:00
-- @tags functionProperties
WITH v(a, b) AS (SELECT func1_sql_setint_imm(func2_sql_int_stb(a)), b FROM foo WHERE b < 5) SELECT v1.a, v2.b FROM v AS v1, v AS v2 WHERE v1.a < v2.a order by v1.a, v2.b;
-- start_ignore
DROP TABLE foo;
DROP TABLE bar;
CREATE TABLE foo (a int, b int);
INSERT INTO foo select i, i+1 from generate_series(1,10) i;
CREATE TABLE bar (c int, d int);
INSERT INTO bar select i, i+1 from generate_series(1,10) i;
-- end_ignore
-- @description function_in_with_withfunc2_85.sql
-- @db_name functionproperty
-- @author tungs1
-- @modified 2013-04-03 12:00:00
-- @created 2013-04-03 12:00:00
-- @tags functionProperties
WITH v(a, b) AS (SELECT func1_sql_setint_imm(func2_sql_int_imm(a)), b FROM foo WHERE b < 5) SELECT v1.a, v2.b FROM v AS v1, v AS v2 WHERE v1.a < v2.a order by v1.a, v2.b;
-- start_ignore
drop schema functionProperty_1701_1714 cascade;
-- end_ignore
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -8,8 +8,9 @@ INSERT INTO ABSTIME_HOROLOGY_TBL (f1) VALUES ('Jan 14, 1973 03:14:21'),
(abstime 'epoch'),
(abstime 'infinity'),
(abstime '-infinity'),
(abstime 'May 10, 1947 23:59:12'),
('Jun 10, 1843');
(abstime 'May 10, 1947 23:59:12');
INSERT INTO ABSTIME_HOROLOGY_TBL (f1) VALUES('Jun 10, 1843');
CREATE TABLE INTERVAL_HOROLOGY_TBL (f1 interval);
INSERT INTO INTERVAL_HOROLOGY_TBL (f1) VALUES ('@ 1 minute'),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册