0

I'm working on reimplementing a Postgres schema in MySQL, and one of the things I can't seem to find a clear equivalent for is Postgres' "C" collation.

id TEXT COLLATE "C" NOT NULL

What would be the equivalent collation for MySQL?

  • I would love now what would possess you to downgrade? =) – Evan Carroll Jun 15 '18 at 2:41
  • 2
    @EvanCarroll I'm writing a MySQL adapter for an open source project that only has a Postgres adapter at the moment. The idea is to give users the ability to use the project with a wider variety of storage backends. – dstaley Jun 15 '18 at 3:07
0

C is PostgreSQL's way of saying do not reinterpret the data, order it according to binary byte comparisons. From the docs

On all platforms, the collations named default, C, and POSIX are available. Additional collations may be available depending on operating system support. The default collation selects the LC_COLLATE and LC_CTYPE values specified at database creation time. The C and POSIX collations both specify “traditional C” behavior, in which only the ASCII letters “A” through “Z” are treated as letters, and sorting is done strictly by character code byte values.

MySQL seems to call it binary the "Binary pseudo charset". Whether or not they're optimized to take advantage of that is another question.

See also

  • it looks like utf8mb4_bin is probably the one he wants. – Jasen Jun 15 '18 at 10:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.