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 |
Fix casting errors when using SQL shares and groups on PostgreSQL (
Bug #8899).http://git.horde.org/diff.php/framework/Share/Share/sql.php?rt=horde-git&r1=9f529bff639f1cafde6bae97fa3d6c7ee0112bce&r2=6c1bfbb2741e6788db1c8acdfe41e42d0830f212
http://git.horde.org/diff.php/framework/Share/Share/sql_hierarchical.php?rt=horde-git&r1=a9e8ae51befc5a9fc97366e1f623e3a822060afa&r2=6c1bfbb2741e6788db1c8acdfe41e42d0830f212
http://git.horde.org/diff.php/horde/docs/CHANGES?rt=horde-git&r1=0af0faa7c463545483f3fae542f518ed8d0d2fcd&r2=6c1bfbb2741e6788db1c8acdfe41e42d0830f212
Assigned to Jan Schneider
State ⇒ Resolved
Priority ⇒ 2. Medium
reason that we are not using integers everywhere is simply because
some group drivers don't have integer keys.
Fix casting errors when using SQL shares and groups on PostgreSQL (
Bug #8899).http://cvs.horde.org/diff.php/framework/Share/Share/sql.php?rt=horde&r1=1.1.2.57&r2=1.1.2.58&ty=u
http://cvs.horde.org/diff.php/framework/Share/Share/sql_hierarchical.php?rt=horde&r1=1.17.2.27&r2=1.17.2.28&ty=u
http://cvs.horde.org/diff.php/horde/docs/CHANGES?rt=horde&r1=1.515.2.598&r2=1.515.2.599&ty=u
Priority ⇒ 3. High
Type ⇒ Bug
Summary ⇒ Inconsistent data type for group_uid
Queue ⇒ Horde Framework Packages
Milestone ⇒
Patch ⇒ No
State ⇒ Unconfirmed
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.