Skip to content

Collation support? #354

@abigailalice

Description

@abigailalice

Is there any support for collations in rel8, or an easy way to implement them in terms of existing primitives? I saw rawBinaryOperator :: QualifiedName -> Expr a -> Expr b -> Expr c, but I don't think it makes sense for the b argument to actually be a Expr, given collation syntax in postgres looks like SELECT * FROM table WHERE "column" COLLATE "de_DE". If the second argument was an Expr we could generate something like SELECT * FROM table WHERE table.text COLLATE text.lang = 'something'?, which I don't believe is valid.

The collation needs to be hardcoded, so the type would probably be something like collate :: Expr Text -> Text -> Expr Text, and I'm not sure if something like this would be safe to use:

collate :: Text -> Expr Text -> Expr Text
collate ty txt = rawBinaryOperator "COLLATE" txt (unsafeLiteral (show ty) :: Expr Text) -- type signature needed to prevent ambiguous types

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions