6.0.0-git
2021-01-24

[#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 2010-03-05 (3978 days ago)
Due
Updated 2010-03-17 (3966 days ago)
Assigned
Resolved 2010-03-17 (3966 days ago)
Milestone
Patch No

History
2010-03-17 16:22:19 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.
2010-03-05 09:55:15 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.
2010-03-05 09:43:00 simon (dot) jackson (at) carringbush (dot) net Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 3. High
Summary ⇒ Inconsistent data type for group_uid
Queue ⇒ Horde Framework Packages
Milestone ⇒
Patch ⇒ No
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