[CDBI] Re: Class::DBI internal column swapping wierdness ? - possible resolution! (UNION DISTINCT)?

Edward J. Sabol sabol at alderaan.gsfc.nasa.gov
Thu Oct 6 21:31:40 BST 2005


> I think you'll find the query is a bit of a red-herring, the critical bit, as 
> far as I can tell, is the UNION DISTINCT, as described above.  I could be 
> wrong of course, it's only a theory :-)

Personally, I suspect the part that comes immediately after the "UNION
DISTINCT", namely the "SELECT * from task". For the SQL to be compatible with
the part provided by CDBI, it should be "SELECT __ESSENTIAL__ FROM
__TABLE__".

So try this instead:

        my $sql = qq|name IN (
                       SELECT name FROM task where shared = 'NO' AND
                                                   application = '$application'
                     UNION DISTINCT
                   SELECT __ESSENTIAL__ FROM __TABLE__
                          where shared = 'YES' AND application IN (
                          SELECT name FROM application WHERE container =
                          '$container')|;

It would be an interesting thing to try anyway. Let us know if that solves
your problem or not?

Hope this helps,
Ed




More information about the ClassDBI mailing list