Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Bugfix. Multimaster mustn't send the T_CallStmt utility statement to …#13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
funny-falcon merged 1 commit intomasterfromee13-5359
Aug 23, 2021
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletionsexpected/multimaster.out
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -488,3 +488,45 @@ table seq_test;
105
(8 rows)

--
-- Check a sequence generation by function, procedure, direct insertion.
--
CREATE SEQUENCE seq1;
CREATE TABLE t1 (id int);
CREATE OR REPLACE PROCEDURE p1 () LANGUAGE 'plpgsql' AS $$
BEGIN
INSERT INTO t1 (id) VALUES (nextval('seq1'::regclass));
END; $$;
CREATE OR REPLACE FUNCTION p2 () RETURNS VOID LANGUAGE 'plpgsql' AS $$
BEGIN
INSERT INTO t1 (id) VALUES (nextval('seq1'::regclass));
END; $$;
-- Generate value by different ways.
CALL p1();
SELECT p2();
p2
----

(1 row)

INSERT INTO t1 (id) VALUES (nextval('seq1'::regclass));
-- Fix generated values of a sequence
SELECT * FROM t1 ORDER BY id;
id
----
1
4
7
(3 rows)

-- Try to UPDATE. In the case of data divergence we will get an error.
UPDATE t1 SET id = id + 1;
-- Check for new values, just to be sure.
SELECT * FROM t1 ORDER BY id;
id
----
2
5
8
(3 rows)

29 changes: 29 additions & 0 deletionssql/multimaster.sql
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -327,3 +327,32 @@ insert into seq_test values (default);
insert into seq_test values (default);
\c :node1
table seq_test;

--
-- Check a sequence generation by function, procedure, direct insertion.
--
CREATE SEQUENCE seq1;
CREATE TABLE t1 (id int);
CREATE OR REPLACE PROCEDURE p1 () LANGUAGE 'plpgsql' AS $$
BEGIN
INSERT INTO t1 (id) VALUES (nextval('seq1'::regclass));
END; $$;

CREATE OR REPLACE FUNCTION p2 () RETURNS VOID LANGUAGE 'plpgsql' AS $$
BEGIN
INSERT INTO t1 (id) VALUES (nextval('seq1'::regclass));
END; $$;

-- Generate value by different ways.
CALL p1();
SELECT p2();
INSERT INTO t1 (id) VALUES (nextval('seq1'::regclass));

-- Fix generated values of a sequence
SELECT * FROM t1 ORDER BY id;

-- Try to UPDATE. In the case of data divergence we will get an error.
UPDATE t1 SET id = id + 1;

-- Check for new values, just to be sure.
SELECT * FROM t1 ORDER BY id;
1 change: 1 addition & 0 deletionssrc/ddl.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -947,6 +947,7 @@ MtmProcessUtilitySender(PlannedStmt *pstmt, const char *queryString,
caseT_PlannedStmt:
caseT_FetchStmt:
caseT_DoStmt:
caseT_CallStmt:
caseT_CommentStmt:
caseT_PrepareStmt:
caseT_ExecuteStmt:
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp