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

Fix 4474 PostgreSql create extension #4541

Merged
merged 2 commits into from
Feb 2, 2024
Merged

Conversation

griffio
Copy link
Contributor

@griffio griffio commented Aug 17, 2023

Support CREATE EXTENSION … ALTER EXTENSION ... DROP EXTENSION
Overrides the extension_stmt to add EXTENSION statements

fixes #4474

However, it doesn't solve the problem where sql extensions allow new functions and types as these are unknown to PostgreSqlTypeResolver (It's possible to extend a new local dialect see https://github.com/griffio/sqldelight-custom-dialect).

Currently, another work around is to use () around the function e.g (uuid_generate_v4()) - the parser allows this for now as it's not strict enough.

@griffio griffio marked this pull request as ready for review August 17, 2023 12:15
@griffio griffio changed the title PostgreSql create extension fixup Fix 4474 PostgreSql create extension Aug 25, 2023
@AlecKazakova
Copy link
Collaborator

is this schema altering - as in we also need DROP EXTENSION and all the other ones? If so we also have to have this rule modify the schema

though maybe supporting autocomplete and stuff for these isn't that important, as you mentioned I think folks would have to implement a custom dialect which is probably the right path for this

@griffio
Copy link
Contributor Author

griffio commented Aug 29, 2023

@AlecKazakova

Yes - just supporting CREATE is only partially useful - for schema migration ALTER and DROP would be needed

I created a new discussion to try point out what I mean at the higher level 🧑‍🚀

#4572

Support CREATE EXTENSION …
Overrides the extension_stmt to add unsupported CREATE EXTENSION
…_stmt

Extensions with fixture tests for supported syntax

CreateExtensionTests removed as not needed in this change
@griffio
Copy link
Contributor Author

griffio commented Feb 2, 2024

Updating this old 🗝️ PR as may be of use with a custom dialect https://github.com/griffio/sqldelight-custom-dialect

@AlecKazakova AlecKazakova merged commit 1ed79dc into cashapp:master Feb 2, 2024
7 checks passed
@griffio griffio deleted the issue_4474 branch February 2, 2024 18:08
hfhbd pushed a commit that referenced this pull request Apr 2, 2024
* PostgreSql create extension fixup

Support CREATE EXTENSION …
Overrides the extension_stmt to add unsupported CREATE EXTENSION

* Grammar for create_extension_stmt drop_extension_stmt alter_extension_stmt

Extensions with fixture tests for supported syntax

CreateExtensionTests removed as not needed in this change
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.

Support postgres 'CREATE EXTENSION' in migration files
2 participants