type cast about int to bit - Mailing list pgsql-sql

From zoulx1982
Subject type cast about int to bit
Date
Msg-id 18656bf8.13415.13551499b55.Coremail.zoulx1982@163.com
Whole thread Raw
Responses Re: type cast about int to bit  (Adrian Klaver <adrian.klaver@gmail.com>)
List pgsql-sql
hi,
there is a problem about type cast that i don't understand, follow is my test.
 
postgres=# select 10::bit(3);
 bit
-----
 010
(1 row)
postgres=# select 10::bit varying(3);
ERROR:  cannot cast type integer to bit varying
LINE 1: select 10::bit varying(3);
                 ^
postgres=#
 
my question is why int can cast to bit , i want to know the reason.
thank you for your timing.



pgsql-sql by date:

Previous
From: Achilleas Mantzios
Date:
Subject: Re: array dimensions, pg_catalog.pg_attribute and the \d command
Next
From: Jasen Betts
Date:
Subject: Re: type cast about int to bit