Skip to content

pgrx v0.15.0 on Postgres 18 error[E0308]: mismatched types #2098

@theory

Description

@theory

From this build, I see these errors building against Postgres 18 on Debian:

error[E0308]: mismatched types
Error:    --> /usr/share/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/pgrx-0.15.0/src/hooks.rs:273:22
    |
273 |             .replace(pgrx_executor_start)
    |              ------- ^^^^^^^^^^^^^^^^^^^ expected fn pointer, found fn item
    |              |
    |              arguments to this method are incorrect
    |
    = note: expected fn pointer `unsafe extern "C-unwind" fn(_, _) -> ()`
                  found fn item `unsafe extern "C-unwind" fn(_, _) -> bool {pgrx_executor_start}`
help: the return type of this call is `unsafe extern "C-unwind" fn(*mut pgrx_pg_sys::QueryDesc, i32) -> bool {pgrx_executor_start}` due to the type of the argument passed
   --> /usr/share/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/pgrx-0.15.0/src/hooks.rs:272:35
    |
272 |           prev_executor_start_hook: pg_sys::ExecutorStart_hook
    |  ___________________________________^
273 | |             .replace(pgrx_executor_start)
    | |______________________-------------------^
    |                        |
    |                        this argument influences the return type of `replace`
note: method defined here
   --> /rustc/6b00bc3880198600130e1cf62b8f8a93494488cc/library/core/src/option.rs:1809:18

error[E0308]: mismatched types
Error:    --> /usr/share/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/pgrx-0.15.0/src/hooks.rs:274:22
    |
274 |             .or(Some(pgrx_standard_executor_start_wrapper)),
    |                 ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found fn item
    |                 |
    |                 arguments to this enum variant are incorrect
    |
    = note: expected fn pointer `unsafe extern "C-unwind" fn(_, _) -> ()`
                  found fn item `unsafe extern "C-unwind" fn(_, _) -> bool {pgrx_standard_executor_start_wrapper}`
help: the type constructed contains `unsafe extern "C-unwind" fn(*mut pgrx_pg_sys::QueryDesc, i32) -> bool {pgrx_standard_executor_start_wrapper}` due to the type of the argument passed
   --> /usr/share/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/pgrx-0.15.0/src/hooks.rs:274:17
    |
274 |             .or(Some(pgrx_standard_executor_start_wrapper)),
    |                 ^^^^^------------------------------------^
    |                      |
    |                      this argument influences the type of `Some`
note: tuple variant defined here
   --> /rustc/6b00bc3880198600130e1cf62b8f8a93494488cc/library/core/src/option.rs:597:5

error[E0308]: mismatched types
Error:    --> /usr/share/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/pgrx-0.15.0/src/hooks.rs:345:25
    |
345 |         HookResult::new(res)
    |         --------------- ^^^ expected `bool`, found `()`
    |         |
    |         arguments to this function are incorrect
    |
note: associated function defined here
   --> /usr/share/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/pgrx-0.15.0/src/hooks.rs:43:12
    |
43  |     pub fn new(value: T) -> Self {
    |            ^^^ --------

error[E0308]: mismatched types
Error:    --> /usr/share/cargo/registry/src/index.crates.io-1949cf8c6b5b557f/pgrx-0.15.0/src/hooks.rs:734:5
    |
733 | ) -> bool {
    |      ---- expected `bool` because of return type
734 |     pg_sys::standard_ExecutorStart(query_desc, eflags)
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `bool`, found `()`

For more information about this error, try `rustc --explain E0308`.
error: could not compile `pgrx` (lib) due to 4 previous errors
Error: Process completed with exit code 1.

The error does not occur on Postgres 13-17.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions