summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2011-03-03 18:22:18 +0000
committerTom Lane2011-03-03 18:22:18 +0000
commit94be9e3f0ca9e7ced66168397eb586565bced9ca (patch)
tree52cf49eafb11dffbb2d8c41f17860252abfcd644
parent6252c4f9e201f619e5eebda12fa867acd4e4200e (diff)
Fix citext's upgrade-from-unpackaged script to set its collation correctly.
Although there remains some debate about how CREATE TYPE should represent the collation property, this doesn't really affect what we need to do in citext's script, so go ahead and fix that.
-rw-r--r--contrib/citext/citext--unpackaged--1.0.sql12
1 files changed, 12 insertions, 0 deletions
diff --git a/contrib/citext/citext--unpackaged--1.0.sql b/contrib/citext/citext--unpackaged--1.0.sql
index 7dcdc39413..a59df36797 100644
--- a/contrib/citext/citext--unpackaged--1.0.sql
+++ b/contrib/citext/citext--unpackaged--1.0.sql
@@ -74,3 +74,15 @@ ALTER EXTENSION citext ADD function strpos(citext,citext);
ALTER EXTENSION citext ADD function replace(citext,citext,citext);
ALTER EXTENSION citext ADD function split_part(citext,citext,integer);
ALTER EXTENSION citext ADD function translate(citext,citext,text);
+
+--
+-- As of 9.1, type citext should be marked collatable. There is no ALTER TYPE
+-- command for this, so we have to do it by poking the pg_type entry directly.
+-- Notes: 100 is the OID of the "pg_catalog.default" collation --- it seems
+-- easier and more reliable to hard-wire that here than to pull it out of
+-- pg_collation. Also, we don't need a pg_depend entry since the default
+-- collation is pinned.
+--
+
+UPDATE pg_catalog.pg_type SET typcollation = 100
+WHERE oid = 'citext'::pg_catalog.regtype;