From 3ea5cbdbe725369a506875e10a6ab50736dac15c Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Fri, 21 Aug 2020 00:15:51 +0200 Subject: [PATCH] Order all unicode code points by default postgresql collation --- pgcollate | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 pgcollate diff --git a/pgcollate b/pgcollate new file mode 100755 index 0000000..5bca5c3 --- /dev/null +++ b/pgcollate @@ -0,0 +1,17 @@ +#!/usr/bin/python3 + +import psycopg2 + +db = psycopg2.connect("") + +csr = db.cursor() +csr.execute("drop table if exists t_pgcollate") +csr.execute("create table t_pgcollate(t text)") +for c in range(1, 0xD800): + csr.execute("insert into t_pgcollate(t) values(%s)", (chr(c),)) +for c in range(0xE000, 0x110000): + csr.execute("insert into t_pgcollate(t) values(%s)", (chr(c),)) +db.commit() +csr.execute("select * from t_pgcollate order by t") +for r in csr: + print(r)