Postgresql – read about the behavior of the postgress casting operators

castpostgresql

I want to do something like this:

alter table foos
alter column bar type bool using bar::boolean;

bar is currently a text column. Some experimentation shows that postgres will do things like convert a string "t" to boolean true. In my case this is great, but I'd like to read the full behavior before using this. I can't seem to find where this documentation is.

Best Answer

The behavior for boolean

typically you have to go look up every type and to see how it can be cast or look for a function to do the casting

here is a link

Postgresql also supports Create Cast

Information on the pg_cast