Skip to content

Fix for side-effects seeping into data query#419

Open
teunbrand wants to merge 5 commits intoposit-dev:mainfrom
teunbrand:fix_create_temp_table_global_query
Open

Fix for side-effects seeping into data query#419
teunbrand wants to merge 5 commits intoposit-dev:mainfrom
teunbrand:fix_create_temp_table_global_query

Conversation

@teunbrand
Copy link
Copy Markdown
Collaborator

@teunbrand teunbrand commented May 1, 2026

This PR aims to fix #415.

The transform_global_sql() was wrapping the user-provided query like so:

CREATE TABLE "__ggsql_global_..." AS CREATE TEMP TABLE data(x, y) AS (VALUE...

Whereas now

  • CREATE TEMP TABLE data(x, y) AS (VALUE... is executed seperately as a side-effect
  • CREATE TABLE "__ggsql_global_..." AS SELECT * FROM data becomes the global data query

I'm mainly concerned about Chesterton's fence: I don't really know why CREATE statements were transformed in the first place. So that'd be a good item to review.

teunbrand and others added 5 commits May 1, 2026 14:53
transform_global_sql concatenated side-effect SQL (CREATE, INSERT, …) with
the VISUALISE FROM injection, then the caller wrapped the whole thing in
another CREATE TABLE AS, producing invalid SQL like:
  CREATE TABLE __ggsql_global__ AS CREATE TEMP TABLE data …

Split the return into side-effect statements (executed directly) and the
queryable part (wrapped as the global temp table).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@teunbrand teunbrand marked this pull request as ready for review May 1, 2026 14:33
@teunbrand teunbrand requested a review from thomasp85 May 1, 2026 14:33
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.

Allow for CREATE TEMP TABLE

1 participant