Repository navigation
Label tree support - #2991
Label tree support#2991NinoFloris wants to merge 2 commits into
Conversation
YohDeadfall
left a comment
There was a problem hiding this comment.
Looks good, but would you mind to add some tests? (: While it uses the text handler, there should be some tests to ensure that no change will break label trees.
You can use inheritdoc elements on public members to avoid warnings.
| await buf.Ensure(1, async); | ||
| var version = buf.ReadByte(); | ||
| if (version != LqueryProtocolVersion) | ||
| throw new NotSupportedException($"Don't know how to decode lquery with wire format {version}, your connection is now broken"); |
There was a problem hiding this comment.
Now it isn't. The driver properly handles invalid data in columns without breaking connections. By the way, we have ThrowHelper where you can put this code and avoid duplication in six places.
There was a problem hiding this comment.
As this handler is almost a one to one copy the wording should be fixed in these other places as well.
https://github.com/npgsql/npgsql/blob/main/src/Npgsql/TypeHandlers/JsonHandler.cs#L266
There was a problem hiding this comment.
Sure, will address this too (:
| Ltxtquery = 63, // Extension type | ||
|
|
||
| #endregion | ||
|
|
roji
left a comment
There was a problem hiding this comment.
- Should we call this LTree rather than Ltree (and so LTxtQuery instead of Ltxtquery, etc.)? That seems like the right C# naming thing to do.
- It would definitely be good to see some tests. I'm looking into having the PG13 beta on our CI.
- Does it make sense to provide a non-string, model representation, i.e. an actual tree? As it is we're passing the burden of parsing etc. to the user.
|
|
||
| namespace Npgsql.TypeHandlers | ||
| { | ||
| #pragma warning disable CS1591 // Missing XML comment for publicly visible type or member |
There was a problem hiding this comment.
Yeah, ideally this wouldn't be here. Definitely no need to document private/internal stuff though.
|
@roji ltree works on paths, which as a set form a tree. some form of string list might help. I'll get to the feedback in a few days I expect, I already had this laying around, good to hear no major things :) |
|
@NinoFloris FYI we now run tests on PG13 so that should help here. |
|
@NinoFloris ping, would be nice to get this in soon. |
| /// The PostgreSQL ltree type, each value is a label path "a.label.tree.value", forming a tree in a set. | ||
| /// </summary> | ||
| /// <remarks>See http://www.postgresql.org/docs/current/static/ltree.html</remarks> | ||
| Ltree = 61, // Extension type |
There was a problem hiding this comment.
Should start from the maximum existing type number plus one. Since #3177 gets merged soon, makes sense to use 58 as the first.
|
Finished by #3312. Thanks, @NinoFloris! |
|
@YohDeadfall no thank you - seriously - for bringing it over the finish line. |
https://www.postgresql.org/docs/13/release-13.html
As ltree now supports binary protocol in beta 1 of pg 13 I thought it time to dig up this branch :)
It implements the wire format (one byte for version, binary string afterwards) and maps this to a string. We may want to parse it into segments for IEnumerable/string[] support.
I'm not sure what's with all the regions so I just followed the trend here.