A boolean constant is much simpler than any other constant values recognized by PostgreSQL, as it may only consist of one of two possible values: true , or false . When PostgreSQL encounters either of these terms outside of single quotes, it is implicitly interpretted as a boolean constant, rather than a string constant. Example 3-9 shows this important distinction.

Example 3-9. The Difference Between true and 'true'

testdb=# SELECT true AS boolean_t,
testdb-#        'true' AS string_t,
testdb-#        false AS boolean_f,
testdb-#        'false' AS string_f;
 bool_t | string_t | bool_f | string_f
 t      | true     | f      | false
(1 row)

When the terms true or false are parsed by PostgreSQL outside of single quotes, they are implied boolean values. As shown in Example 3-9 , PostgreSQL displays values which are literally of the type boolean as t or f , though be careful not to try to use only t or f as boolean constant values, as this will not be interpretted correctly by PostgreSQL, and will cause an error.

Special Character Symbols

Special character symbols are characters with a pre-defined syntactic meaning in PostgreSQL. They are typically disallowed from being used in identifier names for this reason, though as mentioned in the section on quoted identifiers , this restriction can usually be worked around with quotes if need be.