PostgreSQL Type Casting (::)
Postgres's own shorthand for CAST — same conversion, more compact syntax.
What & Why
The :: operator is Postgres-specific shorthand for CAST — value::type means exactly the same thing as CAST(value AS type), just shorter to write.
See How It Works
EXAMPLE QUERY
-- these two lines do exactly the same thing
SELECT CAST('55000' AS INTEGER);
SELECT '55000'::INTEGER;RESULT — both return the same value
| expression | result |
|---|---|
| CAST('55000' AS INTEGER) | 55000 |
| '55000'::INTEGER | 55000 |
The result uses the same Queryflo columns shown in the worked example.
Sign up free to try it on a real business scenario