Skip to content

Support Postgres 18beta1#2056

Merged
eeeebbbbrrrr merged 10 commits intopgcentralfoundation:developfrom
silver-ymz:support-18-devel
May 31, 2025
Merged

Support Postgres 18beta1#2056
eeeebbbbrrrr merged 10 commits intopgcentralfoundation:developfrom
silver-ymz:support-18-devel

Conversation

@silver-ymz
Copy link
Contributor

@silver-ymz silver-ymz commented May 6, 2025

related #2052

Notable Change

  • Postgres changes the structure of TupleDescData. It stores CompactAttribute rather than FormData_pg_attribute. All related code have been updated.
  • Postgres changes executor_start and executor_run hook API, so PgHook trait will have 2 versions, pg13-17 and pg18+.
  • Postgres introduces a new C macro PG_MODULE_MAGIC_EXT, so we add a rust macro pg_module_magic_ext!($name, $version) to keep the same API with it.

@silver-ymz silver-ymz marked this pull request as ready for review May 6, 2025 16:53
Copy link
Contributor

@eeeebbbbrrrr eeeebbbbrrrr left a comment

Choose a reason for hiding this comment

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

I suspect this is generally fine except for the new ::Devel version variant. This isn't how we've handled things in the past and it's not how I want to start doing it.

When the Postgres folks actually release beta1, which allows us to use it in CI and such, then we can merge support for it.

Which reminds me... this PR will need to update our github actions to support 18 too.

Release(u16),
Beta(u16),
Rc(u16),
Devel,
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need this and I don't want it. :)

When pg18beta1 is released we can use the ::Beta(1) variant, which is how we've handled this in the past.

@eeeebbbbrrrr
Copy link
Contributor

I sincerely appreciate your work here, @silver-ymz. It's quite a daunting task to add support for a new Postgres version!

@silver-ymz
Copy link
Contributor Author

When the Postgres folks actually release beta1, which allows us to use it in CI and such, then we can merge support for it.

Ok, when Postgres folks release beta1, I'll continue to work on this PR, update CI and update with new break changes.

@eeeebbbbrrrr
Copy link
Contributor

https://www.postgresql.org/about/news/postgresql-18-beta-1-released-3070/

Look what just happened!

@silver-ymz silver-ymz marked this pull request as draft May 10, 2025 06:48
Signed-off-by: Mingzhuo Yin <yinmingzhuo@gmail.com>
Signed-off-by: Mingzhuo Yin <yinmingzhuo@gmail.com>
Signed-off-by: Mingzhuo Yin <yinmingzhuo@gmail.com>
Signed-off-by: Mingzhuo Yin <yinmingzhuo@gmail.com>
Signed-off-by: Mingzhuo Yin <yinmingzhuo@gmail.com>
@silver-ymz silver-ymz force-pushed the support-18-devel branch 3 times, most recently from 69c8ece to 39eae5e Compare May 10, 2025 08:29
Signed-off-by: Mingzhuo Yin <yinmingzhuo@gmail.com>
Signed-off-by: Mingzhuo Yin <yinmingzhuo@gmail.com>
Signed-off-by: Mingzhuo Yin <yinmingzhuo@gmail.com>
Signed-off-by: Mingzhuo Yin <yinmingzhuo@gmail.com>
@silver-ymz silver-ymz marked this pull request as ready for review May 11, 2025 03:24
@silver-ymz silver-ymz requested a review from eeeebbbbrrrr May 11, 2025 03:24
Comment on lines +17 to +26
#[cfg(any(
feature = "pg13",
feature = "pg14",
feature = "pg15",
feature = "pg16",
feature = "pg17"
))]
pgrx::pg_module_magic!();
#[cfg(any(feature = "pg18"))]
pgrx::pg_module_magic_ext!(c"aggregate", pgrx::pg_sys::PG_VERSION);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm just picking one of these at random, but this isn't a desirable user-facing change.

Can we instead overload the pgrx::pg_module_magic!() macro to have a second form that that takes the extra arguments?

Forcing all downstream users to make this change, simply because of pg18 support, is not ideal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pgrx::pg_module_magic_ext!() have been removed. Users can use pgrx::pg_module_magic!() or pgrx::pg_module_magic!($name, $version).

Signed-off-by: Mingzhuo Yin <yinmingzhuo@gmail.com>
@silver-ymz silver-ymz requested a review from eeeebbbbrrrr May 28, 2025 12:04
Copy link
Contributor

