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

Upgrade to PSQL 15.1 #167

Merged
merged 8 commits into from
Dec 13, 2022
Merged

Upgrade to PSQL 15.1 #167

merged 8 commits into from
Dec 13, 2022

Conversation

msepga
Copy link
Contributor

@msepga msepga commented Nov 29, 2022

This upgrades libpg_query to Postgres 15.1. All tests have been updated, and tests were added for new constructs.

  • Boolean nodes have been added to the parser, replacing usage of integers with the values 1/0.
  • In the postgres parser, Value was changed to be a union stored in the A_Const type. For this upgrade, we block A_Const from code generation, and instead manually implement the relevant required functions.
  • The COPY statement deparser was also updated to attempt deparsing into the old Postgres 8.4-style syntax (e.g. COPY foo FROM STDIN FREEZE CSV). This ensures that the regression tests keep working, as new changes in the parse structures mean that these two syntaxes result in equivalent but slightly different parse trees.
  • Support was added for MERGE statements.
  • Support was added for more advanced publication objects, e.g. CREATE PUBLICATION foo FOR TABLES IN SCHEMA CURRENT_SCHEMA
  • Support was added for ALTER TABLE ALL IN TABLESPACE ... statements

@lelit
Copy link
Contributor

lelit commented Nov 30, 2022

Wow!

@lelit lelit mentioned this pull request Nov 30, 2022
@lelit
Copy link
Contributor

lelit commented Dec 1, 2022

Why Boolean is not present here?

@msepga
Copy link
Contributor Author

msepga commented Dec 1, 2022

Why Boolean is not present here?

Nice catch :) Fixed in 901ad3a

@lelit
Copy link
Contributor

lelit commented Dec 4, 2022

FYI, I almost completed upgrading pglast to this, and everything seems working great! 🎉

Copy link
Member

@lfittl lfittl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall!

For the fingerprint tests, can we also add one for MERGE that contains a constant value? Something like this:

MERGE INTO customer_account ca
USING (VALUES (1, 42), (2, 99)) t(customer_id, transaction_value)
ON t.customer_id = ca.customer_id
WHEN MATCHED THEN
  UPDATE SET balance = balance + transaction_value + 1
WHEN NOT MATCHED THEN
  INSERT (customer_id, balance)
  VALUES (t.customer_id, t.transaction_value);

README.md Show resolved Hide resolved
examples/simple.c Show resolved Hide resolved
This upgrades `libpg_query` to Postgres 15.1. All tests have been
updated, and tests were added for new constructs.

- `Boolean` nodes have been added to the parser, replacing usage of
integers with the values `1`/`0`.
- In the postgres parser, `Value` was changed to be a union stored in
the `A_Const` type. For this upgrade, we block `A_Const` from code
generation, and instead manually implement the relevant required
functions.
- The `COPY` statement deparser was also updated to attempt deparsing into
the old Postgres 8.4-style syntax (e.g. `COPY foo FROM STDIN FREEZE
CSV`). This ensures that the regression tests keep working, as new
changes in the parse structures mean that these two syntaxes result in
equivalent but slightly different parse trees.
- Support was added for `MERGE` statements.
- Support was added for more advanced publication objects, e.g.
  `CREATE PUBLICATION foo FOR TABLES IN SCHEMA CURRENT_SCHEMA`
- Support was added for `ALTER TABLE ALL IN TABLESPACE ...` statements
This follows the C++ protobuf implementation of JSON generation for
consistency.
@msepga msepga marked this pull request as ready for review December 12, 2022 20:10
Copy link
Member

@lfittl lfittl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Nicely done, and thanks for adding that extra fingerprint test!

Before merging it would be good to pull in the latest changes from 14-latest (really that should just be #168 which is now merged) - otherwise I think this is good to ship 🚢

@msepga msepga merged commit 1ada550 into 15-latest Dec 13, 2022
@msepga msepga deleted the 15-latest-dev branch December 13, 2022 17:04
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.

3 participants