Order all unicode code points by default postgresql collation

This commit is contained in:
Peter J. Holzer 2020-08-21 00:15:51 +02:00
commit 3ea5cbdbe7
1 changed files with 17 additions and 0 deletions

17
pgcollate Executable file
View File

@ -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)