4 ms·
TIL: https://www.postgresql.org/docs/17/datatype-character.html https://www.postgresql.org/docs/17/datatype-character.html (it's in the table at the bottom). I'
by Volundr 2y ago
TIL: https://www.postgresql.org/docs/17/datatype-character.html https://www.postgresql.org/docs/17/datatype-character.html (it's in the table at the bottom). I'd still be suspicious of using it, and the docs recommend against it, but it exists.
- FreakLegion 2y agoA good reason not to use it is that 49::"char"::int == 49, but 49::"char"::smallint == 1. In other words, int casts directly interpret the value as an integer, but smallint (and bigint) casts interpret it as an ASCII character, '1', which they then convert to the integer 1.