diff --git a/java/yb-pgsql/src/test/java/org/yb/pgsql/TestPgRegressDml.java b/java/yb-pgsql/src/test/java/org/yb/pgsql/TestPgRegressDml.java index 2cf1716b9c93..b8410f657b42 100644 --- a/java/yb-pgsql/src/test/java/org/yb/pgsql/TestPgRegressDml.java +++ b/java/yb-pgsql/src/test/java/org/yb/pgsql/TestPgRegressDml.java @@ -1,4 +1,4 @@ -// Copyright (c) YugaByte, Inc. +// Copyright (c) YugabyteDB, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except // in compliance with the License. You may obtain a copy of the License at @@ -27,7 +27,7 @@ public int getTestMethodTimeoutSec() { } @Test - public void testPgRegressDml() throws Exception { - runPgRegressTest("yb_pg_dml_serial_schedule"); + public void schedule() throws Exception { + runPgRegressTest("yb_dml_serial_schedule"); } } diff --git a/java/yb-pgsql/src/test/java/org/yb/pgsql/TestPgRegressPgDml.java b/java/yb-pgsql/src/test/java/org/yb/pgsql/TestPgRegressPgDml.java new file mode 100644 index 000000000000..6d2413afcd94 --- /dev/null +++ b/java/yb-pgsql/src/test/java/org/yb/pgsql/TestPgRegressPgDml.java @@ -0,0 +1,33 @@ +// Copyright (c) YugabyteDB, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software distributed under the License +// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +// or implied. See the License for the specific language governing permissions and limitations +// under the License. +// +package org.yb.pgsql; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.yb.YBTestRunner; + +/** + * Runs the pg_regress test suite on YB code. + */ +@RunWith(value=YBTestRunner.class) +public class TestPgRegressPgDml extends BasePgRegressTestSequentialYbrowid { + @Override + public int getTestMethodTimeoutSec() { + return 1800; + } + + @Test + public void schedule() throws Exception { + runPgRegressTest("yb_pg_dml_serial_schedule"); + } +} diff --git a/src/postgres/src/test/regress/expected/yb_pg_alter_generic.out b/src/postgres/src/test/regress/expected/yb_pg_alter_generic.out index 193efcdd1394..0bf3d06d9fc9 100644 --- a/src/postgres/src/test/regress/expected/yb_pg_alter_generic.out +++ b/src/postgres/src/test/regress/expected/yb_pg_alter_generic.out @@ -374,6 +374,7 @@ ERROR: current transaction is aborted, commands ignored until end of transactio DROP OPERATOR FAMILY alt_opf5 USING btree; ERROR: current transaction is aborted, commands ignored until end of transaction block ROLLBACK; +DROP OPERATOR FAMILY alt_opf5 USING btree; -- YB: workaround for lack of transactional DDL -- Should fail. Need rights to namespace for ALTER OPERATOR FAMILY .. ADD / DROP BEGIN TRANSACTION; CREATE ROLE regress_alter_generic_user6; @@ -418,6 +419,8 @@ ERROR: btree comparison functions must return integer DROP OPERATOR FAMILY alt_opf12 USING btree; ERROR: current transaction is aborted, commands ignored until end of transaction block ROLLBACK; +DROP FUNCTION fn_opf12 (int4, int2); -- YB: workaround for lack of transactional DDL +DROP OPERATOR FAMILY alt_opf12 USING btree; -- YB: workaround for lack of transactional DDL -- Should fail. hash comparison functions should return INTEGER in ALTER OPERATOR FAMILY ... ADD FUNCTION BEGIN TRANSACTION; CREATE OPERATOR FAMILY alt_opf13 USING hash; @@ -427,6 +430,8 @@ ERROR: hash function 1 must return integer DROP OPERATOR FAMILY alt_opf13 USING hash; ERROR: current transaction is aborted, commands ignored until end of transaction block ROLLBACK; +DROP FUNCTION fn_opf13 (int4); -- YB: workaround for lack of transactional DDL +DROP OPERATOR FAMILY alt_opf13 USING hash; -- YB: workaround for lack of transactional DDL -- Should fail. btree comparison functions should have two arguments in ALTER OPERATOR FAMILY ... ADD FUNCTION BEGIN TRANSACTION; CREATE OPERATOR FAMILY alt_opf14 USING btree; @@ -436,6 +441,8 @@ ERROR: btree comparison functions must have two arguments DROP OPERATOR FAMILY alt_opf14 USING btree; ERROR: current transaction is aborted, commands ignored until end of transaction block ROLLBACK; +DROP FUNCTION fn_opf14 (int4); -- YB: workaround for lack of transactional DDL +DROP OPERATOR FAMILY alt_opf14 USING btree; -- YB: workaround for lack of transactional DDL -- Should fail. hash comparison functions should have one argument in ALTER OPERATOR FAMILY ... ADD FUNCTION BEGIN TRANSACTION; CREATE OPERATOR FAMILY alt_opf15 USING hash; @@ -445,6 +452,8 @@ ERROR: hash function 1 must have one argument DROP OPERATOR FAMILY alt_opf15 USING hash; ERROR: current transaction is aborted, commands ignored until end of transaction block ROLLBACK; +DROP FUNCTION fn_opf15 (int4, int2); -- YB: workaround for lack of transactional DDL +DROP OPERATOR FAMILY alt_opf15 USING hash; -- YB: workaround for lack of transactional DDL -- Should fail. In gist throw an error when giving different data types for function argument -- without defining left / right type in ALTER OPERATOR FAMILY ... ADD FUNCTION CREATE OPERATOR FAMILY alt_opf16 USING gist; @@ -699,12 +708,41 @@ NOTICE: drop cascades to server alt_fserv3 DROP LANGUAGE alt_lang2 CASCADE; DROP LANGUAGE alt_lang3 CASCADE; -- YB: fails due to above commenting out ERROR: language "alt_lang3" does not exist -\set VERBOSITY terse \\ -- YB: suppress cascade details -DROP SCHEMA alt_nsp1 CASCADE; -- YB: output numbers different due to above commenting out -NOTICE: drop cascades to 31 other objects -DROP SCHEMA alt_nsp2 CASCADE; +DROP SCHEMA alt_nsp1 CASCADE; -- YB: output different due to above commenting out +NOTICE: drop cascades to 22 other objects +DETAIL: drop cascades to function alt_agg2(integer) +drop cascades to function alt_agg3(integer) +drop cascades to function alt_agg4(integer) +drop cascades to function alt_func2(integer) +drop cascades to function alt_func3(integer) +drop cascades to function alt_func4(integer) +drop cascades to operator @+@(integer,integer) +drop cascades to operator @-@(integer,integer) +drop cascades to operator family alt_opc1 for access method hash +drop cascades to operator family alt_opc2 for access method hash +drop cascades to operator family alt_opf3 for access method hash +drop cascades to table alt_regress_1 +drop cascades to text search configuration alt_ts_conf2 +drop cascades to text search configuration alt_ts_conf3 +drop cascades to text search configuration alt_ts_conf4 +drop cascades to text search dictionary alt_ts_dict2 +drop cascades to text search dictionary alt_ts_dict3 +drop cascades to text search dictionary alt_ts_dict4 +drop cascades to text search parser alt_ts_prs2 +drop cascades to text search parser alt_ts_prs3 +drop cascades to text search template alt_ts_temp2 +drop cascades to text search template alt_ts_temp3 +DROP SCHEMA alt_nsp2 CASCADE; -- YB: output different due to above commenting out NOTICE: drop cascades to 7 other objects -DROP USER regress_alter_generic_user1; -- YB: fails likely due to above commenting out +DETAIL: drop cascades to function alt_nsp2.alt_func2(integer) +drop cascades to operator alt_nsp2.@-@(integer,integer) +drop cascades to operator family alt_nsp2.alt_opf2 for access method hash +drop cascades to text search configuration alt_nsp2.alt_ts_conf2 +drop cascades to text search dictionary alt_nsp2.alt_ts_dict2 +drop cascades to text search parser alt_nsp2.alt_ts_prs2 +drop cascades to text search template alt_nsp2.alt_ts_temp2 +DROP USER regress_alter_generic_user1; -- YB: fails due to above commenting out ERROR: role "regress_alter_generic_user1" cannot be dropped because some objects depend on it +DETAIL: owner of language alt_lang1 DROP USER regress_alter_generic_user2; DROP USER regress_alter_generic_user3; diff --git a/src/postgres/src/test/regress/expected/yb_pg_create_function_sql.out b/src/postgres/src/test/regress/expected/yb_pg_create_function_sql.out index 06c3160bf0ca..06f2450249a4 100644 --- a/src/postgres/src/test/regress/expected/yb_pg_create_function_sql.out +++ b/src/postgres/src/test/regress/expected/yb_pg_create_function_sql.out @@ -451,10 +451,10 @@ SELECT functest_S_14(); 2 (1 row) -\set VERBOSITY terse \\ -- YB: suppress cascade details because of ordering DROP TABLE functest3 CASCADE; NOTICE: drop cascades to 2 other objects -\set VERBOSITY default \\ -- YB +DETAIL: drop cascades to function functest_s_14() +drop cascades to view functestv3 -- information_schema tests CREATE FUNCTION functest_IS_1(a int, b int default 1, c text default 'foo') RETURNS int @@ -540,10 +540,10 @@ SELECT routine_name, table_name FROM information_schema.routine_table_usage DROP FUNCTION functest_IS_4a CASCADE; NOTICE: drop cascades to function functest_is_4b(integer) -\set VERBOSITY terse \\ -- YB: suppress cascade details because of ordering DROP SEQUENCE functest1 CASCADE; NOTICE: drop cascades to 2 other objects -\set VERBOSITY default \\ -- YB +DETAIL: drop cascades to function functest_is_5(integer) +drop cascades to function functest_is_6() DROP TABLE functest2 CASCADE; NOTICE: drop cascades to function functest_is_7() -- overload @@ -573,7 +573,7 @@ STABLE AS ' SELECT * FROM functest3; '; -SELECT * FROM functest_sri1() ORDER BY functest_sri1; -- YB: add ordering +SELECT * FROM functest_sri1(); functest_sri1 --------------- 1 @@ -594,7 +594,7 @@ STABLE BEGIN ATOMIC SELECT * FROM functest3; END; -SELECT * FROM functest_sri2() ORDER BY functest_sri2; -- YB: add ordering +SELECT * FROM functest_sri2(); functest_sri2 --------------- 1 @@ -653,7 +653,7 @@ SELECT voidtest4(39); (1 row) -TABLE sometable ORDER BY f1; -- YB: add ordering +TABLE sometable; f1 ---- 18 @@ -708,9 +708,37 @@ CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL AS 'a', 'b'; ERROR: only one AS item needed for language "sql" -- Cleanup -\set VERBOSITY terse \\ -- YB: suppress cascade details because of ordering DROP SCHEMA temp_func_test CASCADE; NOTICE: drop cascades to 30 other objects -\set VERBOSITY default \\ -- YB +DETAIL: drop cascades to function double_append(anyarray,anyelement) +drop cascades to function functest_a_1(text,date) +drop cascades to function functest_a_2(text[]) +drop cascades to function functest_a_3() +drop cascades to function functest_b_2(bigint) +drop cascades to function functest_b_2(integer) +drop cascades to function functest_b_3(integer) +drop cascades to function functest_b_4(integer) +drop cascades to function functest_c_1(integer) +drop cascades to function functest_c_2(integer) +drop cascades to function functest_c_3(integer) +drop cascades to function functest_e_1(integer) +drop cascades to function functest_e_2(integer) +drop cascades to function functest_f_1(integer) +drop cascades to function functest_f_2(integer) +drop cascades to function functest_f_3(integer) +drop cascades to function functest_f_4(integer) +drop cascades to function functest_s_1(text,date) +drop cascades to function functest_s_10(text,date) +drop cascades to function functest_s_13() +drop cascades to function functest_s_15(integer) +drop cascades to function functest_s_2(text[]) +drop cascades to function functest_s_3() +drop cascades to function functest_s_3a() +drop cascades to function functest_sri1() +drop cascades to function voidtest1(integer) +drop cascades to function voidtest2(integer,integer) +drop cascades to function voidtest3(integer) +drop cascades to function voidtest4(integer) +drop cascades to function voidtest5(integer) DROP USER regress_unpriv_user; RESET search_path; diff --git a/src/postgres/src/test/regress/expected/yb_pg_create_type.out b/src/postgres/src/test/regress/expected/yb_pg_create_type.out index e000b63fc6e2..25dfc8a2e34f 100644 --- a/src/postgres/src/test/regress/expected/yb_pg_create_type.out +++ b/src/postgres/src/test/regress/expected/yb_pg_create_type.out @@ -187,16 +187,25 @@ CREATE FUNCTION base_fn_out(base_type) RETURNS cstring AS 'boolout' LANGUAGE internal IMMUTABLE STRICT; NOTICE: argument type base_type is only a shell CREATE TYPE base_type(INPUT = base_fn_in, OUTPUT = base_fn_out); -\set VERBOSITY terse \\ -- YB: suppress cascade details DROP FUNCTION base_fn_in(cstring); -- error ERROR: cannot drop function base_fn_in(cstring) because other objects depend on it +DETAIL: function base_fn_out(base_type) depends on type base_type +type base_type depends on function base_fn_in(cstring) +HINT: Use DROP ... CASCADE to drop the dependent objects too. DROP FUNCTION base_fn_out(base_type); -- error ERROR: cannot drop function base_fn_out(base_type) because other objects depend on it +DETAIL: function base_fn_in(cstring) depends on type base_type +type base_type depends on function base_fn_out(base_type) +HINT: Use DROP ... CASCADE to drop the dependent objects too. DROP TYPE base_type; -- error ERROR: cannot drop type base_type because other objects depend on it +DETAIL: function base_fn_in(cstring) depends on type base_type +function base_fn_out(base_type) depends on type base_type +HINT: Use DROP ... CASCADE to drop the dependent objects too. DROP TYPE base_type CASCADE; NOTICE: drop cascades to 2 other objects -\set VERBOSITY default \\ -- YB: unsuppress cascade details +DETAIL: drop cascades to function base_fn_in(cstring) +drop cascades to function base_fn_out(base_type) -- Check usage of typmod with a user-defined type -- (we have borrowed numeric's typmod functions) CREATE TEMP TABLE mytab (foo widget(42,13,7)); -- should fail @@ -268,7 +277,7 @@ CREATE TABLE city ( INSERT INTO city VALUES ('Podunk', '(1,2),(3,4)', '100,127,1000'), ('Gotham', '(1000,34),(1100,334)', '123456,127,-1000,6789'); -TABLE city ORDER BY name DESC; -- YB-added ordering +TABLE city; name | location | budget --------+----------------------+----------------------- Podunk | (3,4),(1,2) | 100,127,1000,0 @@ -348,11 +357,26 @@ FROM pg_type WHERE typname = '_myvarchardom'; (1 row) -- ensure dependencies are straight -\set VERBOSITY terse \\ -- YB: suppress cascade details DROP FUNCTION myvarcharsend(myvarchar); -- fail ERROR: cannot drop function myvarcharsend(myvarchar) because other objects depend on it +DETAIL: function myvarcharin(cstring,oid,integer) depends on type myvarchar +function myvarcharout(myvarchar) depends on type myvarchar +function myvarcharrecv(internal,oid,integer) depends on type myvarchar +type myvarchar depends on function myvarcharsend(myvarchar) +type myvarchardom depends on function myvarcharsend(myvarchar) +HINT: Use DROP ... CASCADE to drop the dependent objects too. DROP TYPE myvarchar; -- fail ERROR: cannot drop type myvarchar because other objects depend on it +DETAIL: function myvarcharin(cstring,oid,integer) depends on type myvarchar +function myvarcharout(myvarchar) depends on type myvarchar +function myvarcharrecv(internal,oid,integer) depends on type myvarchar +function myvarcharsend(myvarchar) depends on type myvarchar +type myvarchardom depends on type myvarchar +HINT: Use DROP ... CASCADE to drop the dependent objects too. DROP TYPE myvarchar CASCADE; NOTICE: drop cascades to 5 other objects -\set VERBOSITY default \\ -- YB: unsuppress cascade details +DETAIL: drop cascades to function myvarcharin(cstring,oid,integer) +drop cascades to function myvarcharout(myvarchar) +drop cascades to function myvarcharrecv(internal,oid,integer) +drop cascades to function myvarcharsend(myvarchar) +drop cascades to type myvarchardom diff --git a/src/postgres/src/test/regress/expected/yb_pg_insert_conflict.out b/src/postgres/src/test/regress/expected/yb_pg_insert_conflict.out index 03217960b293..f92e91b49b6e 100644 --- a/src/postgres/src/test/regress/expected/yb_pg_insert_conflict.out +++ b/src/postgres/src/test/regress/expected/yb_pg_insert_conflict.out @@ -529,8 +529,10 @@ insert into cities values ('Las Vegas', 2.583E+5, 2174) on conflict do nothing; -- Wrong "Sacramento", so do nothing: -- insert into capitals values ('Sacramento', 50, 2267, 'NE') on conflict (name) do nothing; -- select * from capitals; +with ybtmp as (delete from cities where name = 'Las Vegas' returning *) + insert into cities select * from ybtmp; -- YB: imitate PG ctid reallocation for the following update insert into cities values ('Las Vegas', 5.83E+5, 2001) on conflict (name) do update set population = excluded.population, altitude = excluded.altitude; -select tableoid::regclass, * from cities order by altitude; -- YB: add ordering +select tableoid::regclass, * from cities; tableoid | name | population | altitude ----------+---------------+------------+---------- cities | San Francisco | 724000 | 63 @@ -543,7 +545,7 @@ select tableoid::regclass, * from cities order by altitude; -- YB: add ordering -- select * from capitals; -- Cities contains two instances of "Las Vegas", since unique constraints don't -- work across inheritance: -select tableoid::regclass, * from cities order by altitude; -- YB: add ordering +select tableoid::regclass, * from cities; tableoid | name | population | altitude ----------+---------------+------------+---------- cities | San Francisco | 724000 | 63 @@ -553,7 +555,7 @@ select tableoid::regclass, * from cities order by altitude; -- YB: add ordering -- This only affects "cities" version of "Las Vegas": insert into cities values ('Las Vegas', 5.86E+5, 2223) on conflict (name) do update set population = excluded.population, altitude = excluded.altitude; -select tableoid::regclass, * from cities order by altitude; -- YB: add ordering +select tableoid::regclass, * from cities; tableoid | name | population | altitude ----------+---------------+------------+---------- cities | San Francisco | 724000 | 63 diff --git a/src/postgres/src/test/regress/expected/yb_pg_insert_conflict_1.out b/src/postgres/src/test/regress/expected/yb_pg_insert_conflict_1.out index 8a6499f134ab..9dfe2175041f 100644 --- a/src/postgres/src/test/regress/expected/yb_pg_insert_conflict_1.out +++ b/src/postgres/src/test/regress/expected/yb_pg_insert_conflict_1.out @@ -529,8 +529,10 @@ insert into cities values ('Las Vegas', 2.583E+5, 2174) on conflict do nothing; -- Wrong "Sacramento", so do nothing: -- insert into capitals values ('Sacramento', 50, 2267, 'NE') on conflict (name) do nothing; -- select * from capitals; +with ybtmp as (delete from cities where name = 'Las Vegas' returning *) + insert into cities select * from ybtmp; -- YB: imitate PG ctid reallocation for the following update insert into cities values ('Las Vegas', 5.83E+5, 2001) on conflict (name) do update set population = excluded.population, altitude = excluded.altitude; -select tableoid::regclass, * from cities order by altitude; -- YB: add ordering +select tableoid::regclass, * from cities; tableoid | name | population | altitude ----------+---------------+------------+---------- cities | San Francisco | 724000 | 63 @@ -543,7 +545,7 @@ select tableoid::regclass, * from cities order by altitude; -- YB: add ordering -- select * from capitals; -- Cities contains two instances of "Las Vegas", since unique constraints don't -- work across inheritance: -select tableoid::regclass, * from cities order by altitude; -- YB: add ordering +select tableoid::regclass, * from cities; tableoid | name | population | altitude ----------+---------------+------------+---------- cities | San Francisco | 724000 | 63 @@ -553,7 +555,7 @@ select tableoid::regclass, * from cities order by altitude; -- YB: add ordering -- This only affects "cities" version of "Las Vegas": insert into cities values ('Las Vegas', 5.86E+5, 2223) on conflict (name) do update set population = excluded.population, altitude = excluded.altitude; -select tableoid::regclass, * from cities order by altitude; -- YB: add ordering +select tableoid::regclass, * from cities; tableoid | name | population | altitude ----------+---------------+------------+---------- cities | San Francisco | 724000 | 63 diff --git a/src/postgres/src/test/regress/expected/yb_pg_misc.out b/src/postgres/src/test/regress/expected/yb_pg_misc.out index 8567a47a72a1..0a9db2c1b3ac 100644 --- a/src/postgres/src/test/regress/expected/yb_pg_misc.out +++ b/src/postgres/src/test/regress/expected/yb_pg_misc.out @@ -161,7 +161,7 @@ CREATE FUNCTION equipment_named_ambiguous_2b(hobby text) -- joe and sally play basketball, and -- everyone else does nothing. -- -SELECT p.name, name(p.hobbies) FROM ONLY person p ORDER BY 2 DESC, 1; -- YB: add ordering +SELECT p.name, name(p.hobbies) FROM ONLY person p; name | name -------+------------- mike | posthacking @@ -250,7 +250,7 @@ SELECT name(equipment_named_ambiguous_2a(text 'skywalking')); guts (1 row) -SELECT name(equipment_named_ambiguous_2b(text 'skywalking')) ORDER BY substr(name(equipment_named_ambiguous_2b(text 'skywalking')), 2, 1); -- YB: add ordering +SELECT name(equipment_named_ambiguous_2b(text 'skywalking')); name --------------- advil diff --git a/src/postgres/src/test/regress/expected/yb_pg_namespace.out b/src/postgres/src/test/regress/expected/yb_pg_namespace.out index 14b376161e2b..a3f5e6e6d1a5 100644 --- a/src/postgres/src/test/regress/expected/yb_pg_namespace.out +++ b/src/postgres/src/test/regress/expected/yb_pg_namespace.out @@ -74,7 +74,7 @@ SELECT COUNT(*) FROM pg_class WHERE relnamespace = INSERT INTO test_ns_schema_1.abc DEFAULT VALUES; INSERT INTO test_ns_schema_1.abc DEFAULT VALUES; INSERT INTO test_ns_schema_1.abc DEFAULT VALUES; -SELECT * FROM test_ns_schema_1.abc ORDER BY a; -- YB: add ordering +SELECT * FROM test_ns_schema_1.abc; a | b ---+--- 1 | @@ -82,7 +82,7 @@ SELECT * FROM test_ns_schema_1.abc ORDER BY a; -- YB: add ordering 3 | (3 rows) -SELECT * FROM test_ns_schema_1.abc_view ORDER BY a; -- YB: add ordering +SELECT * FROM test_ns_schema_1.abc_view; a | b ---+--- 2 | diff --git a/src/postgres/src/test/regress/expected/yb_pg_with.out b/src/postgres/src/test/regress/expected/yb_pg_with.out index f5d366b1ade7..b19c56140b6b 100644 --- a/src/postgres/src/test/regress/expected/yb_pg_with.out +++ b/src/postgres/src/test/regress/expected/yb_pg_with.out @@ -616,7 +616,7 @@ UNION ALL FROM tree JOIN t ON (tree.parent_id = t.id) ) SELECT t1.id, t2.path, t2 FROM t AS t1 JOIN t AS t2 ON -(t1.id=t2.id) ORDER BY id; -- YB ordering +(t1.id=t2.id); id | path | t2 ----+-------------+-------------------- 1 | {} | (1,{}) @@ -2300,14 +2300,14 @@ with A as ( select q2 as id, (select q1) as x from int8_tbl ), B as ( select id, row_number() over (partition by id) as r from A ), C as ( select A.id, array(select B.id from B where B.id = A.id) from A ) -select * from C ORDER BY id; -- YB ordering (not sorted like upstream PG) +select * from C; id | array -------------------+------------------------------------- - -4567890123456789 | {-4567890123456789} - 123 | {123} 456 | {456} 4567890123456789 | {4567890123456789,4567890123456789} + 123 | {123} 4567890123456789 | {4567890123456789,4567890123456789} + -4567890123456789 | {-4567890123456789} (5 rows) -- diff --git a/src/postgres/src/test/regress/sql/yb_pg_alter_generic.sql b/src/postgres/src/test/regress/sql/yb_pg_alter_generic.sql index 7b1c496fc928..890e443c7dea 100644 --- a/src/postgres/src/test/regress/sql/yb_pg_alter_generic.sql +++ b/src/postgres/src/test/regress/sql/yb_pg_alter_generic.sql @@ -335,6 +335,7 @@ ALTER OPERATOR FAMILY alt_opf5 USING btree ADD OPERATOR 1 < (int4, int2), FUNCTI RESET ROLE; DROP OPERATOR FAMILY alt_opf5 USING btree; ROLLBACK; +DROP OPERATOR FAMILY alt_opf5 USING btree; -- YB: workaround for lack of transactional DDL -- Should fail. Need rights to namespace for ALTER OPERATOR FAMILY .. ADD / DROP BEGIN TRANSACTION; @@ -381,6 +382,8 @@ CREATE FUNCTION fn_opf12 (int4, int2) RETURNS BIGINT AS 'SELECT NULL::BIGINT;' ALTER OPERATOR FAMILY alt_opf12 USING btree ADD FUNCTION 1 fn_opf12(int4, int2); DROP OPERATOR FAMILY alt_opf12 USING btree; ROLLBACK; +DROP FUNCTION fn_opf12 (int4, int2); -- YB: workaround for lack of transactional DDL +DROP OPERATOR FAMILY alt_opf12 USING btree; -- YB: workaround for lack of transactional DDL -- Should fail. hash comparison functions should return INTEGER in ALTER OPERATOR FAMILY ... ADD FUNCTION BEGIN TRANSACTION; @@ -389,6 +392,8 @@ CREATE FUNCTION fn_opf13 (int4) RETURNS BIGINT AS 'SELECT NULL::BIGINT;' LANGUA ALTER OPERATOR FAMILY alt_opf13 USING hash ADD FUNCTION 1 fn_opf13(int4); DROP OPERATOR FAMILY alt_opf13 USING hash; ROLLBACK; +DROP FUNCTION fn_opf13 (int4); -- YB: workaround for lack of transactional DDL +DROP OPERATOR FAMILY alt_opf13 USING hash; -- YB: workaround for lack of transactional DDL -- Should fail. btree comparison functions should have two arguments in ALTER OPERATOR FAMILY ... ADD FUNCTION BEGIN TRANSACTION; @@ -397,6 +402,8 @@ CREATE FUNCTION fn_opf14 (int4) RETURNS BIGINT AS 'SELECT NULL::BIGINT;' LANGUAG ALTER OPERATOR FAMILY alt_opf14 USING btree ADD FUNCTION 1 fn_opf14(int4); DROP OPERATOR FAMILY alt_opf14 USING btree; ROLLBACK; +DROP FUNCTION fn_opf14 (int4); -- YB: workaround for lack of transactional DDL +DROP OPERATOR FAMILY alt_opf14 USING btree; -- YB: workaround for lack of transactional DDL -- Should fail. hash comparison functions should have one argument in ALTER OPERATOR FAMILY ... ADD FUNCTION BEGIN TRANSACTION; @@ -405,6 +412,8 @@ CREATE FUNCTION fn_opf15 (int4, int2) RETURNS BIGINT AS 'SELECT NULL::BIGINT;' L ALTER OPERATOR FAMILY alt_opf15 USING hash ADD FUNCTION 1 fn_opf15(int4, int2); DROP OPERATOR FAMILY alt_opf15 USING hash; ROLLBACK; +DROP FUNCTION fn_opf15 (int4, int2); -- YB: workaround for lack of transactional DDL +DROP OPERATOR FAMILY alt_opf15 USING hash; -- YB: workaround for lack of transactional DDL -- Should fail. In gist throw an error when giving different data types for function argument -- without defining left / right type in ALTER OPERATOR FAMILY ... ADD FUNCTION @@ -624,10 +633,9 @@ DROP FOREIGN DATA WRAPPER alt_fdw3 CASCADE; DROP LANGUAGE alt_lang2 CASCADE; DROP LANGUAGE alt_lang3 CASCADE; -- YB: fails due to above commenting out -\set VERBOSITY terse \\ -- YB: suppress cascade details -DROP SCHEMA alt_nsp1 CASCADE; -- YB: output numbers different due to above commenting out -DROP SCHEMA alt_nsp2 CASCADE; +DROP SCHEMA alt_nsp1 CASCADE; -- YB: output different due to above commenting out +DROP SCHEMA alt_nsp2 CASCADE; -- YB: output different due to above commenting out -DROP USER regress_alter_generic_user1; -- YB: fails likely due to above commenting out +DROP USER regress_alter_generic_user1; -- YB: fails due to above commenting out DROP USER regress_alter_generic_user2; DROP USER regress_alter_generic_user3; diff --git a/src/postgres/src/test/regress/sql/yb_pg_create_function_sql.sql b/src/postgres/src/test/regress/sql/yb_pg_create_function_sql.sql index 8954c07f598d..656f3a1b790e 100644 --- a/src/postgres/src/test/regress/sql/yb_pg_create_function_sql.sql +++ b/src/postgres/src/test/regress/sql/yb_pg_create_function_sql.sql @@ -240,9 +240,7 @@ CREATE FUNCTION functest_S_14() RETURNS bigint SELECT functest_S_14(); -\set VERBOSITY terse \\ -- YB: suppress cascade details because of ordering DROP TABLE functest3 CASCADE; -\set VERBOSITY default \\ -- YB -- information_schema tests @@ -310,9 +308,7 @@ SELECT routine_name, table_name FROM information_schema.routine_table_usage ORDER BY 1, 2; DROP FUNCTION functest_IS_4a CASCADE; -\set VERBOSITY terse \\ -- YB: suppress cascade details because of ordering DROP SEQUENCE functest1 CASCADE; -\set VERBOSITY default \\ -- YB DROP TABLE functest2 CASCADE; @@ -345,7 +341,7 @@ AS ' SELECT * FROM functest3; '; -SELECT * FROM functest_sri1() ORDER BY functest_sri1; -- YB: add ordering +SELECT * FROM functest_sri1(); EXPLAIN (verbose, costs off) SELECT * FROM functest_sri1(); CREATE FUNCTION functest_sri2() RETURNS SETOF int @@ -355,7 +351,7 @@ BEGIN ATOMIC SELECT * FROM functest3; END; -SELECT * FROM functest_sri2() ORDER BY functest_sri2; -- YB: add ordering +SELECT * FROM functest_sri2(); EXPLAIN (verbose, costs off) SELECT * FROM functest_sri2(); DROP TABLE functest3 CASCADE; @@ -384,7 +380,7 @@ CREATE FUNCTION voidtest4(a int) RETURNS VOID LANGUAGE SQL AS $$ INSERT INTO sometable VALUES(a - 1) RETURNING f1 $$; SELECT voidtest4(39); -TABLE sometable ORDER BY f1; -- YB: add ordering +TABLE sometable; CREATE FUNCTION voidtest5(a int) RETURNS SETOF VOID LANGUAGE SQL AS $$ SELECT generate_series(1, a) $$ STABLE; @@ -421,8 +417,6 @@ CREATE FUNCTION test1 (int) RETURNS int LANGUAGE SQL AS 'a', 'b'; -- Cleanup -\set VERBOSITY terse \\ -- YB: suppress cascade details because of ordering DROP SCHEMA temp_func_test CASCADE; -\set VERBOSITY default \\ -- YB DROP USER regress_unpriv_user; RESET search_path; diff --git a/src/postgres/src/test/regress/sql/yb_pg_create_type.sql b/src/postgres/src/test/regress/sql/yb_pg_create_type.sql index f9fd17ab351d..c6fc4f9029ca 100644 --- a/src/postgres/src/test/regress/sql/yb_pg_create_type.sql +++ b/src/postgres/src/test/regress/sql/yb_pg_create_type.sql @@ -168,12 +168,10 @@ CREATE FUNCTION base_fn_in(cstring) RETURNS base_type AS 'boolin' CREATE FUNCTION base_fn_out(base_type) RETURNS cstring AS 'boolout' LANGUAGE internal IMMUTABLE STRICT; CREATE TYPE base_type(INPUT = base_fn_in, OUTPUT = base_fn_out); -\set VERBOSITY terse \\ -- YB: suppress cascade details DROP FUNCTION base_fn_in(cstring); -- error DROP FUNCTION base_fn_out(base_type); -- error DROP TYPE base_type; -- error DROP TYPE base_type CASCADE; -\set VERBOSITY default \\ -- YB: unsuppress cascade details -- Check usage of typmod with a user-defined type -- (we have borrowed numeric's typmod functions) @@ -223,7 +221,7 @@ INSERT INTO city VALUES ('Podunk', '(1,2),(3,4)', '100,127,1000'), ('Gotham', '(1000,34),(1100,334)', '123456,127,-1000,6789'); -TABLE city ORDER BY name DESC; -- YB-added ordering +TABLE city; -- -- Test CREATE/ALTER TYPE using a type that's compatible with varchar, @@ -287,9 +285,7 @@ SELECT typinput, typoutput, typreceive, typsend, typmodin, typmodout, FROM pg_type WHERE typname = '_myvarchardom'; -- ensure dependencies are straight -\set VERBOSITY terse \\ -- YB: suppress cascade details DROP FUNCTION myvarcharsend(myvarchar); -- fail DROP TYPE myvarchar; -- fail DROP TYPE myvarchar CASCADE; -\set VERBOSITY default \\ -- YB: unsuppress cascade details diff --git a/src/postgres/src/test/regress/sql/yb_pg_insert_conflict.sql b/src/postgres/src/test/regress/sql/yb_pg_insert_conflict.sql index 690824f00159..06881f1c417b 100644 --- a/src/postgres/src/test/regress/sql/yb_pg_insert_conflict.sql +++ b/src/postgres/src/test/regress/sql/yb_pg_insert_conflict.sql @@ -340,17 +340,19 @@ insert into cities values ('Las Vegas', 2.583E+5, 2174) on conflict do nothing; -- Wrong "Sacramento", so do nothing: -- insert into capitals values ('Sacramento', 50, 2267, 'NE') on conflict (name) do nothing; -- select * from capitals; +with ybtmp as (delete from cities where name = 'Las Vegas' returning *) + insert into cities select * from ybtmp; -- YB: imitate PG ctid reallocation for the following update insert into cities values ('Las Vegas', 5.83E+5, 2001) on conflict (name) do update set population = excluded.population, altitude = excluded.altitude; -select tableoid::regclass, * from cities order by altitude; -- YB: add ordering +select tableoid::regclass, * from cities; -- insert into capitals values ('Las Vegas', 5.83E+5, 2222, 'NV') on conflict (name) do update set population = excluded.population; -- Capitals will contain new capital, Las Vegas: -- select * from capitals; -- Cities contains two instances of "Las Vegas", since unique constraints don't -- work across inheritance: -select tableoid::regclass, * from cities order by altitude; -- YB: add ordering +select tableoid::regclass, * from cities; -- This only affects "cities" version of "Las Vegas": insert into cities values ('Las Vegas', 5.86E+5, 2223) on conflict (name) do update set population = excluded.population, altitude = excluded.altitude; -select tableoid::regclass, * from cities order by altitude; -- YB: add ordering +select tableoid::regclass, * from cities; -- clean up drop table capitals; -- YB: errors because of above failure to create capitals table diff --git a/src/postgres/src/test/regress/sql/yb_pg_misc.sql b/src/postgres/src/test/regress/sql/yb_pg_misc.sql index ce33a0066749..1e507569de8d 100644 --- a/src/postgres/src/test/regress/sql/yb_pg_misc.sql +++ b/src/postgres/src/test/regress/sql/yb_pg_misc.sql @@ -193,7 +193,7 @@ CREATE FUNCTION equipment_named_ambiguous_2b(hobby text) -- joe and sally play basketball, and -- everyone else does nothing. -- -SELECT p.name, name(p.hobbies) FROM ONLY person p ORDER BY 2 DESC, 1; -- YB: add ordering +SELECT p.name, name(p.hobbies) FROM ONLY person p; /* YB: uncomment when person's descendant tables such as stud_emp are supported -- @@ -249,7 +249,7 @@ SELECT name(equipment_named_ambiguous_1c(hobby_construct_named(text 'skywalking' SELECT name(equipment_named_ambiguous_2a(text 'skywalking')); -SELECT name(equipment_named_ambiguous_2b(text 'skywalking')) ORDER BY substr(name(equipment_named_ambiguous_2b(text 'skywalking')), 2, 1); -- YB: add ordering +SELECT name(equipment_named_ambiguous_2b(text 'skywalking')); /* YB: output sometimes gives joe, sometimes sally SELECT hobbies_by_name('basketball'); diff --git a/src/postgres/src/test/regress/sql/yb_pg_namespace.sql b/src/postgres/src/test/regress/sql/yb_pg_namespace.sql index 5994ecf70bb5..a00ec7a49b88 100644 --- a/src/postgres/src/test/regress/sql/yb_pg_namespace.sql +++ b/src/postgres/src/test/regress/sql/yb_pg_namespace.sql @@ -50,8 +50,8 @@ INSERT INTO test_ns_schema_1.abc DEFAULT VALUES; INSERT INTO test_ns_schema_1.abc DEFAULT VALUES; INSERT INTO test_ns_schema_1.abc DEFAULT VALUES; -SELECT * FROM test_ns_schema_1.abc ORDER BY a; -- YB: add ordering -SELECT * FROM test_ns_schema_1.abc_view ORDER BY a; -- YB: add ordering +SELECT * FROM test_ns_schema_1.abc; +SELECT * FROM test_ns_schema_1.abc_view; ALTER SCHEMA test_ns_schema_1 RENAME TO test_ns_schema_renamed; SELECT COUNT(*) FROM pg_class WHERE relnamespace = diff --git a/src/postgres/src/test/regress/sql/yb_pg_with.sql b/src/postgres/src/test/regress/sql/yb_pg_with.sql index a7c461c9f2ee..d3d4d1479f2e 100644 --- a/src/postgres/src/test/regress/sql/yb_pg_with.sql +++ b/src/postgres/src/test/regress/sql/yb_pg_with.sql @@ -346,7 +346,7 @@ UNION ALL FROM tree JOIN t ON (tree.parent_id = t.id) ) SELECT t1.id, t2.path, t2 FROM t AS t1 JOIN t AS t2 ON -(t1.id=t2.id) ORDER BY id; -- YB ordering +(t1.id=t2.id); -- SEARCH clause @@ -1083,7 +1083,7 @@ with A as ( select q2 as id, (select q1) as x from int8_tbl ), B as ( select id, row_number() over (partition by id) as r from A ), C as ( select A.id, array(select B.id from B where B.id = A.id) from A ) -select * from C ORDER BY id; -- YB ordering (not sorted like upstream PG) +select * from C; -- -- Test CTEs read in non-initialization orders diff --git a/src/postgres/src/test/regress/yb_dml_serial_schedule b/src/postgres/src/test/regress/yb_dml_serial_schedule new file mode 100644 index 000000000000..d669f1c0f8b0 --- /dev/null +++ b/src/postgres/src/test/regress/yb_dml_serial_schedule @@ -0,0 +1,5 @@ +# src/test/regress/yb_dml_serial_schedule +test: yb_dml_insert_conflict +test: yb_dml_read_time +test: yb_dml_pushdown +test: yb_dml_scankey diff --git a/src/postgres/src/test/regress/yb_pg_dml_serial_schedule b/src/postgres/src/test/regress/yb_pg_dml_serial_schedule index aadfdf3f506e..86c64c853559 100644 --- a/src/postgres/src/test/regress/yb_pg_dml_serial_schedule +++ b/src/postgres/src/test/regress/yb_pg_dml_serial_schedule @@ -1,15 +1,2 @@ # src/test/regress/yb_pg_dml_serial_schedule -# -#################################################################################################### -# Postgres Testsuites: This suite includes tests on dml statements. -# NOTES: -# The following tests are copied from Postgres original code. Whenever Postgres updates -# these tests, we need to update ours also. -# - yb_pg_insert_conflict -# Other tests are YugaByte tests. -#################################################################################################### test: yb_pg_insert_conflict -test: yb_dml_insert_conflict -test: yb_dml_read_time -test: yb_dml_pushdown -test: yb_dml_scankey