Servoy, Postgresql and the boolean type

Hi there,

I have a Postgresql database that uses the boolean type for lots of columns. I want to use a checkbox to specify ‘true’ or ‘false’, but Servoy doesn’t seem to like this; when I tick the box and move off of it, I get this error:

Cannot save form data
org.postgresql.util.PSQLException: ERROR: column “columnname” is of type boolean but expression is of type integer
ERROR: column “columnname” is of type boolean but expression is of type integer

Besides altering the database to use an int type (so it would support 1/0, which I would guess Servoy is sending), which is not an option, how can I make this work in Servoy?

The current documentation for this type is here, and it seems Postgres DOES support 1/0, but only when quoted… is there a way to alter what Servoy sends to the db when ticking/unticking the box?

Better yet, is there native support for this happening any time soon? This is causing large problems with our solution.

Servoy info:
Version R2 2.1-build 310
Java version 1.4.2_04-b05 (Linux)

We’ve had this issue as well - I commented on it last April and again recently and unfortunately haven’t received much of a response as of yet. See the following threads:
http://forums.servoy.com/viewtopic.php?t=1834
http://forums.servoy.com/viewtopic.php?t=2421

Perhaps if there are enough of us, accounting for the Postgresql boolean type can move farther up the “to do” list of feature requests. As far as I know the boolean type is part of the SQL standard. Is the problem only with Postgresql’s implementation or do other DBMS’ not use the boolean type?

BTW - we don’t have that many booleans, but the way we’ve worked around it up to now is to add integer fields to the tables that Servoy interacts with - and these mirror the boolean fields (which are used in a bunch of backend functions and accessed elsewhere). A backend trigger function keeps the fields in sync. It’s kludgy and a pain, but it works.

Well … that really sucks =) Especially as it’s part of the SQL standard.

Can someone from Servoy BV please let us know what the status of support for this is? This is currently top of my most wanted feature list.

we will look into this.
But the driver is the problem as far as we see. The driver should be able to convert a Integer to a boolean just fine. So we are looking into it to fix the driver for postgresql and send that fix to them.

Add me to the list of victims.

I’m just curious if this issue was ever solved … PostgreSQL-ians, was the driver ever fixed?

kazar

Not sure, I still use integers instead of booleans…

Hi,
I am not sure if this will help but here it is.
Javascript boolean is “true” or “false” so you should parse them to “0” or “1” in order not to get that error.
There are two ways to make javascript boolean be numbers.
Number(boolean) or 0 + boolean. In the last when you add “0” to a javascript boolean it gets converted to integer.
Best Regards,
Miguel Angel

Hi Miguel, good tip. I would also place this (with a nice example :) ) in the ‘How to’ section!!!