Hi, The test case and exec env used are: -- PostgreSQL 8.4.4 on x86_64-unknown-linux-gnu, compiled by GCC gcc (SUSE Linux) 4.4.1 [gcc-4_4-branch revision 150839], 64-bit -- --Jdbc: PostgreSQL 8.4 JDBC4 (build 701)
-- From a Bash shell postgres=# select '2' > '10' a ,'12' > '-13' b ,'1 ' > '-' c , ')12' > '(13' d, ')12'> '(12' e; a | b | c | d | e ---+---+---+---+--- t | f | t | f | t (1 fila) -- With PgAdmin3 1.10.5 (64bits) Linux -- getDriverVersion PostgreSQL 8.4 JDBC4 (build 701) select '2' > '10' a ,'12' > '-13' b ,'1 ' > '-' c , ')12' > '(13' d, ')12'> '(12' e; -- Result -- a;b;c;d;e -- t;f;t;f;t -- On Cliente SQL SQuirreL Version 3.1.2 -- Jdbc PostgreSQL 8.4 JDBC4 (build 701) select '2' > '10' a ,'12' > '-13' b ,'1 ' > '-' c , ')12' > '(13' d, ')12'> '(12' e; -- Result a b c d e true false true false true ------ And for your test case the results are consistents: drop table test; create table test(id int); insert into test values(1); select * from test where '2' > '10'; -- 1 select * from test where '12' > '-13'; -- 0 select * from test where '1 ' > '-'; -- 1 select * from test where ')12' > '(13'; -- 0 drop table test; Regards, Dario El 09/10/10 09:49, Thomas Mueller escribió: > I don't know how you got the strange results for PostgreSQL. I can't > reproduce it. For all queries below, I get one row, meaning the > comparison yields "true" for PostgreSQL 8.4.4, H2, HSQLDB, Derby, and > MySQL. I used the H2 Console tool: > > drop table test; > create table test(id int); > insert into test values(1); > select * from test where '2' > '10'; > -- 1 > select * from test where '12' > '-13'; > -- 1 > select * from test where '1 ' > '-'; > -- 1 > select * from test where ')12' > '(13'; > -- 1 > > > On Sat, Oct 9, 2010 at 1:00 PM, Rami Ojares <[email protected]> wrote: >> I give up. >> I can not fathom a reasonable explanation for these results. >> Why would sql spec require character comparison from right to left? >> >> - Rami >> >> On 8.10.2010 7:18, kensystem wrote: >>> Here is another interesting one: >>> >>> PG> select ')12'> '(13'; -> false >>> >>> Same length, but it SUGGEST that 0x29> 0x28 - I though those were too >>> low in the charpage to have different collations(?) >>> >>> Then consider: >>> PG> select ')12'> '(12'; -> true >>> >>> All this makes me wonder, does the sql spec require var/char >>> comparisons from right to left and PG is doing it the 'spec' way? > -- 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.
