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

[ALTER TABLE] Support parsing multiple alterations #57

Closed
TheLazyDev opened this issue Jul 15, 2021 · 4 comments
Closed

[ALTER TABLE] Support parsing multiple alterations #57

TheLazyDev opened this issue Jul 15, 2021 · 4 comments

Comments

@TheLazyDev
Copy link

image

I am facing this error when I try to run this query below:-

ALTER TABLE reviews ADD COLUMN IF NOT EXISTS reviewer UUID,ADD COLUMN IF NOT EXISTS reviewee UUID,ADD COLUMN IF NOT EXISTS job_id UUID,ADD COLUMN IF NOT EXISTS review VARCHAR,ADD COLUMN IF NOT EXISTS rating FLOAT DEFAULT 0;;

This query is working properly when I run it through SQL runner :/

@oguimbal
Copy link
Owner

oguimbal commented Jul 15, 2021

Yup, this syntax is not supported by pgsql-ast-parser.

I'm transfering the issue there.

I dont have time to handle this these days, unfortunately 😑 So I cant give you an ETA, sorry

Thanks for the report

@oguimbal oguimbal transferred this issue from oguimbal/pg-mem Jul 15, 2021
@TheLazyDev
Copy link
Author

No problem I understand I actually liked your library because it is very configurable but sadly due to this error I can't use it in my project if you don't mind can you provide any suggestions for setting up a in memory instance of postgres because I have to write unit tests for my code and I am unable to find any usable module :/

@oguimbal
Copy link
Owner

There arent many alternatives, as far as I know.
The only other option that I know if is to use an actual postgres instance, wrapped in a transaction, or a brand new one for each test.
You can set this reliably up using Docker and running your tests against a clean dockerized db, but this has a significant overhead, and is definitely not trivial to setup.

Cant you split your alter statements in multiple single alter statements (that would be supported by pg-mem) ?

@oguimbal oguimbal changed the title SQL Parser issue [ALTER TABLE] Support parsing multiple alterations Jul 26, 2021
@oguimbal
Copy link
Owner

Released as pgsql-ast-parser@9.0.0, thanks to @bchelli

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

No branches or pull requests

2 participants