Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(tsql): transpile CREATE SCHEMA IF NOT EXISTS to dynamic SQL #2083

Merged
merged 1 commit into from
Aug 17, 2023

Conversation

georgesittas
Copy link
Collaborator

@georgesittas georgesittas commented Aug 17, 2023

Fixes #2065

Right now, transpiling CREATE SCHEMA IF NOT EXISTS <name> to T-SQL produces invalid code. This PR aims to address simple cases like this by transpiling them into dynamic SQL that checks whether the schema exists with an IF statement and if it doesn't it creates it with an EXEC call.

This seems to be a needed workaround because of T-SQL's constraints around schema creation (see the corresponding issue for more context).

cc: @deschman

@georgesittas georgesittas requested a review from tobymao August 17, 2023 12:43
@georgesittas georgesittas merged commit 6426c1f into main Aug 17, 2023
@georgesittas georgesittas deleted the jo/tsql_create_schema_if_not_exists_fix branch August 17, 2023 16:12
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.

TSQL Dialect Yields Invalid Syntax when Creating Indexes and Replacing Data
2 participants