Skip to content

Commit 6160519

Browse files
authored
Merge pull request #13 from postgrespro/ee13-5359
Bugfix. Multimaster mustn't send the T_CallStmt utility statement to …
2 parents 55754e0 + c14ed1b commit 6160519

File tree

3 files changed

+72
-0
lines changed

3 files changed

+72
-0
lines changed

expected/multimaster.out

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,3 +488,45 @@ table seq_test;
488488
105
489489
(8 rows)
490490

491+
--
492+
-- Check a sequence generation by function, procedure, direct insertion.
493+
--
494+
CREATE SEQUENCE seq1;
495+
CREATE TABLE t1 (id int);
496+
CREATE OR REPLACE PROCEDURE p1 () LANGUAGE 'plpgsql' AS $$
497+
BEGIN
498+
INSERT INTO t1 (id) VALUES (nextval('seq1'::regclass));
499+
END; $$;
500+
CREATE OR REPLACE FUNCTION p2 () RETURNS VOID LANGUAGE 'plpgsql' AS $$
501+
BEGIN
502+
INSERT INTO t1 (id) VALUES (nextval('seq1'::regclass));
503+
END; $$;
504+
-- Generate value by different ways.
505+
CALL p1();
506+
SELECT p2();
507+
p2
508+
----
509+
510+
(1 row)
511+
512+
INSERT INTO t1 (id) VALUES (nextval('seq1'::regclass));
513+
-- Fix generated values of a sequence
514+
SELECT * FROM t1 ORDER BY id;
515+
id
516+
----
517+
1
518+
4
519+
7
520+
(3 rows)
521+
522+
-- Try to UPDATE. In the case of data divergence we will get an error.
523+
UPDATE t1 SET id = id + 1;
524+
-- Check for new values, just to be sure.
525+
SELECT * FROM t1 ORDER BY id;
526+
id
527+
----
528+
2
529+
5
530+
8
531+
(3 rows)
532+

sql/multimaster.sql

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,3 +327,32 @@ insert into seq_test values (default);
327327
insert into seq_test values (default);
328328
\c :node1
329329
table seq_test;
330+
331+
--
332+
-- Check a sequence generation by function, procedure, direct insertion.
333+
--
334+
CREATE SEQUENCE seq1;
335+
CREATE TABLE t1 (id int);
336+
CREATE OR REPLACE PROCEDURE p1 () LANGUAGE 'plpgsql' AS $$
337+
BEGIN
338+
INSERT INTO t1 (id) VALUES (nextval('seq1'::regclass));
339+
END; $$;
340+
341+
CREATE OR REPLACE FUNCTION p2 () RETURNS VOID LANGUAGE 'plpgsql' AS $$
342+
BEGIN
343+
INSERT INTO t1 (id) VALUES (nextval('seq1'::regclass));
344+
END; $$;
345+
346+
-- Generate value by different ways.
347+
CALL p1();
348+
SELECT p2();
349+
INSERT INTO t1 (id) VALUES (nextval('seq1'::regclass));
350+
351+
-- Fix generated values of a sequence
352+
SELECT * FROM t1 ORDER BY id;
353+
354+
-- Try to UPDATE. In the case of data divergence we will get an error.
355+
UPDATE t1 SET id = id + 1;
356+
357+
-- Check for new values, just to be sure.
358+
SELECT * FROM t1 ORDER BY id;

src/ddl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,7 @@ MtmProcessUtilitySender(PlannedStmt *pstmt, const char *queryString,
947947
case T_PlannedStmt:
948948
case T_FetchStmt:
949949
case T_DoStmt:
950+
case T_CallStmt:
950951
case T_CommentStmt:
951952
case T_PrepareStmt:
952953
case T_ExecuteStmt:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy