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

add bindings for libpq #1436

Merged
merged 1 commit into from
Dec 16, 2023
Merged

Conversation

usamoi
Copy link
Contributor

@usamoi usamoi commented Dec 15, 2023

add two header files:

  • libpq/libpq.h
  • libpq/pqformat.h

They are useful for a PostgreSQL type to implement send_function and receive_function.

@eeeebbbbrrrr
Copy link
Contributor

Hi, @usamoi, would you mind rebasing this PR with develop? I just fixed CI there and I want to make sure things still build with the libpq headers included.

Looking at these headers, looks like they're mostly a combination of #defines and static inlines. I wonder if what we actually need here is to hand-port these to rust?

What symbols from these headers are you trying to get access to?

@usamoi
Copy link
Contributor Author

usamoi commented Dec 16, 2023

Hi, @eeeebbbbrrrr. I need symbols including pq_begintypsend, pq_endtypsend, pq_sendbytes and so on. They are used for send/recevie function of a Postgresql type, eg. https://github.com/postgres/postgres/blob/REL_16_STABLE/src/backend/utils/adt/varlena.c#L617.

@eeeebbbbrrrr
Copy link
Contributor

Hi, @eeeebbbbrrrr. I need symbols including pq_begintypsend, pq_endtypsend, pq_sendbytes and so on.

I see. Because they're static inline this won't pull in some of the other helper functions like pg_write[int32, int64, int16, int8], etc. :(

So I'll just note here that we may need to port those to run at some point (and would happily accept a PR!).

Once you rebase and we can confirm CI passes, I'll merge this. I was thinking of doing another release on Monday or Tuesday.

@eeeebbbbrrrr
Copy link
Contributor

1: clang diagnosed error: /usr/include/postgresql/15/server/libpq/libpq-be.h:34:10: fatal error: 'gssapi/gssapi.h' file not found

I was worried about something like this.

I think this header is related to Kerberos. It's being pulled in through the new libpq.h. I would expect ENABLE_GSS to not be defined for the Postgres that pgrx compiles/installs.

Do you need libpq.h too?

@usamoi usamoi force-pushed the develop branch 2 times, most recently from e02fb7d to 828183e Compare December 16, 2023 19:03
@usamoi
Copy link
Contributor Author

usamoi commented Dec 16, 2023

I think I don't need libpq.h really. Deleted it.

@eeeebbbbrrrr
Copy link
Contributor

I think I don't need libpq.h really. Deleted it.

Yeah. I was getting concerned about potentially adding another development requirement on Kerberos.

Assuming the latest ci job passes, I’ll merge and get a new release out early next week.

Thanks for your efforts on this Saturday afternoon!

@eeeebbbbrrrr eeeebbbbrrrr merged commit fc20994 into pgcentralfoundation:develop Dec 16, 2023
8 checks passed
workingjubilee pushed a commit that referenced this pull request Jan 24, 2024
Discussed was also adding `libpq.h` but that would expand development requirements to Kerberos development headers and that isn't a good situation for existing users.
workingjubilee added a commit that referenced this pull request Jan 25, 2024
The pgrx 0.11.3 release addresses a few UB risks in pgrx, updates its
dependencies on many points, and includes many additional headers. It
should also now be easier to use cargo-pgrx on more-complicated network
configurations.

## New Bindings!

New bindings added thanks to
- @burmecia in #1432
- @daamien in
  - #1431
  - #1485
- @rebasedming in #1486
- @usamoi in #1436
- @workingjubilee in
#1453

## "...wait, that's UB?"

Two UB fixes!
- Thanks to @Lokathor in
#1443
- Thanks to @usamoi in
#1466

## Ergonomics

- A better `ereport!` macro in
#1472

## Less transport-level security problems in cargo-pgrx

- We no longer secretly require rustls! Thanks to @jirutka in
#1448
- We now use native certs if possible, even with rustls, since
#1449

Together these should mean it's possible to actually use cargo-pgrx on
whatever your network configuration is, but you might have to use `cargo
install --no-default-features --features native-tls` to install with
native-tls (which, on Linux, means OpenSSL). By default, you will use
rustls.

## Many dependency updates

These address some largely-hypothetical security risks, but one is
particularly important: the bindgen update means we now should be
compatible with some aarch64 builds that might have failed.

- #1492
- #1493
- #1494
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants