Skip site navigation (1) Skip section navigation (2)

String Comparision Weirdness

From: Tobias Brox <tobias(at)nordicbet(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: String Comparision Weirdness
Date: 2005-09-26 10:17:33
Message-ID: 20050926101733.GV5679@tobias.lan (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
We had major problems after migrating the DB to a more powerful server; we
managed to locate the problem to a type conversion bug in our software.
Never the less, this thing puzzles us a lot:

NBTEST2=# select '-1'>'0';
(1 row)

We've tried this query on several servers with different versions of
postgresql and different versions of glibc - some returns true, others
returns false - and it seems neither to be related to the postgresql version
nor the glibc version.  At all servers we tested, strcmp("-1","0") returned
negative - at some -3 and at others -1, and not related to postgresql.

The correct result above should be false, since ascii('-')=45 while

Can the character set in use be significant?

Notice of Confidentiality: This email is sent unencrypted over the network,
and may be stored on several email servers; it can be read by third parties
as easy as a postcard.  Do not rely on email for confidential information.


pgsql-bugs by date

Next:From: Tobias BroxDate: 2005-09-26 10:20:33
Subject: Re: String Comparision Weirdness
Previous:From: wallyDate: 2005-09-26 09:08:27
Subject: BUG #1908: sql support chinese char error

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group