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 ltree, lquery and ltxtquery support #875

Merged
merged 4 commits into from Mar 23, 2022

Conversation

halfmatthalfcat
Copy link
Contributor

This adds Postgres ltree, lquery and ltxtquery support to rust-postgres. For the uninitiated, ltree ("label tree") is a Postgres datatype that follows a dot-notated search path for a given row. Lquery and ltxtquery allow users to search for rows that match an ltree. There are many query operators to help traverse the tree in a given query.

There is some commentary in #389 on why we are not adding Inners for the three datatypes. In summary, because ltree is an extension (one that ships with Postgres), it's Oids are not static like many other datatypes. This renders the Inner loading by Oid unusable and thus we must match on the Type name, like we do for citext.

Long term motivations for this are to incorporate these changes into quaint and then eventually into Prisma.

Fixes #389

@halfmatthalfcat
Copy link
Contributor Author

@sfackler appreciate a review if you have time, open to any changes.

postgres-types/src/lib.rs Outdated Show resolved Hide resolved
@halfmatthalfcat
Copy link
Contributor Author

@sfackler I think everything should be sorted. Added more tests around the protocol parsers. Let me know if you see anything else glaring. Thanks!

@brassel
Copy link

brassel commented Mar 11, 2022

Looking forward to see this!
Thank you @halfmatthalfcat and @sfackler!

@halfmatthalfcat
Copy link
Contributor Author

Hey @sfackler I think since I haven't contributed before I need some assistance kicking off another build. Thanks for your help!

@halfmatthalfcat
Copy link
Contributor Author

Ok @sfackler, sorry about that delay. I didn't know about the matches! macro and added ltree as an extension in the sql setup file, was running into a race condition during the tests.

Confirmed the latest build is working on my fork: https://github.com/halfmatthalfcat/rust-postgres/actions/runs/1996247393

I rebased as well so we should be ready to go on this.

@halfmatthalfcat
Copy link
Contributor Author

Hey @sfackler can we kick the tires on this one more time?

@sfackler
Copy link
Owner

Kicked - sorry for the delay. I really with github would auto-build once you've been approved a single time or something... :(

@sfackler sfackler merged commit 38da7fa into sfackler:master Mar 23, 2022
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.

Support the ltree data type
3 participants