Fix Oracle installation SQL
authorFreakolowsky <freak@drajv.si>
Fri, 23 Aug 2013 08:48:59 +0000 (10:48 +0200)
committerBartosz Dziewoński <matma.rex@gmail.com>
Thu, 31 Oct 2013 19:35:28 +0000 (20:35 +0100)
The starting and minimal values of sequences on Oracle are both '1' by
default. We want a user with id of 0 (used for anonymous edits), so
these were both set to '0' and the user was inserted with its id being
the next value in the sequence.

However, due to some low level caching settings you can miss the first
value in a sequence. It makes no difference to other sequences, but it
does with this one, as it must be 0 to maintain foreign key validity.
Therefore let's just set the sequence to default starting value of '1'
and insert the user with hardcoded id=0.

Bug: 38411
Change-Id: Ic9a17b92d6052fbdc24dd431726e4d82dbf48034

maintenance/oracle/tables.sql

index acfabc3..607d7b9 100644 (file)
@@ -2,7 +2,7 @@
 define mw_prefix='{$wgDBprefix}';
 
 
-CREATE SEQUENCE user_user_id_seq MINVALUE 0 START WITH 0;
+CREATE SEQUENCE user_user_id_seq;
 CREATE TABLE &mw_prefix.mwuser ( -- replace reserved word 'user'
   user_id                   NUMBER  NOT NULL,
   user_name                 VARCHAR2(255)     NOT NULL,
@@ -27,7 +27,7 @@ CREATE INDEX &mw_prefix.mwuser_i02 ON &mw_prefix.mwuser (user_email, user_name);
 
 -- Create a dummy user to satisfy fk contraints especially with revisions
 INSERT INTO &mw_prefix.mwuser
-  VALUES (user_user_id_seq.nextval,'Anonymous',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '', current_timestamp, current_timestamp, 0);
+  VALUES (0,'Anonymous',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, '', current_timestamp, current_timestamp, 0);
 
 CREATE TABLE &mw_prefix.user_groups (
   ug_user   NUMBER      DEFAULT 0 NOT NULL,