-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Basic support for ltree #1696
Basic support for ltree #1696
Conversation
Also maybe you can help, cause querying works but inserting has problems: |
I'll try testing it locally this evening |
It looks like something might not have been registered properly, as When I run an insert with |
Everything fixes itself if I use |
That is strange, if i change the OID to your value, my example does not work anymore:
Is there a list about OIDs somewhere? I also found it like you did. Guess it should be handled as Custom type maybe |
https://stackoverflow.com/a/49990732 😞 |
So then it should be a |
Ok seems i still need to add an OID to the |
The |
I was checking a bit on lquery but I guess this should go in separate PR later as it's a bit more complicated |
This is looking good now, although I'd like to see this covered in the type tests.
test_type!(ltree<sqlx::postgres::types::PgLTree>(Postgres,
"'Foo.Bar.Baz.Quux'::ltree" == PgLTree::from_str("Foo.Bar.Baz.Quux").unwrap(),
"'Alpha.Beta.Delta.Gamma'::ltree" == PgLTree::from_iter(["Alpha", "Beta", "Delta", "Gamma"]).unwrap()
);
test_type!(ltree_vec<Vec<sqlx::postgres::types::PgLTree>>(Postgres,
"['Foo.Bar.Baz.Quux', 'Alpha.Beta.Delta.Gamma']::ltree[]" ==
vec![
PgLTree::from_str("Foo.Bar.Baz.Quux").unwrap(),
PgLTree::from_iter(["Alpha", "Beta", "Delta", "Gamma"]).unwrap()
]
); (Ideally, make sure to cover paths of different lengths too.) Unit tests for at least the |
Will try to get this done this weekend. But first of all it's family time now |
@abonander don't bother, i solved the array stuff. Now i'm just wondering what went wrong on the CI about time and MySQL. Cause i did not touch that at all. |
@cemoktra the MySQL breakage should be fixed on |
Co-authored-by: Paolo Barbolini <paolo@paolo565.org>
@abonander rebased |
What went wrong this time? @abonander |
@abonander i found the problem in the |
)); | ||
|
||
test_type!(ltree_vec<Vec<sqlx::postgres::types::PgLTree>>(Postgres, | ||
"array['Foo.Bar.Baz.Quux', 'Alpha.Beta.Delta.Gamma']::ltree[]" == |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't realize this until I checked but Gamma actually comes before Delta in the Greek alphabet.
You don't need to change this, it's just an observation.
@abonander I don't understand what's wrong now. Can you help me? |
We've run into this same problem with a few other types, and we don't have a good solution right now. I think the solution is to dynamically fall back to text encoding if a given type doesn't have binary encoding functions defined, but that's out of scope for this PR. I think for now we can just hack in a way to disable this test for the I'm thinking we mark the type tests with |
Ok thanks |
closes #196