Last modified: 2012-09-14 15:21:35 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 36087 - Failed to run update.php for PostgresQL: invalid input syntax for type bytea
Failed to run update.php for PostgresQL: invalid input syntax for type bytea
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
1.20.x
PC Windows Server 2008
: Low major (vote)
: ---
Assigned To: Marcin Cieślak
:
Depends on:
Blocks: postgres
  Show dependency treegraph
 
Reported: 2012-04-19 09:23 UTC by Pei-Tang Huang
Modified: 2012-09-14 15:21 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Pei-Tang Huang 2012-04-19 09:23:54 UTC
When I run update.php, following exception raised:


> Changing column type of 'uploadstash.us_image_bits' from 'integer' to 'smallint'
> 
> ...column 'oldimage.oi_bits' is already set as NULL
> ...column 'oldimage.oi_timestamp' is already set as NULL
> ...column 'oldimage.oi_major_mime' is already set as NULL
> ...column 'oldimage.oi_minor_mime' is already set as NULL
> 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"

PostgresQL version: 8.3.14
Comment 1 Marcin Cieślak 2012-04-19 09:45:45 UTC
Hi Pei-Tang, 

which version of MediaWiki are you upgrading to?
Comment 2 Pei-Tang Huang 2012-04-19 09:48:09 UTC
Dear Marcin,

I am using the most recent version from git.
Comment 3 Marcin Cieślak 2012-04-19 10:03:51 UTC
Here is a proposed fix: 

https://gerrit.wikimedia.org/r/5307

Can you try:

git fetch https://gerrit.wikimedia.org/r/p/mediawiki/core refs/changes/07/5307/1 && git checkout -b bug/36087 FETCH_HEAD

and test the upgrade again?



In any way I would be interested in having output from 

pg_dump -U <pgsuperuser> -s -Fp -n mediawiki --quote-all-identifiers -O -x <yourdatabasename>

BEFORE and AFTER upgrade. (Change "mediawiki" to your PostgreSQL schema if using other than the default).
Comment 4 Pei-Tang Huang 2012-04-19 11:18:51 UTC
After checkout the proposed branch, I got another error:

> ...index 'logging_page_id_time' on table 'logging' already exists
> ...index 'iwl_prefix_title_from' on table 'iwlinks' already exists
> Creating index 'job_timestamp_idx' on table 'job' (job_timestamp)
> A database query syntax error has occurred.
> The last attempted database query was:
> "
> 			SELECT opcname,
> 				attname,
> 				i.indoption[s.g] as option,
> 				pg_am.amname
> 			FROM
> 				(SELECT generate_subscripts(isub.indkey, 1) AS g
> 					FROM
> 						pg_index isub
> 					JOIN pg_class cis
> 						ON cis.oid=isub.indexrelid
> 					JOIN pg_namespace ns
> 						ON cis.relnamespace = ns.oid
> 					WHERE cis.relname='pagelink_unique' AND ns.nspname='mediawiki') AS s,
> 				pg_attribute,
> 				pg_opclass opcls,
> 				pg_am,
> 				pg_class ci
> 				JOIN pg_index i
> 					ON ci.oid=i.indexrelid
> 				JOIN pg_class ct
> 					ON ct.oid = i.indrelid
> 				JOIN pg_namespace n
> 					ON ci.relnamespace = n.oid
> 				WHERE
> 					ci.relname='pagelink_unique' AND n.nspname='mediawiki'
> 					AND	attrelid = ct.oid
> 					AND	i.indkey[s.g] = attnum
> 					AND	i.indclass[s.g] = opcls.oid
> 					AND	pg_am.oid = opcls.opcmethod"
> from within function "DatabasePostgres::indexAttributes".
> 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.
> "

I found that "generate_subscripts" function was introduced in PostgresQL 8.4, is  PostgresQL 8.3 not supported by MediaWiki anymore?
Comment 5 Tim Landscheidt 2012-04-19 11:20:58 UTC
Without having checked the actual problem: Why not use "''::BYTEA" as the default?  It is equivalent to "'\x'::BYTEA" and compatible with earlier versions of PostgreSQL.
Comment 6 Marcin Cieślak 2012-04-19 12:31:06 UTC
This seems to be not necessary at all, I checked with Mediawiki 1.7.2 upgrade and we get the default properly. 

The problem is I didn't check with PostgreSQL 8.3 so now I need to fix indexAttributes.
Comment 7 Marcin Cieślak 2012-04-19 12:56:41 UTC
(In reply to comment #4)

> > 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.
> > "
> 
> I found that "generate_subscripts" function was introduced in PostgresQL 8.4,
> is  PostgresQL 8.3 not supported by MediaWiki anymore?

No, it should work.

I have updated the patch to fix this problem. Currently installing PostgreSQL 8.2 to test.
Comment 8 Tim Landscheidt 2012-04-19 13:49:21 UTC
(In reply to comment #7)
> [...]
> I have updated the patch to fix this problem. Currently installing PostgreSQL
> 8.2 to test.

8.2 is no longer supported by PostgreSQL.  I think supporting 8.3 is backbender enough :-).
Comment 9 Marcin Cieślak 2012-04-19 20:51:10 UTC
Right. We support 8.3 as the minimum (8.2 does not have ENUM's we need for some tables). 

I have tested migration of the MW 1.7.2 database structure on 8.3 to 1.20 and it works with the Patchset Two of Gerrit change #5307

git fetch https://gerrit.wikimedia.org/r/p/mediawiki/core refs/changes/07/5307/2 git checkout -b bug/36087 FETCH_HEAD
Comment 10 Pei-Tang Huang 2012-04-20 01:49:28 UTC
(In reply to comment #9)

> I have tested migration of the MW 1.7.2 database structure on 8.3 to 1.20 and
> it works with the Patchset Two of Gerrit change #5307

That patch works for me too, thank you!

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links