On Tue, Feb 03, 2009 at 02:48:15PM -0400, Devan Goodwin wrote:
>        FROM rhnSatelliteCert
>       WHERE label = :label
> - -     ORDER BY version DESC NULLS LAST
> +     ORDER BY 
> +         CASE WHEN version IS NULL
> +            THEN -1 
> +            ELSE version
> +         END
> +    DESC
> 
> Holler if you spot any problems.

Can't we just use those two fields, in the ORDER BY query?

I do not like that use of -1, which I assume is in the domain of
the type of version. It might work in this case now but it might
confuse people reading the code five years from now, and it might
confuse people who will be porting the NULLS LAST construct in
situation when the value of choice will actually be a possible
value of the column used.

-- 
Jan Pazdziora | adelton at #satellite*, #brno
Satellite Engineering, Red Hat

_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to