Last modified: 2013-11-30 10:53:56 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T59747, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 57747 - Port to Postgres Database
Port to Postgres Database
Status: UNCONFIRMED
Product: MediaWiki extensions
Classification: Unclassified
BlogPage (Other open bugs)
REL1_21-branch
Other Linux
: Unprioritized normal (vote)
: ---
Assigned To: Jack Phoenix
:
Depends on:
Blocks: postgres
  Show dependency treegraph
 
Reported: 2013-11-29 15:23 UTC by basti
Modified: 2013-11-30 10:53 UTC (History)
1 user (show)

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


Attachments
Patch of BlogHooks.php (421 bytes, patch)
2013-11-29 22:22 UTC, basti
Details
SQL file (1.91 KB, text/x-sql)
2013-11-29 22:24 UTC, basti
Details

Description basti 2013-11-29 15:23:09 UTC
Es ist ein Datenbankfehler aufgetreten. Der Grund kann ein Programmierfehler sein. Die letzte Datenbankabfrage lautete:

    UPDATE "user_stats" SET stats_opinions_created = NULL WHERE stats_user_id = '1'

aus der Funktion „BlogHooks::updateCreatedOpinionsCount“. Die Datenbank meldete den Fehler „23502: FEHLER: NULL-Wert in Spalte »stats_opinions_created« verletzt Not-Null-Constraint “.

I have chnaged BlockHooks.php line 171/172 to
array( 'stats_opinions_created' => $opinionsCreated ),
array( 'stats_opinions_created' => '1' ), 
and it works.

How can I solve this?

Regards,
basti
Comment 1 basti 2013-11-29 15:42:17 UTC
Sorry something get wrong on my post (2013-11-29 15:23:09) here.
I try to port BlogPage to postgres and "$opinionsCreated" seems to be allways null.

there is my postgres code i have create:

// SQL from comments-extention

-- set Schemata 
SET search_path = mediawiki;

CREATE TABLE "Comments"
(
  commentid SERIAL NOT NULL,
  Comment_Page_ID integer NOT NULL DEFAULT 0,
  Comment_user_id integer NOT NULL DEFAULT 0,
  Comment_Username varchar(200) NOT NULL DEFAULT '',
  Comment_Text text NOT NULL,
  Comment_Date timestamp without time zone NOT NULL,
  Comment_Parent_ID integer NOT NULL DEFAULT 0,
  Comment_IP varchar(45) NOT NULL DEFAULT '',
  Comment_Plus_Count integer NOT NULL DEFAULT 0,
  Comment_Minus_Count integer NOT NULL DEFAULT 0,
  CONSTRAINT comments_pkey PRIMARY KEY (commentid)
);

CREATE TABLE "Comments_Vote"
(
  comment_vote_id SERIAL PRIMARY KEY,
  Comment_Vote_user_id integer NOT NULL DEFAULT 0,
  Comment_Vote_Username varchar(200) NOT NULL DEFAULT '',
  Comment_Vote_Score integer NOT NULL DEFAULT 0,
  Comment_Vote_Date timestamp without time zone NOT NULL,
  Comment_Vote_IP varchar(45) NOT NULL DEFAULT ''
);

CREATE TABLE "Comments_block" (
  cb_id SERIAL PRIMARY KEY,
  cb_user_id integer NOT NULL default '0',
  cb_user_name varchar(255) NOT NULL default '',
  cb_user_id_blocked integer default NULL,
  cb_user_name_blocked varchar(255) NOT NULL default '',
  cb_date timestamp without time zone NOT NULL
);

-- set rights to the wikiuser, replace my_wikiuser with your defined database username

ALTER TABLE mediawiki."Comments"
  OWNER TO my_wikiuser;

ALTER TABLE mediawiki."Comments_Vote"
  OWNER TO my_wikiuser;

ALTER TABLE mediawiki."Comments_block"
  OWNER TO my_wikiuser;

-- maybe some more mysqlcompat functions are need
-- http://pgfoundry.org/projects/mysqlcompat/

-- or http://okbob.blogspot.de/2009/08/mysql-functions-for-postgresql.html

CREATE OR REPLACE FUNCTION ifnull(anyelement, anyelement)
  RETURNS anyelement AS
$BODY$
  SELECT COALESCE($1, $2)
$BODY$
  LANGUAGE sql IMMUTABLE
  
//END SQL from comments-extention

// SQL from SocialProfile/UserStats extention

-- Postgres version

