Skip to content

Commit

Permalink
bug 816230 - Added post 9.2 upgrade steps for v29
Browse files Browse the repository at this point in the history
  • Loading branch information
selenamarie committed Nov 28, 2012
1 parent fe7a32e commit 886164c
Show file tree
Hide file tree
Showing 29 changed files with 199 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.. License, v. 2.0. If a copy of the MPL was not distributed with this
.. file, You can obtain one at http://mozilla.org/MPL/2.0/.
28.0 Database Updates
29.0 Database Updates
=====================

This batch makes the following database changes:
Expand Down
File renamed without changes.
102 changes: 102 additions & 0 deletions sql/upgrade/29.0/citext-updates.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
BEGIN;

--
-- 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.
-- We have to poke any derived copies in pg_attribute or pg_index as well,
-- as well as those for arrays/domains based directly or indirectly on citext.
-- 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 to make pg_depend entries since the
-- default collation is pinned.
--
WITH RECURSIVE typeoids(typoid) AS
( SELECT 'citext'::pg_catalog.regtype UNION
SELECT oid FROM pg_catalog.pg_type, typeoids
WHERE typelem = typoid OR typbasetype = typoid )
UPDATE pg_catalog.pg_type SET typcollation = 100
FROM typeoids
WHERE oid = typeoids.typoid;
WITH RECURSIVE typeoids(typoid) AS
( SELECT 'citext'::pg_catalog.regtype UNION
SELECT oid FROM pg_catalog.pg_type, typeoids
WHERE typelem = typoid OR typbasetype = typoid )
UPDATE pg_catalog.pg_attribute SET attcollation = 100
FROM typeoids
WHERE atttypid = typeoids.typoid;
UPDATE pg_catalog.pg_index SET indcollation[0] = 100
WHERE indclass[0] IN (
WITH RECURSIVE typeoids(typoid) AS
( SELECT 'citext'::pg_catalog.regtype UNION
SELECT oid FROM pg_catalog.pg_type, typeoids
WHERE typelem = typoid OR typbasetype = typoid )
SELECT oid FROM pg_catalog.pg_opclass, typeoids
WHERE opcintype = typeoids.typoid
);
UPDATE pg_catalog.pg_index SET indcollation[1] = 100
WHERE indclass[1] IN (
WITH RECURSIVE typeoids(typoid) AS
( SELECT 'citext'::pg_catalog.regtype UNION
SELECT oid FROM pg_catalog.pg_type, typeoids
WHERE typelem = typoid OR typbasetype = typoid )
SELECT oid FROM pg_catalog.pg_opclass, typeoids
WHERE opcintype = typeoids.typoid
);
UPDATE pg_catalog.pg_index SET indcollation[2] = 100
WHERE indclass[2] IN (
WITH RECURSIVE typeoids(typoid) AS
( SELECT 'citext'::pg_catalog.regtype UNION
SELECT oid FROM pg_catalog.pg_type, typeoids
WHERE typelem = typoid OR typbasetype = typoid )
SELECT oid FROM pg_catalog.pg_opclass, typeoids
WHERE opcintype = typeoids.typoid
);
UPDATE pg_catalog.pg_index SET indcollation[3] = 100
WHERE indclass[3] IN (
WITH RECURSIVE typeoids(typoid) AS
( SELECT 'citext'::pg_catalog.regtype UNION
SELECT oid FROM pg_catalog.pg_type, typeoids
WHERE typelem = typoid OR typbasetype = typoid )
SELECT oid FROM pg_catalog.pg_opclass, typeoids
WHERE opcintype = typeoids.typoid
);
UPDATE pg_catalog.pg_index SET indcollation[4] = 100
WHERE indclass[4] IN (
WITH RECURSIVE typeoids(typoid) AS
( SELECT 'citext'::pg_catalog.regtype UNION
SELECT oid FROM pg_catalog.pg_type, typeoids
WHERE typelem = typoid OR typbasetype = typoid )
SELECT oid FROM pg_catalog.pg_opclass, typeoids
WHERE opcintype = typeoids.typoid
);
UPDATE pg_catalog.pg_index SET indcollation[5] = 100
WHERE indclass[5] IN (
WITH RECURSIVE typeoids(typoid) AS
( SELECT 'citext'::pg_catalog.regtype UNION
SELECT oid FROM pg_catalog.pg_type, typeoids
WHERE typelem = typoid OR typbasetype = typoid )
SELECT oid FROM pg_catalog.pg_opclass, typeoids
WHERE opcintype = typeoids.typoid
);
UPDATE pg_catalog.pg_index SET indcollation[6] = 100
WHERE indclass[6] IN (
WITH RECURSIVE typeoids(typoid) AS
( SELECT 'citext'::pg_catalog.regtype UNION
SELECT oid FROM pg_catalog.pg_type, typeoids
WHERE typelem = typoid OR typbasetype = typoid )
SELECT oid FROM pg_catalog.pg_opclass, typeoids
WHERE opcintype = typeoids.typoid
);
UPDATE pg_catalog.pg_index SET indcollation[7] = 100
WHERE indclass[7] IN (
WITH RECURSIVE typeoids(typoid) AS
( SELECT 'citext'::pg_catalog.regtype UNION
SELECT oid FROM pg_catalog.pg_type, typeoids
WHERE typelem = typoid OR typbasetype = typoid )
SELECT oid FROM pg_catalog.pg_opclass, typeoids
WHERE opcintype = typeoids.typoid
);
-- somewhat arbitrarily, we assume no citext indexes have more than 8 columns

COMMIT;

File renamed without changes.
File renamed without changes.
File renamed without changes.
88 changes: 88 additions & 0 deletions sql/upgrade/29.0/recreate-views.sql

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 8 additions & 1 deletion sql/upgrade/28.0/upgrade.sh → sql/upgrade/29.0/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ set -e
CURDIR=$(dirname $0)
DBNAME=$1
: ${DBNAME:="breakpad"}
VERSION=28.0
VERSION=29.0

echo '*********************************************************'
echo 'Post 9.2 upgrade steps'
echo 'bug 816230'

psql -f ${CURDIR}/citext-updates.sql $DBNAME
psql -f ${CURDIR}/recreate-views.sql $DBNAME

echo '*********************************************************'
echo 'Remove all memory parameters from functions'
Expand Down

0 comments on commit 886164c

Please sign in to comment.