On Thu, 24 Jan 2019 at 11:04, Alexandre GRAIL <postgresql.general@xxxxxxxxxx> wrote: > > And added to this weirdness is the fact that '1' or '0' (with quote) is OK. > The reason for that at least is that '1' and '0' are valid boolean values. https://www.postgresql.org/docs/9.5/datatype-boolean.html There's additional text describing why casts are chosen to be defined as implicit or not here https://www.postgresql.org/docs/9.5/typeconv-overview.html My own opinion is that non-0 should implicitly cast as true and 0 should cast as false. I just run UPDATE pg_cast SET castcontext = 'i' WHERE oid IN ( SELECT c.oid FROM pg_cast c inner join pg_type src ON src.oid = c.castsource inner join pg_type tgt ON tgt.oid = c.casttarget WHERE (src.typname ILIKE '%int%' AND tgt.typname ILIKE 'bool%') OR (src.typname ILIKE 'bool%' AND tgt.typname ILIKE '%int%') OR (src.typname ILIKE 'bool%' AND tgt.typname ILIKE 'bit%') OR (src.typname ILIKE 'bit%' AND tgt.typname ILIKE 'bool%') OR (src.typname ILIKE 'bit%' AND tgt.typname ILIKE '%int') ); when I install the system to solve this for my own uses. Geoff