Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9b97b7f

Browse files
committed
Fix citext upgrade script to update derived copies of pg_type.typcollation.
If the existing citext type has not merely been created, but used in anytables, then the upgrade script wasn't doing enough. We have to updateattcollation for each citext table column, and indcollation for each citextindex column, as well. Per report from Rudolf van der Leeden.
1 parentb985d48 commit9b97b7f

File tree

1 file changed

+40
-2
lines changed

1 file changed

+40
-2
lines changed

‎contrib/citext/citext--unpackaged--1.0.sql

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,49 @@ ALTER EXTENSION citext ADD function translate(citext,citext,text);
8181
--
8282
-- As of 9.1, type citext should be marked collatable. There is no ALTER TYPE
8383
-- command for this, so we have to do it by poking the pg_type entry directly.
84+
-- We have to poke any derived copies in pg_attribute or pg_index as well.
8485
-- Notes: 100 is the OID of the "pg_catalog.default" collation --- it seems
8586
-- easier and more reliable to hard-wire that here than to pull it out of
86-
-- pg_collation. Also, we don't needapg_dependentry since the default
87-
-- collation is pinned.
87+
-- pg_collation. Also, we don't needto makepg_dependentries since the
88+
--defaultcollation is pinned.
8889
--
8990

9091
UPDATEpg_catalog.pg_typeSET typcollation=100
9192
WHEREoid='citext'::pg_catalog.regtype;
93+
94+
UPDATEpg_catalog.pg_attributeSET attcollation=100
95+
WHERE atttypid='citext'::pg_catalog.regtype;
96+
97+
UPDATEpg_catalog.pg_indexSET indcollation[0]=100
98+
WHERE indclass[0]IN (SELECToidFROMpg_catalog.pg_opclass
99+
WHERE opcintype='citext'::pg_catalog.regtype);
100+
101+
UPDATEpg_catalog.pg_indexSET indcollation[1]=100
102+
WHERE indclass[1]IN (SELECToidFROMpg_catalog.pg_opclass
103+
WHERE opcintype='citext'::pg_catalog.regtype);
104+
105+
UPDATEpg_catalog.pg_indexSET indcollation[2]=100
106+
WHERE indclass[2]IN (SELECToidFROMpg_catalog.pg_opclass
107+
WHERE opcintype='citext'::pg_catalog.regtype);
108+
109+
UPDATEpg_catalog.pg_indexSET indcollation[3]=100
110+
WHERE indclass[3]IN (SELECToidFROMpg_catalog.pg_opclass
111+
WHERE opcintype='citext'::pg_catalog.regtype);
112+
113+
UPDATEpg_catalog.pg_indexSET indcollation[4]=100
114+
WHERE indclass[4]IN (SELECToidFROMpg_catalog.pg_opclass
115+
WHERE opcintype='citext'::pg_catalog.regtype);
116+
117+
UPDATEpg_catalog.pg_indexSET indcollation[5]=100
118+
WHERE indclass[5]IN (SELECToidFROMpg_catalog.pg_opclass
119+
WHERE opcintype='citext'::pg_catalog.regtype);
120+
121+
UPDATEpg_catalog.pg_indexSET indcollation[6]=100
122+
WHERE indclass[6]IN (SELECToidFROMpg_catalog.pg_opclass
123+
WHERE opcintype='citext'::pg_catalog.regtype);
124+
125+
UPDATEpg_catalog.pg_indexSET indcollation[7]=100
126+
WHERE indclass[7]IN (SELECToidFROMpg_catalog.pg_opclass
127+
WHERE opcintype='citext'::pg_catalog.regtype);
128+
129+
-- somewhat arbitrarily, we assume no citext indexes have more than 8 columns

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp