[Tickets #8899] Inconsistent data type for group_uid

bugs at horde.org bugs at horde.org
Fri Mar 5 09:43:00 UTC 2010


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/8899
------------------------------------------------------------------------------
  Ticket             | 8899
  Created By         | simon.jackson at carringbush.net
  Summary            | Inconsistent data type for group_uid
  Queue              | Horde Framework Packages
  Version            | FRAMEWORK_3
  Type               | Bug
  State              | Unconfirmed
  Priority           | 3. High
  Milestone          |
  Patch              |
  Owners             |
------------------------------------------------------------------------------


simon.jackson at carringbush.net (2010-03-05 04:43) wrote:

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.






More information about the bugs mailing list