1

Assigning a statement_timeout to a role in postgres does not appear to persist the setting.

Example:

-- Set the statement_timeout on a role
alter role api_user set statement_timeout = '500ms';

-- Start a transaction
begin;
    -- Assume the role
    set role api_user;

    -- Display statement_timeout setting
    show statement_timeout;
    -- |--------------------------|
    -- | statement_timeout (text) |
    -- |--------------------------|
    -- | 0                        |
    -- |--------------------------|

Since the statement_timeout for api_user was set to 500ms I expected 500ms as the output. Instead, it shows the default statement_timeout of 0, or unlimited.

What am I missing here?

1 Answer 1

2

The session is persisted, but assuming the role with SET ROLE or SET SESSION AUTHORIZATION doesn't set the parameter. You have to log into the database as role api_user for that.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.