Probably a good point since Postgres shows expected result:
postgres=# select '1234'::varchar(10);
 varchar
---------
 1234
(1 row)

postgres=# select '1234'::varchar(1);
 varchar
---------
 1
(1 row)

postgres=# select '1234'::varchar;
 varchar
---------
 1234
(1 row)

Thanks,
Hao





On Tue, Dec 9, 2014 at 3:43 PM, Xiao Meng <[email protected]> wrote:

> Hi,
>
> I noticed that the behavior of VARCHAR in cast expression changes in recent
> drillbit server. In the cast expression, VARCHAR without length specifier
> will be treated as  varchar(1) now.
>
> For example,  the following query:
>
> select (1234 as VARCHAR) from sys.drillbits
>
> returns '1' instead of '1234'.
>
> Is this change intended?
>
> As a reference, SQL server treated it differently:
>
> http://msdn.microsoft.com/en-CA/library/ms176089.aspx
>
> "(For char/varchar), when n is not specified in a data definition or
> variable declaration statement, the default length is 1. When n is not
> specified when using the CAST and CONVERT functions, the default length is
> 30"
> Best,
>
> Xiao
>

Reply via email to