@eeeebbbbrrrr eeeebbbbrrrr left a comment

Choose a reason for hiding this comment

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

This looks great, @silver-ymz! Sincerely, thank you for your work and please accept my apologizes for letting this sit for so long -- RealLife tends to get in the way sometimes.

@eeeebbbbrrrr eeeebbbbrrrr merged commit 6ce5ec2 into pgcentralfoundation:develop May 31, 2025
16 checks passed
@silver-ymz silver-ymz deleted the support-18-devel branch May 31, 2025 16:30
@eeeebbbbrrrr eeeebbbbrrrr changed the title Support postgres 18 devel Support Postgres 18beta1 Jun 28, 2025
eeeebbbbrrrr added a commit that referenced this pull request Jun 28, 2025
Welcome to pgrx v0.15.0. This begins a new series for pgrx that includes
support for Postgres 18. As of this release, that means Postgres
18beta1.

This release does contain a few breaking API changes but they're largely
mechanical. Don't worry, the compiler will let you know!

As always, please install our CI tool with `cargo install cargo-pgrx
--version 0.15.0 --locked` and then run `cargo pgrx upgrade` in all of
your extension crates.

If you want to start working with Postgres 18beta1, you'll also need to
re-init your pgrx environment with `cargo pgrx init`. That will
automatically detect all the latest Postgres versions, including
18beta1.

At the top here, I'd like to thank @silver-ymz for the 18beta1 support.
It was a pleasant surprise to see that work come from the community --
it's no easy task to add a new Postgres version to pgrx!

That said, as Postgres 18 is currently beta, you should consider pgrx'
support for it as beta too. Please report any problems with 18beta1 (or
discrepancies with other versions) as GitHub issues.

Also, this release requires rust v1.88.0 or greater. `if-let` chains are
now a thing and we're not afraid to use them.

# What's Changed

## Postgres 18beta1 Support

* Support Postgres 18beta1 by @silver-ymz in
#2056
* pg18 support: add header and implement `#define` by @eeeebbbbrrrr in
#2094
* improve pg_magic_func by @usamoi in
#2088


## More Headers

* Added `catalog/heap.h` binding by @ccleve in
#2072
* include `utils/pg_status.h` by @eeeebbbbrrrr in
#2091


## `cargo-pgrx` improvements

* Pass `LLVM_*` variables to `--runas` command by @theory in
#2083
* `does_db_exist()`: fix `psql` argument order by @eeeebbbbrrrr in
#2093
* `cargo pgrx regress` output is no longer fully buffered by
@eeeebbbbrrrr in #2095
* Detect `pgrx_embed` name from lib name by @YohDeadfall in
#2035
* Fixed error message if no artifact found by @YohDeadfall in
#2034
* `cargo-pgrx`: use system certificate store for HTTPS validation by
@charmitro in #2074
* Decoding command output in Windows by @if0ne in
#2084


## Breaking Changes

* fix GUC by @usamoi in
#2064
* refactor GUC by @usamoi in
#2066

## New Stuff

* Added `pg_binary_protocol` attribute to derive send and receive
functions for `PostgresType` by @LucaCappelletti94 in
#2068
* Expose guc hooks by @thesuhas in
#2075
* Allows to create multiple aggregates for the same Rust type by @if0ne
in #2078



## General Code Cleanup

* `cargo clippy --fix` by @eeeebbbbrrrr in
#2092
* Use `if-let` to unpack Options by @stuhood in
#2089
* docs: fix typo in `rust_byte_slice_to_bytea()` docs by @burmecia in
#2071
* Added a missing `#[doc(hidden)]` by @LucaCappelletti94 in
#2079

## Administrative

* Updated Fedora to latest in CI by @YohDeadfall in
#2085
* fix ci on beta rust (1.89) by @usamoi in
#2087

## New Contributors

Much thanks to our new contributors! Your work is sincerely appreciated!

* @charmitro made their first contribution in
#2074
* @thesuhas made their first contribution in
#2075
* @if0ne made their first contribution in
#2084
* @stuhood made their first contribution in
#2089

**Full Changelog**:
v0.14.3...v0.15.0
daamien pushed a commit to daamien/pgrx that referenced this pull request Dec 15, 2025
related pgcentralfoundation#2052

## Notable Change

