[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [UDD] Enhances field in packages table should be text[] (array) rather than text



On 13/01/11 at 11:41 +0100, Andreas Tille wrote:
> Hi,
> 
> for the Blends tasks pages I used to query UDD for packages which are
> enhancing a given package pkgX by doing
> 
>    SELECT DISTINCT package, enhances FROM packages
>     WHERE enhances LIKE '%pkgX%' ;
> 
> which worked so far.  It has turned out that the way I did the queries
> was stressing UDD hardly when I did the query for every single package
> and several features in singular queries.  My attempt was to query for
> all needed features for an *array* of packages.  I succeeded with this
> implementation with the exception of the enhances value.  While
> theoretically I could try something like
> 
>    SELECT DISTINCT package, enhances WHILE packages
>     WHERE enhances LIKE ANY( '{"%pkgX%","%pkgY%", ...}' );
> 
> the wrapping of the package names into '%' and turning it into an array
> seems quite hackish.  Some effort to parse afterwards for false
> positives (packages named like abc_pkgX_yz or something like this) has
> to be done and inventing regular expressions might or might not work
> with the ANY(array) construct (I have not checked).
> 
> I would consider it much more logical if the enhances field itself would
> be an array which would enable more simple queriesi.  It is not brain
> dead simple as well because the optionally appended versions need some
> additional handling but at least the array structure reflects the sense
> of this field much better as a comma separated string.
> 
> Any thoughts?
> 
> BTW, what are the use cases of this field.  Is it used in any other
> UDD application which relays on the comma separated string?

It would be better to have both a array-ifed version of the field, and a
text version of the field, in the packages table. That way,
compatibility is preserved. Patch welcomed.

L.


Reply to: