-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
sql: collation support, phase one #10605
sql: collation support, phase one #10605
Conversation
This is very good. Just minor nits left. Reviewed 10 of 11 files at r1. pkg/sql/parser/datum.go, line 581 at r1 (raw file):
I'd move this and the condition below onto a method pkg/sql/parser/eval.go, line 1938 at r1 (raw file):
No cast to a collated string? Is COLLATE mandatory to achieve this? pkg/sql/parser/eval.go, line 1959 at r1 (raw file):
I didn't know you could re-type the collation this way. In which use cases is this useful? Comments from Reviewable |
Reviewed 1 of 11 files at r1. Comments from Reviewable |
This change clearly demonstrates that we need to start thinking about overload resolution again, now that we're adding more "non-orthogonal" types. We may want to consider replacing preferred overloads with preferred types within "type categories". This would solve the same problem that preferred overloads solves, but would also promote consistency between these preferences in a way that is easier to understand and is less fragile to future changes. Postgres has a similar notion (see Reviewed 4 of 11 files at r1. pkg/sql/parser/datum.go, line 580 at r1 (raw file):
long line. Also, it's more common to see types say "not safe for concurrent use" than "Do not call this function concurrently with the same" pkg/sql/parser/datum.go, line 651 at r1 (raw file):
long line again pkg/sql/parser/eval.go, line 891 at r1 (raw file):
Long lines throughout. pkg/sql/parser/expr.go, line 1060 at r1 (raw file):
No need for this, the return from pkg/sql/pgwire/types.go, line 86 at r1 (raw file):
Is this what Postgres returns? I'm seeing Comments from Reviewable |
Introduces minimal support for collation: a collated string type, the COLLATE operator, and overloads for casting and comparing collated strings. Significantly, other overloads for collated strings are not provided, since adding them without upgrading the type checker will confuse overload resolution (c.f. the discussion of timestamp vs. timestamptz in #9627). As a temporary workaround, cast to a string, call the string overload, and collate back. Tracking issue for collation: #2473
Review status: all files reviewed at latest revision, 8 unresolved discussions. pkg/sql/parser/datum.go, line 580 at r1 (raw file):
|
You haven't addressed the comment at the start of Nathan's review. If you do not plan to do this here at least either explain why or file a follow-up issue. |
I'll file a follow-up issue. Comments from Reviewable |
@eisenstatdavid, we still need to doc the new type, but I just regenerated the operators docs, and the collate operator isn't listed. Any ideas why? |
It has its own syntax: |
Introduces minimal support for collation: a collated string type, the
COLLATE operator, and overloads for casting and comparing collated
strings.
Significantly, other overloads for collated strings are not provided,
since adding them without upgrading the type checker will confuse
overload resolution (c.f. the discussion of timestamp vs. timestamptz in
#9627). As a temporary workaround, cast to a string, call the string
overload, and collate back.
Tracking issue for collation: #2473
This change is