6.0.0-git
2018-12-15

[#14878] Sequence reset incompatible with PostgreSQL 10+
Summary Sequence reset incompatible with PostgreSQL 10+
Queue Horde Base
Queue Version 5.2.20
Type Bug
State Unconfirmed
Priority 2. Medium
Owners
Requester stefan (at) stklcode (dot) de
Created 2018-11-26 (19 days ago)
Due
Updated 2018-11-26 (19 days ago)
Assigned
Resolved
Milestone
Patch No

History
2018-11-26 11:16:13 stefan (at) stklcode (dot) de Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 2. Medium
Summary ⇒ Sequence reset incompatible with PostgreSQL 10+
Queue ⇒ Horde Base
Milestone ⇒
Patch ⇒ No
New Attachment: horde-seq-pg11.log Download
Reply to this comment
After upgrading the database from PostgreSQL 9.6 to 11 certain 
operations fail when trying to reset a sequence.

Example to reproduce:
Create a new event in Kronolith raises an error (see attached log). 
After refreshing the page the event is created successfully.

Cause:
Method "resetPkSequence" in file 
"pear/Horde/Db/Adapter/Postgresql/Schema.php" executes the following 
SQL:
SELECT setval(%s, (SELECT COALESCE(MAX(%s) + (SELECT increment_by FROM 
%s), (SELECT min_value FROM %s)) FROM %s), false)

Sequence column "increment_by" is no longer available in PostgreSQL 10 
and above.

Saved Queries