CREATE TABLE user_stats (
  stats_user_id                        INTEGER  NOT NULL  DEFAULT 0  PRIMARY KEY,
  stats_year_id                        INTEGER  NOT NULL  DEFAULT 0,
  stats_user_name                      TEXT     NOT NULL  DEFAULT '',
  stats_user_image_count               INTEGER  NOT NULL  DEFAULT 0,
  stats_comment_count                  INTEGER  NOT NULL  DEFAULT 0,
  stats_comment_score                  INTEGER  NOT NULL  DEFAULT 0,
  stats_comment_score_positive_rec     INTEGER  NOT NULL  DEFAULT 0,
  stats_comment_score_negative_rec     INTEGER  NOT NULL  DEFAULT 0,
  stats_comment_score_positive_given   INTEGER  NOT NULL  DEFAULT 0,
  stats_comment_score_negative_given   INTEGER  NOT NULL  DEFAULT 0,
  stats_comment_blocked                INTEGER  NOT NULL  DEFAULT 0,
  stats_vote_count                     INTEGER  NOT NULL  DEFAULT 0,
  stats_edit_count                     INTEGER  NOT NULL  DEFAULT 0,
  stats_opinions_created               INTEGER  NOT NULL  DEFAULT 0,
  stats_opinions_published             INTEGER  NOT NULL  DEFAULT 0,
  stats_referrals                      INTEGER  NOT NULL  DEFAULT 0,
  stats_referrals_completed            INTEGER  NOT NULL  DEFAULT 0,
  stats_challenges_count               INTEGER  NOT NULL  DEFAULT 0,
  stats_challenges_won                 INTEGER  NOT NULL  DEFAULT 0,
  stats_challenges_rating_positive     INTEGER  NOT NULL  DEFAULT 0,
  stats_challenges_rating_negative     INTEGER  NOT NULL  DEFAULT 0,
  stats_friends_count                  INTEGER  NOT NULL  DEFAULT 0,
  stats_foe_count                      INTEGER  NOT NULL  DEFAULT 0,
  stats_gifts_rec_count                INTEGER  NOT NULL  DEFAULT 0,
  stats_gifts_sent_count               INTEGER  NOT NULL  DEFAULT 0,
  stats_weekly_winner_count            INTEGER  NOT NULL  DEFAULT 0,
  stats_monthly_winner_count           INTEGER  NOT NULL  DEFAULT 0,
  stats_total_points                   INTEGER            DEFAULT 0,
  stats_overall_rank                   INTEGER  NOT NULL  DEFAULT 0,
  up_complete                          INTEGER,
  user_board_count                     INTEGER           DEFAULT 0,
  user_board_sent                      INTEGER           DEFAULT 0,
  user_board_count_priv                INTEGER           DEFAULT 0,
  stats_picturegame_votes              INTEGER           DEFAULT 0,
  stats_picturegame_created            INTEGER           DEFAULT 0,
  user_status_count                    INTEGER           DEFAULT 0,
  stats_poll_votes                     INTEGER           DEFAULT 0,
  user_status_agree                    INTEGER           DEFAULT 0,
  stats_quiz_questions_answered        INTEGER           DEFAULT 0,
  stats_quiz_questions_correct         INTEGER           DEFAULT 0,
  stats_quiz_points                    INTEGER           DEFAULT 0,
  stats_quiz_questions_created         INTEGER           DEFAULT 0,
  stats_quiz_questions_correct_percent FLOAT             DEFAULT 0,
  stats_links_submitted                INTEGER  NOT NULL DEFAULT 0,
  stats_links_approved                 INTEGER  NOT NULL DEFAULT 0
);


-- perhaps this belong to RandomFeaturedUser ?
-- user_points_weekly table
-- https://github.com/svn2github/wikia/blob/master/extensions/RandomFeaturedUser/

-- set Schemata
SET search_path = mediawiki;

-- user_points_weekly
CREATE TABLE /*_*/user_points_weekly (
  up_id serial NOT NULL PRIMARY KEY,
  up_user_id integer NOT NULL default '0',
  up_user_name varchar(255) NOT NULL default '',
  up_points float NOT NULL default '0'
) /*$wgDBTableOptions*/;

CREATE INDEX /*i*/up_user_id ON /*_*/user_points_weekly (up_user_id);
ALTER TABLE mediawiki."user_points_weekly" OWNER TO my_wikiuser;

-- user_points_monthly
CREATE TABLE /*_*/user_points_monthly (
  `up_id` int(11) NOT NULL auto_increment PRIMARY KEY,
  `up_user_id` int(11) NOT NULL default '0',
  `up_user_name` varchar(255) NOT NULL default '',
  `up_points` float NOT NULL default '0'
) /*$wgDBTableOptions*/;

CREATE INDEX /*i*/up_user_id ON /*_*/user_points_monthly (up_user_id);
ALTER TABLE mediawiki."user_points_monthly" OWNER TO my_wikiuser;

-- user_points_archive
CREATE TABLE /*_*/user_points_archive (
  up_id serial NOT NULL PRIMARY KEY,
  up_period integer NOT NULL default '0',
  up_date timestamp without time zone NOT NULL,
  up_user_id integer NOT NULL default '0',
  up_user_name varchar(255) NOT NULL,
  up_points float NOT NULL default '0'
) /*$wgDBTableOptions*/;

CREATE INDEX up_user_id_archive ON user_points_archive (up_user_id);
ALTER TABLE mediawiki."user_points_archive" OWNER TO my_wikiuser;

//END SQL from SocialProfile/UserStats extention


// SQL from VoteNY extention

-- Postgres Version
-- author: Sebastian Fiedler

-- set Schemata
SET search_path = mediawiki;

CREATE TABLE "Vote" (
  -- Internal ID to identify between different vote tags on different pages
  vote_id SERIAL NOT NULL PRIMARY KEY,
  -- Username (if any) of the person who voted
  username varchar(255) NOT NULL default '0',
  -- User ID of the person who voted
  vote_user_id integer NOT NULL default '0',
  -- ID of the page where the vote tag is in
  vote_page_id integer NOT NULL default '0',
  -- Value of the vote (ranging from 1 to 5)
  vote_value char(1) NOT NULL default '',
  -- Timestamp when the vote was cast
  vote_date timestamp without time zone NOT NULL,
  -- IP address of the user who voted
  vote_ip varchar(45) NOT NULL default ''
) /*$wgDBTableOptions*/;

CREATE INDEX vote_page_id_index ON "Vote" (vote_page_id);
CREATE INDEX valueidx ON "Vote" (vote_value);
CREATE INDEX usernameidx ON "Vote" (username);
CREATE INDEX vote_date ON "Vote" (vote_date);


// END SQL from VoteNY extention

Have I forgot something?
Do not hesitate to contact me.
Comment 2 basti 2013-11-29 22:22:00 UTC
Created attachment 13936 [details]
Patch of BlogHooks.php

Postgres default use lowerCase names so escape it.
Comment 3 basti 2013-11-29 22:24:29 UTC
Created attachment 13937 [details]
SQL file

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


Navigation
Links