Page MenuHomePhabricator

Installation to Oracle backend fails with a ORA-00947 'Not Enough Values'
Closed, ResolvedPublic

Description

Oracle installation fails at the Creating Tables step with the following Error:

Creating tables...
A database query error has occurred. This may indicate a bug in the software.

Query:
INSERT INTO page VALUES (0, 0, ' ', NULL, 0, 0, 0, 0, current_timestamp, NULL, 0, 0, NULL)
Function: DatabaseOracle::doQuery
Error: 947 ORA-00947: not enough values
Backtrace:

#0 /u1/MediaWiki/includes/db/DatabaseOracle.php(422): DatabaseOracle->reportQueryError('ORA-00947: not ...', 947, 'INSERT INTO pag...', 'DatabaseOracle:...')
#1 /u1/MediaWiki/includes/db/DatabaseOracle.php(1240): DatabaseOracle->doQuery('INSERT INTO pag...')
#2 /u1/MediaWiki/includes/db/Database.php(3860): DatabaseOracle->sourceStream(Resource id #158, false, false, 'DatabaseBase::s...', false)
#3 /u1/MediaWiki/includes/installer/DatabaseInstaller.php(196): DatabaseBase->sourceFile('/u1/MediaWiki/m...')
#4 /u1/MediaWiki/includes/installer/DatabaseInstaller.php(218): DatabaseInstaller->stepApplySourceFile('getSchemaPath', 'install', true)
#5 /u1/MediaWiki/includes/installer/OracleInstaller.php(287): DatabaseInstaller->createTables()
#6 [internal function]: OracleInstaller->createTables(Object(OracleInstaller))
#7 /u1/MediaWiki/includes/installer/Installer.php(1584): call_user_func(Array, Object(OracleInstaller))
#8 /u1/MediaWiki/includes/installer/WebInstallerPage.php(1418): Installer->performInstallation(Array, Array)
#9 /u1/MediaWiki/includes/installer/WebInstaller.php(280): WebInstallerInstall->execute()
#10 /u1/MediaWiki/mw-config/index.php(79): WebInstaller->execute(Array)
#11 /u1/MediaWiki/mw-config/index.php(38): wfInstallerMain()
#12 {main}


Version: 1.24rc
Severity: blocker

Details

Reference
bz71022

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:55 AM
bzimport set Reference to bz71022.
Wmat created this task.Sep 18 2014, 8:14 PM

Thanks for taking the time to report this!

Is this a fresh installation, or on an existing database / upgrade?
Which Oracle version is this? I assume this is MediaWiki git master?

Wmat added a comment.Sep 18 2014, 11:41 PM

(In reply to Andre Klapper from comment #1)

Thanks for taking the time to report this!
Is this a fresh installation, or on an existing database / upgrade?
Which Oracle version is this? I assume this is MediaWiki git master?

Hi Andre,

Yes, this is a fresh installation of MediaWiki git master. I will find out the Oracle version tomorrow for you.

In my investigation, it would appear that in ../maintenance/oracle/tables.sql the there are 14 columns defined in the Page table, but immediately following the definition the insert statement only contains 13 values. I think one of the timestamp values is missing.

Wmat added a comment.Sep 18 2014, 11:44 PM

(In reply to Bill Traynor from comment #2)

(In reply to Andre Klapper from comment #1)

Thanks for taking the time to report this!
Is this a fresh installation, or on an existing database / upgrade?
Which Oracle version is this? I assume this is MediaWiki git master?

Hi Andre,
Yes, this is a fresh installation of MediaWiki git master. I will find out
the Oracle version tomorrow for you.
In my investigation, it would appear that in
../maintenance/oracle/tables.sql the there are 14 columns defined in the
Page table, but immediately following the definition the insert statement
only contains 13 values. I think one of the timestamp values is missing.

Here's the code I was referring to:

CREATE SEQUENCE page_page_id_seq;
CREATE TABLE &mw_prefix.page (

page_id            NUMBER        NOT NULL,
page_namespace     NUMBER       DEFAULT 0 NOT NULL,
page_title         VARCHAR2(255)           NOT NULL,
page_restrictions  VARCHAR2(255),
page_counter       NUMBER         DEFAULT 0 NOT NULL,
page_is_redirect   CHAR(1)           DEFAULT '0' NOT NULL,
page_is_new        CHAR(1)           DEFAULT '0' NOT NULL,
page_random        NUMBER(15,14) NOT NULL,
page_touched       TIMESTAMP(6) WITH TIME ZONE,
page_links_updated TIMESTAMP(6) WITH TIME ZONE,
page_latest        NUMBER        DEFAULT 0 NOT NULL, -- FK?
page_len           NUMBER        DEFAULT 0 NOT NULL,
page_content_model VARCHAR2(32),
page_lang VARCHAR2(35) DEFAULT NULL

);
ALTER TABLE &mw_prefix.page ADD CONSTRAINT &mw_prefix.page_pk PRIMARY
KEY (page_id);
CREATE UNIQUE INDEX &mw_prefix.page_u01 ON &mw_prefix.page
(page_namespace,page_title);
CREATE INDEX &mw_prefix.page_i01 ON &mw_prefix.page (page_random);
CREATE INDEX &mw_prefix.page_i02 ON &mw_prefix.page (page_len);
CREATE INDEX &mw_prefix.page_i03 ON &mw_prefix.page (page_is_redirect,
page_namespace, page_len);

  • Create a dummy page to satisfy fk contraints especially with revisions

INSERT INTO &mw_prefix.page

VALUES (0, 0, ' ', NULL, 0, 0, 0, 0, current_timestamp, NULL, 0, 0, NULL);

I see 14 columns defined, but only 13 values being passed. How can
this ever work?

Wmat added a comment.Sep 19 2014, 1:37 PM

In looking closer at the code, I think the Create a dummy page to satisfy fk constraints is missing a NULL value at the end of:

INSERT INTO &mw_prefix.page

VALUES (0, 0, ' ', NULL, 0, 0, 0, 0, current_timestamp, NULL, 0, 0, NULL);

Testing today.

Wmat added a comment.Sep 19 2014, 3:04 PM

Adding a NULL to the end of:

INSERT INTO &mw_prefix.page

VALUES (0, 0, ' ', NULL, 0, 0, 0, 0, current_timestamp, NULL, 0, 0, NULL);

Fixed this error.

I will make a note to submit a patch for this.

Change 161485 had a related patch set uploaded by Brian Wolff:
Added missing NULL value to sql insert statement.

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

Change 161485 merged by jenkins-bot:
Added missing NULL value to sql insert statement.

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

successfully merged

Was that only broken in git master, or also in 1.23 tarballs (-> consider backporting)?

(In reply to Andre Klapper from comment #9)

Was that only broken in git master, or also in 1.23 tarballs (-> consider
backporting)?

The new column was added with gerrit 135312, which is 1.24 -> no backporting

(In reply to Umherirrender from comment #10)

(In reply to Andre Klapper from comment #9)

Was that only broken in git master, or also in 1.23 tarballs (-> consider
backporting)?

The new column was added with Gerrit change #135312, which is 1.24 -> no
backporting

The release branch is not created yet, maybe it needs backporting there.