Some questions about collations

Hey @eisen, great post on collations support!

I’ve got a couple of questions:

  1. The docs say “when inserting values into [a column defined with a default collation], you must specify the collation for every value”. Is this an unintended consequence of our type system, or a desirable thing? I’m asking because it seems pretty onerous.
    Also I’m not sure how this meshes with the fact that we don’t allow insertions of strings with a collation different than the column’s default. Does this mean that one can’t insert strings with any collation (other than a particular english one?) into columns with a default collation?

  2. Do we support overriding a column’s default collation in a filter such as:

    a text COLLATE "de_DE",

SELECT a < ('foo' COLLATE "fr_FR") FROM test;

Will this use the french collation for comparisons? If so, does this mean that an index on a would not be used?


  1. String literals should be able to resolve to any collated string type, but they don’t yet (so 'foo' instead of 'foo' COLLATE "fr_FR"). Other string values (e.g., from string columns) require explicit collation.

  2. You’d have to write (a COLLATE "fr_FR") < ('foo' COLLATE "fr_FR") to avoid the type error (ideally (a COLLATE "fr_FR") < 'foo' when we get the type system right), and the explicit expression on the LHS causes the index to be avoided.