6.0.0-git
2019-03-19

[#7750] SQL driver error on PERMS_ROOT with PostgreSQL
Summary SQL driver error on PERMS_ROOT with PostgreSQL
Queue Horde Framework Packages
Queue Version FRAMEWORK_3
Type Bug
State Resolved
Priority 2. Medium
Owners chuck (at) horde (dot) org
Requester marcus (at) riboflavin (dot) net
Created 2008-12-03 (3758 days ago)
Due
Updated 2008-12-22 (3739 days ago)
Assigned 2008-12-08 (3753 days ago)
Resolved 2008-12-22 (3739 days ago)
Milestone
Patch Yes

History
2008-12-22 03:51:49 Chuck Hagenbuch Comment #4
State ⇒ Resolved
Reply to this comment
Committed, thanks.
2008-12-08 02:46:38 Chuck Hagenbuch Comment #2
Assigned to Chuck Hagenbuch
State ⇒ Assigned
Reply to this comment
I still need to look at this.
2008-12-03 16:57:24 Marcus Ryan Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 2. Medium
Summary ⇒ SQL driver error on PERMS_ROOT with PostgreSQL
Queue ⇒ Horde Framework Packages
Milestone ⇒
Patch ⇒ Yes
New Attachment: patch Download
Reply to this comment
When trying to create a root permission for an application a call is 
made to the sql driver (Horde/Perms/sql.php) getPermissionId method.   
The call to the database is made as 'SELECT perm_id FROM horde_perms 
WHERE perm_name = ?', but at least with postgresql when the name id 
for PERMS_ROOT (-1) is passed, it's interpreted as a number, not a 
string, and postgresql complains:



Dec  3 10:25:55 dsl postgres[43453]: [5-3] STATEMENT:  SELECT perm_id 
FROM horde_perms WHERE perm_name = -1

Dec  3 10:26:10 dsl postgres[42457]: [5-1] ERROR:  operator does not 
exist: character varying = integer at character 49

Dec  3 10:26:10 dsl postgres[42457]: [5-2] HINT:  No operator matches 
the given name and argument type(s). You might need to add explicit 
type casts.



It seems reasonable to shortcut this (both for this bug and 
performance in general) to say if name == PERMS_ROOT return an id of 
PERMS_ROOT (works on my install anyway).

Saved Queries