Postgresql bool comparison bugs

Seb Ruiz ruiz at kde.org
Tue Nov 6 05:38:54 CET 2007


Hi All,
There is a rather serious bug with the postgres backend which makes
all boolean values to be incorrectly read from the database. Case in
point is saving "auto transfer" or "purge" properties from podcast
channel settings. I have established that the correct boolean entry is
written to the database, but our code is always returning false.

If you look at this code:

pcb.setAutoScan( *++it == boolT() ? true : false );

Where *++it is the iterator pointing to a QString which is the result
returned from the database.

boolT() returns "true" for postgres connections, however the database
will return "t" as an indicator for a true boolean. The converse is
not a problem since psql accepts any sort of 'truthy' value as input
(eg, 1, true, t, y).

I do not know if psql < 8 return "t" or "true" - this is my only
concern. Except, that most distros will ship psql 8.1/8.2.

I am not actually running psql so I cannot test it, it is simply a
theory which I am confident that I am correct with.

Thoughts please.


-- 
Seb Ruiz

http://www.sebruiz.net/


More information about the Amarok-devel mailing list