Move the test to multi_modification

In order to not create yet another test file.
pull/7914/head
Cédric Villemain 2025-03-07 09:00:33 +01:00
parent 415ebedbaf
commit 74e7033b1f
5 changed files with 63 additions and 60 deletions

View File

@ -1,35 +0,0 @@
-- https://github.com/citusdata/citus/issues/7676
CREATE TABLE test_ref_multiexpr (
id bigint primary key
, col_int integer
, col_bool bool
, col_text text
, col_timestamp timestamp
);
select create_reference_table('test_ref_multiexpr');
create_reference_table
---------------------------------------------------------------------
(1 row)
/* TODO how to ensure in test that 'now()' is correctly pre-executed */
insert into test_ref_multiexpr values (1, 1, true, 'one', now());
update test_ref_multiexpr
SET (col_timestamp)
= (SELECT now())
returning id, col_int, col_bool;
id | col_int | col_bool
---------------------------------------------------------------------
1 | 1 | t
(1 row)
update test_ref_multiexpr
SET (col_bool, col_timestamp)
= (SELECT true, now())
returning id, col_int, col_bool;
id | col_int | col_bool
---------------------------------------------------------------------
1 | 1 | t
(1 row)
DROP TABLE test_ref_multiexpr;

View File

@ -812,6 +812,42 @@ SELECT * FROM app_analytics_events ORDER BY id;
(2 rows)
DROP TABLE app_analytics_events;
-- test function call in UPDATE SET
-- https://github.com/citusdata/citus/issues/7676
CREATE TABLE test_ref_multiexpr (
id bigint primary key
, col_int integer
, col_bool bool
, col_text text
, col_timestamp timestamp
);
SELECT create_reference_table('test_ref_multiexpr');
create_reference_table
---------------------------------------------------------------------
(1 row)
/* TODO how to ensure in test that 'now()' is correctly pre-executed */
INSERT INTO test_ref_multiexpr VALUES (1, 1, true, 'one', now());
UPDATE test_ref_multiexpr
SET (col_timestamp)
= (SELECT now())
RETURNING id, col_int, col_bool;
id | col_int | col_bool
---------------------------------------------------------------------
1 | 1 | t
(1 row)
UPDATE test_ref_multiexpr
SET (col_bool, col_timestamp)
= (SELECT true, now())
RETURNING id, col_int, col_bool;
id | col_int | col_bool
---------------------------------------------------------------------
1 | 1 | t
(1 row)
DROP TABLE test_ref_multiexpr;
-- Test multi-row insert with serial in a non-partition column
CREATE TABLE app_analytics_events (id int, app_id serial, name text);
SELECT create_distributed_table('app_analytics_events', 'id');

View File

@ -103,7 +103,7 @@ test: multi_dropped_column_aliases foreign_key_restriction_enforcement
test: binary_protocol
test: alter_table_set_access_method
test: alter_distributed_table
test: issue_5248 issue_5099 issue_5763 issue_6543 issue_6758 issue_7477 issue_7676
test: issue_5248 issue_5099 issue_5763 issue_6543 issue_6758 issue_7477
test: object_propagation_debug
test: undistribute_table
test: run_command_on_all_nodes

View File

@ -1,24 +0,0 @@
-- https://github.com/citusdata/citus/issues/7676
CREATE TABLE test_ref_multiexpr (
id bigint primary key
, col_int integer
, col_bool bool
, col_text text
, col_timestamp timestamp
);
select create_reference_table('test_ref_multiexpr');
/* TODO how to ensure in test that 'now()' is correctly pre-executed */
insert into test_ref_multiexpr values (1, 1, true, 'one', now());
update test_ref_multiexpr
SET (col_timestamp)
= (SELECT now())
returning id, col_int, col_bool;
update test_ref_multiexpr
SET (col_bool, col_timestamp)
= (SELECT true, now())
returning id, col_int, col_bool;
DROP TABLE test_ref_multiexpr;

View File

@ -505,6 +505,32 @@ VALUES (104, 'Wayz'), (105, 'Mynt') RETURNING *;
SELECT * FROM app_analytics_events ORDER BY id;
DROP TABLE app_analytics_events;
-- test function call in UPDATE SET
-- https://github.com/citusdata/citus/issues/7676
CREATE TABLE test_ref_multiexpr (
id bigint primary key
, col_int integer
, col_bool bool
, col_text text
, col_timestamp timestamp
);
SELECT create_reference_table('test_ref_multiexpr');
/* TODO how to ensure in test that 'now()' is correctly pre-executed */
INSERT INTO test_ref_multiexpr VALUES (1, 1, true, 'one', now());
UPDATE test_ref_multiexpr
SET (col_timestamp)
= (SELECT now())
RETURNING id, col_int, col_bool;
UPDATE test_ref_multiexpr
SET (col_bool, col_timestamp)
= (SELECT true, now())
RETURNING id, col_int, col_bool;
DROP TABLE test_ref_multiexpr;
-- Test multi-row insert with serial in a non-partition column
CREATE TABLE app_analytics_events (id int, app_id serial, name text);
SELECT create_distributed_table('app_analytics_events', 'id');