Re: getting database-error when editing as "major edit"

Reini Urban <[email protected]>
Newsgroups gmane.comp.web.wiki.phpwiki.talk
Message-ID <[email protected]>
Sven Roederer schrieb:
> Hi,
> 
> I started using phpwiki some years ago, as it was the first system which I 
> easily integrated into my running software (LDAP-auth; Postgres).
> Some months ago (in 2007) I upgraded to version 1.3.14, according to the 
> steps in the manual.
> In case I remember correctly since this upgrade I've some trouble with 
> editing some pages of the wiki.
> My problem is the following:
> The not working pages behaves 
> as "https://www.roederer.dhs.org/wiki/index.php/EinkaufsListe" 
> (https://www.roederer.dhs.org/wiki/index.php/Knowledge
>  is a working page). I can only save edits of this page when they are 
> marked as "minor change". When this marking is not done (automatically or 
> manually) I get the following error-msg:
> -----------------------------------------------------------------------------
> Fatal Error:
> lib/WikiDB/backend/PearDB.php:1059 Error: wikidb_backend_peardb_pgsql: 
> fatal database error 
>  DB Error: constraint violation
>  (INSERT INTO recent (id, latestversion, latestmajor, latestminor) SELECT 
> id, MAX(version), MAX(CASE WHEN minor_edit=0 THEN version END), MAX(CASE 
> WHEN minor_edit<>0 THEN version END) FROM version WHERE id=553 GROUP BY 
> id [nativecode=ERROR: new row for relation "recent" violates check 
> constraint "$1"])
> 
> Fatal PhpWiki Error
> lib/WikiDB/backend/PearDB.php:1059 Error: wikidb_backend_peardb_pgsql: 
> fatal database error 
>  DB Error: constraint violation
>  (INSERT INTO recent (id, latestversion, latestmajor, latestminor) SELECT 
> id, MAX(version), MAX(CASE WHEN minor_edit=0 THEN version END), MAX(CASE 
> WHEN minor_edit<>0 THEN version END) FROM version WHERE id=553 GROUP BY 
> id [nativecode=ERROR: new row for relation "recent" violates check 
> constraint "$1"])
> -----------------------------------------------------------------------------
> 
> As written by the databse-engine, there is a constraint violation. 
> 
> Can anyone give me a hint how to fix this? As I'm not familar with the 
> internal database-organization.
> 
> Kind regards  
> Sven

Hi Sven,

This is clearly an error with the very new postgresql schema.
I just looked and it looks like that all the new stricter checks and 
optimizations features for postgresql are not yet enabled in the release
and the page save method (set_versiondata) is using the generic version.

Until I can fix that, can you try the other DATABASE_TYPE = ADODB
I'm mainly working with ADODB, and backport changes after a while to the 
more stable SQL with the PearDB backend.

The constraint is question is CHECK (latestminor >= latestmajor).
Maybe you should disable this constraint, but first I want to reproduce 
and debug that.

Which postgresql version exactly?
I use 7.4.19, 8.2.9 and 8.3.3, but only occasionally.
-- 
Reini Urban
http://phpwiki.org/  http://murbreak.at/

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.