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

Macro based IntoDatum for string types #1886

Conversation

YohDeadfall
Copy link
Contributor

The pull request follows two goals:

  • don't repeat yourself,
  • implement IntoDatum for &CString to mirror implementation of the trait for &String.

@YohDeadfall YohDeadfall force-pushed the macro-based-str-into-datum branch from 2607fb6 to b04fee9 Compare September 27, 2024 22:02
@YohDeadfall
Copy link
Contributor Author

@workingjubilee, I need your opinion on that since I would like to have that in my pull request switch to Datum<'mcx> and adjust less code during rebase.

@workingjubilee
Copy link
Member

on which?

@YohDeadfall
Copy link
Contributor Author

I meant this whole pull request. The thing is that my other unpublished change touches all IntoDatum implementations, so I would like to clean up the current code first, have less work later, and avoid potential rebase too.

@workingjubilee
Copy link
Member

@YohDeadfall Would it work to implement the CStr variations on Deref<Target = CStr>?

@YohDeadfall
Copy link
Contributor Author

Yes, that was my first thought, but at the same time a custom type might use that T which is Deref<CStr> too. That can end up in conflicts, and that's my concern.

@workingjubilee
Copy link
Member

Hmm.

@workingjubilee
Copy link
Member

Eh, okay. This is as we currently have and we can make the deref-based change later if we want.

@workingjubilee workingjubilee merged commit 0523797 into pgcentralfoundation:develop Sep 28, 2024
14 checks passed
@YohDeadfall YohDeadfall deleted the macro-based-str-into-datum branch September 28, 2024 21:03
eeeebbbbrrrr added a commit that referenced this pull request Oct 14, 2024
Welcome to pgrx v0.12.6. This releases fixes a number of bugs, cleans up
various parts of the code, adds more Postgres `#include` headers, and
other little things.

To upgrade, first install cargo-pgrx with `cargo install cargo-pgrx
--version 0.12.6 --locked`. Then you can run `cargo pgrx upgrade` in
your extension's crate to update its dependencies.

## What's Changed
* Removed extra allocation from `IntoDatum for char` by @YohDeadfall in
#1887
* Fixed IntoDatum impl for char introduced by #1887 by @YohDeadfall in
#1889
* Support refs to unsized SqlTranslatable types by @workingjubilee in
#1890
* Nullable is Copy when T is Copy by @workingjubilee in
#1884
* Macro based IntoDatum for string types by @YohDeadfall in
#1886
* `impl FromDatum for CString` by @workingjubilee in
#1896
* Add `BorrowDatum` for unsizing borrows of datums by @workingjubilee in
#1891
* Always panic if len of varlena exceeds the maximum by @YohDeadfall in
#1894
* Use cstr literal syntax to avoid unsafe and ??? by @workingjubilee in
#1898
* Implement UnboxDatum for ItemPointerData by @syvb in
#1900
* fix compilation on some CPUs and Windows by @usamoi in
#1901
* docs: update generic type name of TableIterator by @SteveLauC in
#1905
* Remove Python workaround for Homebrew by @workingjubilee in
#1908
* Improved messages for json errors by @YohDeadfall in
#1893
* Adds more headers by @aykut-bozkurt in
#1910
* docs: align description of GucContext::SuBackend and
GucContext::Backend with original PostgreSQL description by @mrl5 in
#1909
* docs: update outdated README by @SteveLauC in
#1914
* fix compilation on emscripten by @usamoi in
#1917
* feat: include 'storage/indexfsm.h' by @SteveLauC in
#1912
* refactor: more CStr literals by @SteveLauC in
#1911
* fix segfault with empty `numrange` during `from_datum()` by
@eeeebbbbrrrr in #1918

## New Contributors
* @mrl5 made their first contribution in
#1909

**Full Changelog**:
v0.12.5...v0.12.6
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