The forum will experience an outage sometime between February 10 at 7:00pm EST and February 12 at 11:59 EST for installation of security updates. The actual time and duration of the outage are unknown but attempts will be made to minimize the downtime. We apologize for any inconvenience.


I have a query that makes Ultralite crash, both on iPad and on Interactive SQL application. I will put here a similar query that allows anyone to reproduce the problem:

  when < 1000 then 'a' 
  when >= 1000 and < 2000 then 'b' 
  when >= 2000 and < 3000 then 'c' 
  when >= 3000 and < 4000 then 'd' 
 else 'e' end as result
(select cast(6371*acos(cos(radians(-23.596146))*cos(radians(id))*cos(radians(-46.686549)-radians(id))+sin(radians(-23.596146))*sin(radians(id))) as int) as id from testTable) as T(id)

So I have here a table named "testTable", with one int column named "id", and 1000 rows in it with random numbers. The query is used to calculate the distance in km between two coordinates, one of them coming from the table, the other one fixed in the query. I have used a subselect here because of constraints that oblige me to use it in the real application.

The crash doesn't occur if I:

  • Remove the case entirely, and just output the calculated column directly
  • Remove the multiplication (6371*) from the subselect

Both being not-acceptable solutions.

asked 16 Aug '12, 15:53

Andr%C3%A9%20Freitas's gravatar image

André Freitas
accept rate: 0%

Hi André,

Could you ulunload your test database (for the query you posted) and attach the .xml file?

(16 Aug '12, 16:30) Tim McClements
Replies hidden

I can't attach files as I don't have enough "reputation points", but I have put it on pasteBin:

(16 Aug '12, 16:35) André Freitas

Hi André,

Your repro is good - thank you!

(17 Aug '12, 17:01) Tim McClements

Thank you André for reporting this bug.

This has been fixed as of

permanent link

answered 21 Aug '12, 12:45

Tim%20McClements's gravatar image

Tim McClements
accept rate: 34%

Thanks Tim!

(21 Aug '12, 14:56) André Freitas
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 16 Aug '12, 15:53

question was seen: 808 times

last updated: 21 Aug '12, 14:56