id::text will cast a bigint column to string in TypeScript.
_text will be text[].
newname:id::text will also work
Additional context
This is by no means a complete list of all possible type casts nor is it sound, but this is much less error prone than having to do an unsafe cast such as
What kind of change does this PR introduce?
This change adds support for type casting in select queries. For example an id column with the type bigint can be casted to text by "id::text".
Equivalent PostgreSQL type for TypeScript type is based on the type generator pgTypeToTsType function.
What is the current behavior?
Fixes https://github.com/supabase/postgrest-js/issues/370
What is the new behavior?
id::text
will cast abigint
column tostring
in TypeScript._text
will betext[]
.newname:id::text
will also workAdditional context
This is by no means a complete list of all possible type casts nor is it sound, but this is much less error prone than having to do an unsafe cast such as