SIZE specified in the VARCHAR/NUMERIC type of the typecast operator (::) should be honored
Below are few queries that illustrate the issue. The queries are similar except that the SIZE
(in characters, not bytes) of the VARCHAR
type (specified in parentheses), the target of the ::
type cast operator, differs. And the output of the queries are identical.
OCTO> select 'abcd';
abcd
OCTO> select 'abcd'::varchar(2);
abcd
OCTO> select 'abcd'::varchar(3);
abcd
OCTO> select 'abcd'::varchar(4);
abcd
OCTO> select 'abcd'::varchar(5);
abcd
Whereas, below is the output of Postgres. Clearly, the SIZE
of the VARCHAR
type specified in the type cast operator is not honored in Octo while Postgres output changes based on the SIZE
specified.
names=> select 'abcd'::varchar(2);
varchar
ab
(1 row)
names=> select 'abcd'::varchar(3);
varchar
abc
(1 row)
names=> select 'abcd'::varchar(4);
varchar
abcd
(1 row)
names=> select 'abcd'::varchar(5);
varchar
abcd
(1 row)
Edited by Narayanan Iyer