launchql / pgsql-parser

PostgreSQL Query Parser for Node.js
MIT License
151 stars 24 forks source link

PG 15 upgrade #93

Open pyramation opened 1 year ago

pyramation commented 1 year ago

libpg-query@15.0.0

data-envoy commented 1 year ago

Hi pyramation, thanks for providing a useful project.

We have an issue ( https://github.com/supabase/supabase/issues/13267 ) over on the supabase repo regarding Postgres 15 syntax not validating in their SQL Editor.

We managed to trace the issue back to pgsql-parser supporting up to PG 13, but no further.

Is version 15 support planned?

Regards (ツ)

nith2001 commented 1 year ago

I got started on trying to update libpg-query to Version 15, but I'm facing some difficulty with the actual update process before I can even start debugging and writing tests. How would I update the version here: https://github.com/pyramation/pgsql-parser/blob/master/packages/parser/package.json#L75

Essentially, I wanted to run something like yarn upgrade libpg-query or npm update libpg-query to update the version of libpg-query under the package.json within the parser folder of packages, but it's not really working.

If I did the npm one, it creates a package-lock.json at the root directory, which I'm assuming is not the desired behavior or directory setup we want.

If I do the yarn one, I get the following error trace:

yarn upgrade v1.22.19
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning "workspace-aggregator-8f9024cc-8e7d-4119-9187-75915c1dade1 > lerna > @lerna/version > @lerna/github-client > @octokit/rest > @octokit/plugin-request-log@1.0.3" has unmet peer dependency "@octokit/core@>=3".
error An unexpected error occurred: "expected workspace package to exist for \"jest-config\"".
info If you think this is a bug, please open a bug report with the information provided in "..../yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/upgrade for documentation about this command.

For context, I ran both commands at the parser folder level.

data-envoy commented 1 year ago

It think first yarn install from root. Then cd to parser package and yarn upgrade ....

You're right about package-lock.json not being right, I agree because of *yarn* files in the root dir.

nith2001 commented 1 year ago

I'm guessing we need to run through some of the commands listed in here before actually doing anything?

nith2001 commented 1 year ago

Update: I basically recloned and followed the steps as dictated by the Github workflow and from what you suggested about the upgrade and got the following error trace:

(base) vikram@Mr-Kram-2 parser % yarn upgrade libpg-query
yarn upgrade v1.22.19
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning "workspace-aggregator-56c3dc5b-140f-4251-9394-8ef88db5bf71 > lerna > @lerna/version > @lerna/github-client > @octokit/rest > @octokit/plugin-request-log@1.0.3" has unmet peer dependency "@octokit/core@>=3".
error An unexpected error occurred: "expected workspace package to exist for \"jest-config\"".
info If you think this is a bug, please open a bug report with the information provided in "/Users/vikram/Documents/GitHub/pgsql-parser/packages/parser/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/upgrade for documentation about this command.

Edit: This seems to be an ongoing issue: https://github.com/yarnpkg/yarn/issues/7807, but despite reverting to an older version of yarn, I still get the above error trace.

nith2001 commented 1 year ago

Ok, this was a bit of a hack, but I just followed this comment and edited the libpg-query version field in the package.json file manually to 15.0.2 and then I ran yarn install at the root directory and I'm pretty sure it worked. On to debugging!

pyramation commented 1 year ago

https://github.com/pyramation/pgsql-parser/issues/92#issuecomment-1512716832

When I attempted this, the string type was changed — so some of the messages and node parsing needed to be updated. Would love to take a PR for this — and it would also allow for 15 to happen as well.