这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@gjtorikian
Copy link
Contributor

Now that Postgres 18 (Beta 1) Dockerfiles are available, I think it would make sense to start testing against that version, and catch any potential issues before the official release.

@gjtorikian
Copy link
Contributor Author

gjtorikian commented Jun 13, 2025

Looks like the MSRV needs to change. As well, this should point to the develop branch for pgrx (e.g. pgcentralfoundation/pgrx#2056), not the version on cargo.

@gjtorikian
Copy link
Contributor Author

Looks like the MSRV needs to change.

It's an even bigger jump to 1.85.0, because pgrx has standardized on edition2024:

16.15   Downloaded cargo-edit v0.13.2
16.16 error: failed to compile `cargo-pgrx v0.14.3 (https://github.com/pgcentralfoundation/pgrx?branch=develop#c0de15d2)`, intermediate artifacts can be found at `/tmp/cargo-installadHC3o`.
16.16 To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
16.16 
16.16 Caused by:
16.16   failed to parse manifest at `/home/postgres/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-edit-0.13.2/Cargo.toml`
16.16 
16.16 Caused by:
16.16   feature `edition2024` is required
16.16 
16.16   The package requires the Cargo feature called `edition2024`, but that feature is not stabilized in this version of Cargo (1.82.0 (8f40fc59f 2024-08-21)).
16.16   Consider trying a newer version of Cargo (this may require the nightly release).
16.16   See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#edition-2024 for more information about the status of this feature.

@pksunkara pksunkara linked an issue Jul 7, 2025 that may be closed by this pull request
@gjtorikian
Copy link
Contributor Author

@pksunkara I believe this is ready for review. The changes I made attempted to keep disruptions to the existing code at minimum (hence the Docker NEXT checks). Most of it was done the way it was done under the assumption that you didn't want to bump MSRV, but aside from that, code changes to support PG18beta1 were minimal.

Other than ec0ecf4, the important changes are:

  • updating pgrx to 0.15.0
  • bumping up to rust 1.85.0

The changes in lib were due to:

48.57    Compiling pgx_ulid v0.2.0 (/home/postgres)
48.74 error: custom attribute panicked
48.74   --> src/lib.rs:15:1
48.74    |
48.74 15 | #[pg_guard]
48.74    | ^^^^^^^^^^^
48.74    |
48.74    = help: message: #[pg_guard] must be combined with extern "C-unwind"
48.74
48.88 warning: unused imports: `pg_shmem_init` and `shmem::*`
48.88  --> src/lib.rs:7:5
48.88   |
48.88 7 |     pg_shmem_init, pg_sys::Oid, prelude::*, rust_regtypein, shmem::*, PgLwLock, StringInfo, Uuid,
48.88   |     ^^^^^^^^^^^^^                                           ^^^^^^^^
48.88   |
48.88   = note: `#[warn(unused_imports)]` on by default
48.88
49.06 error[E0061]: this function takes 1 argument but 0 arguments were supplied
49.06   --> src/lib.rs:13:38
49.06    |
49.06 13 | static SHARED_ULID: PgLwLock<u128> = PgLwLock::new();
49.06    |                                      ^^^^^^^^^^^^^-- argument #1 of type `&'static CStr` is missing
49.06    |
49.06 note: associated function defined here
49.06   --> /home/postgres/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/pgrx-0.15.0/src/lwlock.rs:44:18
49.06    |
49.06 44 |     pub const fn new(name: &'static CStr) -> Self {
49.06    |                  ^^^
49.06 help: provide the argument
49.06    |
49.06 13 | static SHARED_ULID: PgLwLock<u128> = PgLwLock::new(/* &'static CStr */);
49.06    |                                                   ~~~~~~~~~~~~~~~~~~~~~
49.06
49.35 warning[E0133]: call to unsafe function `pgrx::FromDatum::from_polymorphic_datum` is unsafe and requires unsafe block
49.35   --> src/lib.rs:72:28
49.35    |
49.35 72 |         let bytes: &[u8] = FromDatum::from_polymorphic_datum(datum, is_null, typoid)?;
49.35    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
49.35    |
49.35    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/unsafe-op-in-unsafe-fn.html>
49.35    = note: consult the function's documentation for information on how to avoid undefined behavior
49.35 note: an unsafe function restricts its caller, but its body is safe by default
49.35   --> src/lib.rs:68:5
49.35    |
49.35 68 | /     unsafe fn from_polymorphic_datum(datum: SysDatum, is_null: bool, typoid: Oid) -> Option<Self>
49.35 69 | |     where
49.35 70 | |         Self: Sized,
49.35    | |____________________^
49.35    = note: `#[warn(unsafe_op_in_unsafe_fn)]` on by default
49.35
49.41 Some errors have detailed explanations: E0061, E0133.
49.41 For more information about an error, try `rustc --explain E0061`.
49.41 warning: `pgx_ulid` (lib) generated 2 warnings
49.41 error: could not compile `pgx_ulid` (lib) due to 2 previous errors; 2 warnings emitted

Even though the imports were unused, I got another error after removing them:

49.03 error[E0599]: no method named pg_init found for struct PgLwLock in the current scope
49.03 --> src/lib.rs:15:5
49.03 |
49.03 15 | pg_shmem_init!(SHARED_ULID);
49.03 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ method not found in PgLwLock<u128>
49.03 |
49.03 ::: /home/postgres/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/pgrx-0.15.0/src/shmem.rs:118:8
49.03 |
49.03 118 | fn pg_init(&'static self);
49.03 | ------- the method is available for PgLwLock<u128> here
49.03 |
49.03 = help: items from traits can only be used if the trait is in scope
49.03 = note: this error originates in the macro pg_shmem_init (in Nightly builds, run with -Z macro-backtrace for more info)
49.03 help: trait PgSharedMemoryInitialization which provides pg_init is implemented but not in scope; perhaps you want to import it
49.03 |
49.03 1 + use pgrx::PgSharedMemoryInitialization;
49.03 |
49.03
49.03 error[E0599]: no method named shmem_init found for struct PgLwLock in the current scope
49.03 --> src/lib.rs:15:5
49.03 |
49.03 15 | pg_shmem_init!(SHARED_ULID);
49.03 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ method not found in PgLwLock<u128>
49.03 |
49.03 ::: /home/postgres/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/pgrx-0.15.0/src/shmem.rs:123:15
49.03 |
49.03 123 | unsafe fn shmem_init(&'static self);
49.03 | ---------- the method is available for PgLwLock<u128> here
49.03 |
49.03 = help: items from traits can only be used if the trait is in scope
49.03 = note: this error originates in the macro pg_shmem_init (in Nightly builds, run with -Z macro-backtrace for more info)
49.03 help: trait PgSharedMemoryInitialization which provides shmem_init is implemented but not in scope; perhaps you want to import it
49.03 |
49.03 1 + use pgrx::PgSharedMemoryInitialization;
49.03 |
49.03
49.24 For more information about this error, try rustc --explain E0599.
49.25 error: could not compile pgx_ulid (lib) due to 2 previous errors

So I pulled in PgSharedMemoryInitialization to fix that.

Copy link
Owner

@pksunkara pksunkara left a comment

Choose a reason for hiding this comment

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

Would you be willing to open a separate PR upgrading the edition to 2024 and rust to 1.85 as a first step towards 18 release?

I don't want to merge a next test, because it's not going to be the same for next release.


edition = "2021"
rust-version = "1.81.0"
rust-version = "1.82.0"
Copy link
Owner

Choose a reason for hiding this comment

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

Should this be 85 or 82?

Self: Sized,
{
let bytes: &[u8] = FromDatum::from_polymorphic_datum(datum, is_null, typoid)?;
let bytes: &[u8] = unsafe { FromDatum::from_polymorphic_datum(datum, is_null, typoid)? };
Copy link
Owner

Choose a reason for hiding this comment

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

What made this unsafe?

@gjtorikian
Copy link
Contributor Author

Would you be willing to open a separate PR upgrading the edition to 2024 and rust to 1.85 as a first step towards 18 release?

Yeah, let me do that. We can come back to this PR after that one is merged. 👍

@gjtorikian gjtorikian mentioned this pull request Jul 25, 2025
@gjtorikian
Copy link
Contributor Author

Closing this as it will be cannibalized.

@gjtorikian gjtorikian closed this Jul 26, 2025
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.

PG 18 support

2 participants