| Author |
Message |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 29 Apr 2010 12:16:29
|
ranga.gopalan@sorrisotech.com
Member
Joined: 23 Feb 2010 12:55:49
Messages: 19
Offline
|
Hi,
I am running into a problem with trying to do a CASE statement within a query using summed values from a subquery. Please see SQL example and exception log from server below. (Build is from CVS with debuginfo enabled). Hope you can help.
Thanks,
Ranga
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 5 May 2010 15:55:49
|
Andrei_M
Senior member
Joined: 19 Dec 2008 01:37:13
Messages: 116
Offline
|
Hi Ranga,
FYI
We have just fixed the bug and checked in changes to CVS.
Thanks for reporting it.
Andrei
|
Thanks
Andrei |
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 5 May 2010 23:03:00
|
ranga.gopalan@sorrisotech.com
Member
Joined: 23 Feb 2010 12:55:49
Messages: 19
Offline
|
Hi Andrei,
I picked up the changes and built and tested again - The original query I posted works. However, I am running into another issue - (which I can work around but I thought I would let you know)
I can work around by avoiding the sub-query (the query itself is generated by a program) - Here is the exception seen in the console log.
Regards,
Ranga
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 6 May 2010 13:37:34
|
ranga.gopalan@sorrisotech.com
Member
Joined: 23 Feb 2010 12:55:49
Messages: 19
Offline
|
Hi Andrei,
I grabbed the latest source this morning and tried out with that - I noticed that a related test case fails - The sum/case combination that I described earlier in this message is in some cases being done from a union of two or more tables. In that scenario, I need something like the provided test case below to work - (and it currently doesn't). Please see details below.
Thanks,
Ranga
This fails with the following exception in the log:
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 6 May 2010 14:42:09
|
Andrei_M
Senior member
Joined: 19 Dec 2008 01:37:13
Messages: 116
Offline
|
Hi Ranga,
Sorry, last checkin introduced a regression.
Now it is fixed.
Sorry for the inconvenience.
Thanks,
Andrei
|
Thanks
Andrei |
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 6 May 2010 17:13:27
|
ranga.gopalan@sorrisotech.com
Member
Joined: 23 Feb 2010 12:55:49
Messages: 19
Offline
|
Hi Andrei,
I tested with the latest and I'm super thrilled that the query in all its complexity works now! - See full example below.
However, I am running into a related parser issue - in this scenario - The query works fine via gs-cmdline.sh - However, fails via JDBC when I specify the value range for AGLIM.f2col using parameters to a prepared statement. I can work around it by hardcoding the values but would prefer to use the PreparedStatement with parameters so that hopefully the repeated parsing of the queries can be avoided.
See code example below:
Output from the program:
Output in console log:
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 6 May 2010 17:33:19
|
ranga.gopalan@sorrisotech.com
Member
Joined: 23 Feb 2010 12:55:49
Messages: 19
Offline
|
Hi Andrei,
Other than the JDBC param invocation issue mentioned above, one additional issue remains - the union subquery does not work as described a couple of messages above - I mean a query with a union in the subquery fails as below. - I have attached an exception trace a couple of post above.
Regards,
Ranga
|
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 20 May 2010 15:30:47
|
Andrei_M
Senior member
Joined: 19 Dec 2008 01:37:13
Messages: 116
Offline
|
Hi Ranga,
We have checked in few bug fixes, that should resolve problems you reported here.
Note, for some queries GridSQL can not determine data types of expression, causing query to fail.
The query select bb.f1, sum(bb.f2col) as sumcol from (select f1, f2 as f2col, null as f3col from rol1 union all select f1, null as f2col, f3 as f3col from rol2) bb group by bb.f1; is the case.
To workaround this problem explicit typecast should be used:
select bb.f1, sum(bb.f2col) as sumcol from (select f1, f2 as f2col, null::int as f3col from rol1 union all select f1, null::int as f2col, f3 as f3col from rol2) bb group by bb.f1;
Thanks,
Andrei
|
Thanks
Andrei |
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 21 May 2010 01:00:41
|
ranga.gopalan@sorrisotech.com
Member
Joined: 23 Feb 2010 12:55:49
Messages: 19
Offline
|
Hi Andrei,
I updated to the latest from the source and tried - and with your suggestion about the type cast I was able to run the union query successfully. Thanks for that - though I ran into a 10 param limit issue - I posted another message about it.
Regards,
Ranga
|
|
|
 |
|
|
|
|