Skip to content

SET LOCAL support - #3101

Open
zachmu wants to merge 2 commits into
mainfrom
zachmu/set-local
Open

SET LOCAL support#3101
zachmu wants to merge 2 commits into
mainfrom
zachmu/set-local

Conversation

@zachmu

@zachmu zachmu commented Aug 17, 2026

Copy link
Copy Markdown
Member

This PR adds support for transaction-scoped session vars via SET LOCAL.

Companion PR: dolthub/go-mysql-server#3704

@itoqa

itoqa Bot commented Aug 17, 2026

Copy link
Copy Markdown

Ito QA test results
Commit: 9ee5b8d: 14 test cases ran, 14 passed ✅.

Summary

Coverage spans transaction-scoped configuration behavior across normal use, commits, rollbacks, savepoints, failed transactions, repeated changes, session-value preservation, planner visibility, and message boundaries. It also exercises edge cases and invalid or custom settings, with results indicating healthy behavior across these business-logic and database-boundary scenarios.

Safe to merge — the run found no failures attributable to this PR, regressions, or previously flagged issues, so there is no merge-blocking risk. The overall result is low risk.

Tests run by Ito

View full run

Result Severity Type Description
General An empty local setting is rejected, while a valid multi-value date setting keeps its value and rollback restores the session setting.
General Unknown settings and dotted settings are rejected when used with SET LOCAL. The regular session setting path still accepts custom.option and returns its value.
General The setting changed to off inside the transaction, and both SHOW and the query planner used that same value. After COMMIT, both returned to on.
General The database kept the temporary setting during the transaction, including after a query, and restored the original setting after COMMIT and in a new transaction.
General Local attempts to change a custom setting are rejected, while a regular session change succeeds and can be read later.
General The setting changed twice during one transaction and returned to its original value after commit.
General Repeated local settings used the newest value, then both commit and rollback restored the original session value.
Config The setting changed to off inside the transaction, and the value returned to on after COMMIT.
Local The planner setting changed to off during the transaction and returned to on after COMMIT.
Local After a statement failed, the transaction rejected the next query until rollback. Rolling back restored the setting to on.
Options The database rejected the namespaced custom option with the expected error, then completed the rollback.
Savepoint Rolling back to a savepoint kept the transaction usable and kept the planner setting off. Committing the outer transaction then restored the setting to on.
Session The connection kept its ordinary setting after a temporary transaction setting was removed. The value was off before the transaction, on inside it, and off again after COMMIT.
Session The later regular setting remained the final session value after the transaction ended.

Tip

Reply with @itoqa to send us feedback on this test run.

@github-actions

Copy link
Copy Markdown
Contributor
Main PR
Total 42090 42090
Successful 18937 19006
Failures 23153 23084
Partial Successes1 5447 5452
Main PR
Successful 44.9917% 45.1556%
Failures 55.0083% 54.8444%

${\color{red}Regressions (1)}$

copyselect

QUERY:          drop table test3;
RECEIVED ERROR: Doltgres sent additional messages after ReadyForQuery

${\color{lightgreen}Progressions (61)}$

aggregates

QUERY: set local max_parallel_workers_per_gather = 0;
QUERY: select max(unique1) from tenk1 where unique1 > 42000;

cluster

QUERY: SET LOCAL enable_seqscan = false;
QUERY: SET LOCAL enable_seqscan = false;
QUERY: SET LOCAL enable_seqscan = false;

create_am

QUERY: SET LOCAL default_table_access_method = 'heap2';
QUERY: CREATE TABLE tableam_tbl_heapx(f1 int);

create_table_like

QUERY: SET LOCAL search_path = ctl_schema, public;

explain

QUERY: set local plan_cache_mode = force_generic_plan;

groupingsets

QUERY: SET LOCAL enable_hashagg = false;

guc

QUERY: SET LOCAL vacuum_cost_delay TO 50;
QUERY: SET LOCAL datestyle = 'SQL';
QUERY: SET LOCAL vacuum_cost_delay TO 50;
QUERY: SET LOCAL datestyle = 'SQL';
QUERY: SET LOCAL vacuum_cost_delay TO 30;
QUERY: SET LOCAL datestyle = 'Postgres, MDY';
QUERY: SET LOCAL vacuum_cost_delay TO 30;
QUERY: SET LOCAL datestyle = 'Postgres, MDY';
QUERY: RELEASE SAVEPOINT sp;
QUERY: SET LOCAL vacuum_cost_delay TO 50;
QUERY: SET datestyle = 'ISO, DMY';
QUERY: SET LOCAL datestyle = 'Postgres, MDY';

incremental_sort

QUERY: set local enable_hashjoin = off;
QUERY: set local enable_mergejoin = off;
QUERY: set local enable_material = off;
QUERY: set local enable_sort = off;

join_hash

QUERY: set local min_parallel_table_scan_size = 0;
QUERY: set local parallel_setup_cost = 0;
QUERY: set local enable_hashjoin = on;
QUERY: create or replace function find_hash(node json)
returns json language plpgsql
as
$$
declare
  x json;
  child json;
begin
  if node->>'Node Type' = 'Hash' then
    return node;
  else
    for child in select json_array_elements(node->'Plans')
    loop
      x := find_hash(child);
      if x is not null then
        return x;
      end if;
    end loop;
    return null;
  end if;
end;
$$;
QUERY: SET LOCAL enable_sort = OFF;
QUERY: SET LOCAL from_collapse_limit = 1;
QUERY: CREATE TABLE hjtest_1 (a text, b int, id int, c bool);
QUERY: CREATE TABLE hjtest_2 (a bool, id int, b text, c int);
QUERY: INSERT INTO hjtest_1(a, b, id, c) VALUES ('text', 2, 1, false);
QUERY: INSERT INTO hjtest_1(a, b, id, c) VALUES ('text', 1, 2, false);
QUERY: INSERT INTO hjtest_1(a, b, id, c) VALUES ('text', 20, 1, false);
QUERY: INSERT INTO hjtest_1(a, b, id, c) VALUES ('text', 1, 1, false);
QUERY: INSERT INTO hjtest_2(a, id, b, c) VALUES (true, 1, 'another', 2);
QUERY: INSERT INTO hjtest_2(a, id, b, c) VALUES (true, 3, 'another', 7);

Footnotes

  1. These are tests that we're marking as Successful, however they do not match the expected output in some way. This is due to small differences, such as different wording on the error messages, or the column names being incorrect while the data itself is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant