Yes , seems something like that (or just a bug).
I dig in google and pgsql documentation but can't found any mention to this 
behavior or special note on char type comparisons.

I agree that if this is a decision , is big bad decision that make char 
comparison almost unpredictable.

Dario

El 07/10/10 12:46, Rami Ojares escribió:
>  If you look at the ASCII character map you'll see that character '-' has 
> code 45
> and character '1' has code 49 so clearly '-' < '1' <=> 45 < 49
>
> What PostgreSQL seems to be doing here is converting string literals to 
> integers
> and applying the comparison operator to them.
>
> I think this type of auto-conversion and auto-casting is best left for 
> scripting languages like javascript.
> Bigger boys want to do these kind of decisions themselves.
>
> - Rami
>
> On 7.10.2010 16:56, Dario Fassi wrote:
>>   Hi,
>> You are right , in pgsql
>>
>> *select '12'>  '-13'   ->  false
>> select '1  '>  '-'       ->  true
>> *
>> and in H2 and in DB2
>>
>> *select '12'>  '-13'   ->  true
>> select '1  '>  '-'       ->  true
>> *
>> H2 almost it's consistent in it's results.
>>
>> Where do you notice of this ?
>>
>> I really strange that result from pgsq.
>> regards
>> Dario.
>>
>>
>> El 07/10/10 00:09, Ken Johanson escribió:
>>> Hi,
>>>
>>> This is no big deal in fact it may be more trivia than anything (although 
>>> one might expect char-comparators to be consistent). I noticed that the 
>>> following query returns a different result on h2 than it does on postgres.. 
>>> which is correct, I am not
>>> sure :-)
>>>
>>> SELECT '12'>  '-13'
>>>
>>> ken
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to