UNION
.UNION
[ALL
]), Regatta converts the data types of both queries to the “larger” data type of them.
E.g: During UNION
on two queries, if the first returns DATE
and the other returns TIMESTAMP
, Regatta converts the DATE
into TIMESTAMP
.
FLOAT4/8
or DECIMAL
to integers, the value is rounded to the closest integer.
INSERT
and UPDATE
operations, Regatta converts the value to the datatype of the affected column. If the value is too large for the target data type, the operation fails.
TIMESTAMP
to DATE
or TIME
extracts the relevant part of the TIMESTAMP
into the target element.
E.g: SELECT '2023-12-12 23:00:05'::time
returns 23:00:05
.
BOOLEAN
, 0
is converted to FALSE
and any other value is converted to TRUE
.
SELECT 1234567::SMALLINT
will fail since the value is out of the SMALLINT
range.
CAST(150 as CHAR(2))
returns 15
but assigning 150
to a CHAR(2)
column without explicit casting would fail.
CHAR
types are implicitly converted to VARCHAR
(and the trailing spaces are trimmed) when they are used as inputs to any function/operation.
For example: Comparison of VARCHAR(10)
containing the value ‘Regatta’
and CHAR(10)
containing the value ‘Regatta ’
results in TRUE
.
Note: If the VARCHAR
contains trailing spaces as part of its string, the comparison will return FALSE
. For example: CHAR(10)
with the text 'Regatta'
is not equal to VARCHAR(10)
with the text 'Regatta '
.