Casting
Type casting
Postgres offers two different syntaxes for Type casts:
CAST (expression AS type)
or
expression::type
For example:
CAST ('{1,2,3}' as int[]) -- casts a string to an int[]
'{1,2,3}'::int[] -- casts a string to an int[]
May 12, 20231 min read
Casting
Postgres offers two different syntaxes for Type casts:
CAST (expression AS type)
or
expression::type
For example:
CAST ('{1,2,3}' as int[]) -- casts a string to an int[]
'{1,2,3}'::int[] -- casts a string to an int[]