6.0.0-alpha14
6/22/25

[#8899] Inconsistent data type for group_uid
Summary Inconsistent data type for group_uid
Queue Horde Framework Packages
Queue Version FRAMEWORK_3
Type Bug
State Resolved
Priority 2. Medium
Owners jan (at) horde (dot) org
Requester simon.jackson (at) carringbush (dot) net
Created 03/05/2010 (5588 days ago)
Due
Updated 03/17/2010 (5576 days ago)
Assigned
Resolved 03/17/2010 (5576 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
03/17/2010 04:22:19 PM Jan Schneider Comment #4
Assigned to Jan Schneider
State ⇒ Resolved
Priority ⇒ 2. Medium
Reply to this comment
The horde_groups table is the *only* table that uses integers. The 
reason that we are not using integers everywhere is simply because 
some group drivers don't have integer keys.
03/05/2010 09:55:15 AM simon (dot) jackson (at) carringbush (dot) net Comment #2 Reply to this comment

[Show Quoted Text - 24 lines]
The "patch" was also requires in sql_hierarchical.php on line 230.
03/05/2010 09:43:00 AM simon (dot) jackson (at) carringbush (dot) net Comment #1
Priority ⇒ 3. High
Type ⇒ Bug
Summary ⇒ Inconsistent data type for group_uid
Queue ⇒ Horde Framework Packages
Milestone ⇒
Patch ⇒ No
State ⇒ Unconfirmed
Reply to this comment
Many Horde and associated projects have a group_uid column. In some 
tables this is an INT (eg. horde_groups) in others a VARCHAR(255) (eg. 
ansel_shares_groups). Some code (eg horde/lib/Horde/Share/sql.php) 
ends up generating SQL fragments such as "group_uid in ( 1, 2 )". In 
PostgreSQL, this causes an error when group_uid has a datatype on 
VARCHAR(255).

A simple patch in horde/lib/Horde/Share/sql.php (1.1.2.57 2009-08-12) 
on line 691 from
    $group_ids[] = $this->_db->quote($id);
to
    $group_ids[] = $this->_db->quote((string)$id);
fixes this because PostgreSQL can cast automatically from string to 
int, but not vice versa (don't know why since one might things its the 
easier cast)

However, I suspect this is not the best approach.

Is there any reason why the column has different datatypes in 
different tables?

I have toyed with the ideas of creating a database update script which 
forces all the group_uid columns to be INT, but without a lot of code 
analyzing, I'm not sure whether this would work.

Saved Queries