type-casting

Table of Contents

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[]