6
votes

I can't believe that the following statement seems to be still true

So, I switched to integers and 0 or 1 works fine, but it is
stupid, that the database system has boolean variables of a smaller
size, but I should use integers for boolean values!

How do you use boolean datatype with Postgres / PHP?

In other words,

Is the only way to use 1 for true and 0 for false in getting the kind of the boolean datatype?

1

1 Answers

0
votes

Using 1 and 0 is a very sensible and portable way to represent boolean values. Any difference in size between and int and a native boolean type is really going to make little or no difference to your application's performance, or the KB size of your database.