- Postgres changes the structure of `TupleDescData`. It stores
`CompactAttribute` rather than `FormData_pg_attribute`. All related code
have been updated.
- Postgres changes `executor_start` and `executor_run` hook API, so
`PgHook` trait will have 2 versions, `pg13-17` and `pg18+`.
- Postgres introduces a new C macro `PG_MODULE_MAGIC_EXT`, so we add a
rust macro `pg_module_magic_ext!($name, $version)` to keep the same API
with it.

---------

Signed-off-by: Mingzhuo Yin <yinmingzhuo@gmail.com>
daamien pushed a commit to daamien/pgrx that referenced this pull request Dec 15, 2025
Welcome to pgrx v0.15.0. This begins a new series for pgrx that includes
support for Postgres 18. As of this release, that means Postgres
18beta1.

This release does contain a few breaking API changes but they're largely
mechanical. Don't worry, the compiler will let you know!

As always, please install our CI tool with `cargo install cargo-pgrx
--version 0.15.0 --locked` and then run `cargo pgrx upgrade` in all of
your extension crates.

If you want to start working with Postgres 18beta1, you'll also need to
re-init your pgrx environment with `cargo pgrx init`. That will
automatically detect all the latest Postgres versions, including
18beta1.

At the top here, I'd like to thank @silver-ymz for the 18beta1 support.
It was a pleasant surprise to see that work come from the community --
it's no easy task to add a new Postgres version to pgrx!

That said, as Postgres 18 is currently beta, you should consider pgrx'
support for it as beta too. Please report any problems with 18beta1 (or
discrepancies with other versions) as GitHub issues.

Also, this release requires rust v1.88.0 or greater. `if-let` chains are
now a thing and we're not afraid to use them.

# What's Changed

## Postgres 18beta1 Support

* Support Postgres 18beta1 by @silver-ymz in
pgcentralfoundation#2056
* pg18 support: add header and implement `#define` by @eeeebbbbrrrr in
pgcentralfoundation#2094
* improve pg_magic_func by @usamoi in
pgcentralfoundation#2088


## More Headers

* Added `catalog/heap.h` binding by @ccleve in
pgcentralfoundation#2072
* include `utils/pg_status.h` by @eeeebbbbrrrr in
pgcentralfoundation#2091


## `cargo-pgrx` improvements

* Pass `LLVM_*` variables to `--runas` command by @theory in
pgcentralfoundation#2083
* `does_db_exist()`: fix `psql` argument order by @eeeebbbbrrrr in
pgcentralfoundation#2093
* `cargo pgrx regress` output is no longer fully buffered by
@eeeebbbbrrrr in pgcentralfoundation#2095
* Detect `pgrx_embed` name from lib name by @YohDeadfall in
pgcentralfoundation#2035
* Fixed error message if no artifact found by @YohDeadfall in
pgcentralfoundation#2034
* `cargo-pgrx`: use system certificate store for HTTPS validation by
@charmitro in pgcentralfoundation#2074
* Decoding command output in Windows by @if0ne in
pgcentralfoundation#2084


## Breaking Changes

* fix GUC by @usamoi in
pgcentralfoundation#2064
* refactor GUC by @usamoi in
pgcentralfoundation#2066

## New Stuff

* Added `pg_binary_protocol` attribute to derive send and receive
functions for `PostgresType` by @LucaCappelletti94 in
pgcentralfoundation#2068
* Expose guc hooks by @thesuhas in
pgcentralfoundation#2075
* Allows to create multiple aggregates for the same Rust type by @if0ne
in pgcentralfoundation#2078



## General Code Cleanup

* `cargo clippy --fix` by @eeeebbbbrrrr in
pgcentralfoundation#2092
* Use `if-let` to unpack Options by @stuhood in
pgcentralfoundation#2089
* docs: fix typo in `rust_byte_slice_to_bytea()` docs by @burmecia in
pgcentralfoundation#2071
* Added a missing `#[doc(hidden)]` by @LucaCappelletti94 in
pgcentralfoundation#2079

## Administrative

* Updated Fedora to latest in CI by @YohDeadfall in
pgcentralfoundation#2085
* fix ci on beta rust (1.89) by @usamoi in
pgcentralfoundation#2087

## New Contributors

Much thanks to our new contributors! Your work is sincerely appreciated!

* @charmitro made their first contribution in
pgcentralfoundation#2074
* @thesuhas made their first contribution in
pgcentralfoundation#2075
* @if0ne made their first contribution in
pgcentralfoundation#2084
* @stuhood made their first contribution in
pgcentralfoundation#2089

**Full Changelog**:
pgcentralfoundation/pgrx@v0.14.3...v0.15.0
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.

2 participants