Skip to content

feat: Execute standalone extension statements in local runner - #2279

Merged
ferenc-csaky merged 2 commits into
mainfrom
feat/run-standalone-extension-statements
Aug 13, 2026
Merged

feat: Execute standalone extension statements in local runner#2279
ferenc-csaky merged 2 commits into
mainfrom
feat/run-standalone-extension-statements

Conversation

@WellMafra

@WellMafra WellMafra commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

What was done

  • DatasqrlRun.initPostgres now executes the plan's standaloneExtensionStatements (e.g. the pg_partman CREATE EXTENSION + create_parent block) after the regular statements, non-fatally: a failure logs a warning and the run continues, so a Postgres without the extension behaves exactly as before.
  • Install postgresql-${POSTGRES_VERSION}-partman in the sqrl-cli base image so run/test can actually create the extension locally.

Why it was done

  • Tables with a ttl() hint are emitted as PARTITION BY RANGE parents with no inline default partition (pg_partman owns their lifecycle), but the local runner never executed the partman block — leaving the parent with zero partitions, so every insert fails with no partition of relation ... found for row. This made sqrl test/sqrl run unusable for any project using ttl() on a Postgres table.
  • Validated end-to-end against DataSQRL/cloud-backend metrics: with this image the runner logs Executing standalone extension statement partman of type EXTENSION, historical test fixtures land in the partman DEFAULT partition, and all 14 snapshot tests pass.

@WellMafra
WellMafra marked this pull request as ready for review August 12, 2026 16:23
@WellMafra WellMafra changed the title [feature] Execute standalone extension statements in the local runner feat: Execute standalone extension statements in local runner Aug 12, 2026
@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 18.90%. Comparing base (ea2cf01) to head (2f4bdf2).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2279      +/-   ##
============================================
+ Coverage     18.78%   18.90%   +0.11%     
- Complexity     1223     1227       +4     
============================================
  Files           630      630              
  Lines         18409    18420      +11     
  Branches       2250     2251       +1     
============================================
+ Hits           3459     3483      +24     
+ Misses        14618    14605      -13     
  Partials        332      332              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

Signed-off-by: Wellington Mafra <wellingtonisidiomafra@gmail.com>
@WellMafra WellMafra self-assigned this Aug 12, 2026
@ferenc-csaky

Copy link
Copy Markdown
Collaborator

Why executing standaloneExtensionStatements AFTER the regular statements? I would consider an extension setup more general than a CREATE TABLE, so in an initialization phase, I'd rather execute standaloneExtensionStatements first.

@WellMafra

WellMafra commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

Why executing standaloneExtensionStatements AFTER the regular statements?

because the create_parent requires the parent table to already exist.

@ferenc-csaky
ferenc-csaky merged commit b8bc1e8 into main Aug 13, 2026
16 checks passed
@ferenc-csaky
ferenc-csaky deleted the feat/run-standalone-extension-statements branch August 13, 2026 12:07
@ferenc-csaky ferenc-csaky added this to the 0.11.1 milestone Aug 13, 2026
@ferenc-csaky ferenc-csaky added the enhancement New feature or request label Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants