Skip to content

The set command in the stored procedure is invalid for subsequent query statements #145

@liujinyang-highgo

Description

@liujinyang-highgo

If some set command in procedure, that will be valid only in session to primary node, but not valid for sessions to standby node.

example as below:

  1. create PROCEDURE will be executed on primary node.

CREATE OR REPLACE PROCEDURE sub_proc1()
LANGUAGE plpgsql
AS $$
BEGIN
set enable_indexscan=off;
END;
$$;

  1. call procedure will be executed on primary node, enable_indexscan is set to off on session to primary node.

call sub_proc1();

  1. show command will be executed on standby node. the result of enable_indexscan is still default value(on), not changed;

    enable_indexscan;


on

(1 row)

  1. so subsequent select query will be routed to standby node, that means for those query enable_indexscan is still on .

is any solution for this?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions