launchql / pgsql-parser

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

PG 16 upgrade #107

Open pyramation opened 8 months ago

pyramation commented 8 months ago

we finally got PG 16 (& windows) working on libpg-query thanks to @aquariuslt 🙏🏻

Now would be great to get this library upgraded. I'm pretty sure only a few ASTs changed. Will use this issue to document those changes:

Strings seem to be the only issue, and I believe their in A_Const and a few others:

                    "A_Const": Object {
                          "location": 1323,
-                     "val": Object {
-                       "String": Object {
-                         "str": "",
-                       },
+                     "sval": Object {
+                       "sval": "",
                "ColumnRef": Object {
                      "fields": Array [
                        Object {
                          "String": Object {
-                           "str": "c",
+                           "sval": "c",
                          },
                        },
pyramation commented 8 months ago

found a few more

                "typmods": Array [
                    Object {
                      "A_Const": Object {
-                       "location": 50,
-                       "val": Object {
-                         "Integer": Object {
+                       "ival": Object {
                          "ival": 2,
-                         },
                        },
+                       "location": 50,
                      },
                    },
                  ],
pyramation commented 8 months ago

from https://github.com/launchql/libpg-query-node/issues/21 via @nith2001 :

Hello @pyramation, thank you for the work you've been doing in libpg-query-node. I'm a developer from the Supabase codebase and we've been facing issues parsing Postgres queries past V13. We were able to trace the issue here since we use pgsql-parser, which uses this library as a sub-dependency.

We noticed that you have the V15 PR ready here, and we wanted to ask if it would be possible to merge this in, assuming it's ready. If not, could we get a timeline on how long before it can be merged?

beeing commented 5 months ago

This should be released as a major version 😄, perhaps the major version can be tied to PG's version as well.

pyramation commented 5 months ago

I think we'll upgrade to PG 15 first, and use 15-latest similar to libpg-query

we're testing out deparse on 15 now