bug 36087: PostgresUpdater fails on 8.3.14
authorsaper <saper@saper.info>
Thu, 19 Apr 2012 09:59:55 +0000 (11:59 +0200)
committersaper <saper@saper.info>
Thu, 19 Apr 2012 12:53:08 +0000 (14:53 +0200)
PostgresUpdater fails on PostgreSQL 8.3.14:

> Changing 'image.img_metadata' default value
> A database query syntax error has occurred.
> The last attempted database query was:
> "ALTER TABLE image ALTER img_metadata SET DEFAULT '\x'::bytea"
> from within function "".
> Database returned error "22P02: ERROR:  invalid input syntax for type
> bytea"

Patchset 2:

> Database returned error "42883: ERROR:  function
> generate_subscripts(int2vector, integer) does not exist
> LINE 7:     (SELECT generate_subscripts(isub.indkey, 1) AS g
>                     ^
> HINT:  No function matches the given name and argument types. You
> might need to add explicit type casts.
> "

Change-Id: I6e1811ded0eedad9c0eb0df715698c45aaf8e3f0

includes/db/DatabasePostgres.php
includes/installer/PostgresUpdater.php

index fc9c65a..a11b173 100644 (file)
@@ -559,7 +559,7 @@ class DatabasePostgres extends DatabaseBase {
                                i.indoption[s.g] as option,
                                pg_am.amname
                        FROM
-                               (SELECT generate_subscripts(isub.indkey, 1) AS g
+                               (SELECT generate_series(array_lower(isub.indkey,1), array_upper(isub.indkey,1)) AS g
                                        FROM
                                                pg_index isub
                                        JOIN pg_class cis
index 0d27c5a..a03c6c4 100644 (file)
@@ -185,9 +185,7 @@ class PostgresUpdater extends DatabaseUpdater {
                        array( 'changeNullableField', 'oldimage', 'oi_timestamp',  'NULL' ),
                        array( 'changeNullableField', 'oldimage', 'oi_major_mime', 'NULL' ),
                        array( 'changeNullableField', 'oldimage', 'oi_minor_mime', 'NULL' ),
-                       array( 'setDefault', 'image', 'img_metadata', '\'\x\'::bytea'),
                        array( 'changeNullableField', 'image', 'img_metadata', 'NOT NULL'),
-                       array( 'setDefault', 'filearchive', 'fa_metadata', '\'\x\'::bytea'),
                        array( 'changeNullableField', 'filearchive', 'fa_metadata', 'NOT NULL'),
                        array( 'changeNullableField', 'recentchanges', 'rc_cur_id', 'NULL' ),