Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id E11051F32A3D for ; Mon, 6 Feb 2012 07:45:17 -0400 (AST) Received: from plane.gmane.org ([80.91.229.3]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RuN0Y-000457-90 for pgsql-sql@postgresql.org; Mon, 06 Feb 2012 11:45:18 +0000 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1RuN0K-00070l-BB for pgsql-sql@postgresql.org; Mon, 06 Feb 2012 12:45:04 +0100 Received: from ip-118-90-113-174.xdsl.xnet.co.nz ([118.90.113.174]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 06 Feb 2012 12:45:04 +0100 Received: from jasen by ip-118-90-113-174.xdsl.xnet.co.nz with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 06 Feb 2012 12:45:04 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-sql@postgresql.org From: Jasen Betts Subject: Re: type cast about int to bit Date: 6 Feb 2012 11:05:15 GMT Organization: Dis (not Dat) Organisation Lines: 24 Message-ID: References: <18656bf8.13415.13551499b55.Coremail.zoulx1982@163.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: ip-118-90-113-174.xdsl.xnet.co.nz X-Face: ?)Aw4rXwN5u0~$nqKj`xPz>xHCwgi^q+^?Ri*+R(&uv2=E1Q0Zk(>h!~o2ID@6{uf8s; a +M[5[U[QT7xFN%^gR"=tuJw%TXXR'Fp~W; (T"1(739R%m0Yyyv*gkGoPA.$b,D.w:z+<'"=-lVT?6 {T?=R^:W5g|E2#EhjKCa+nt":4b}dU7GYB*HBxn&Td$@f%.kl^:7X8rQWd[NTc"P"u6nkisze/Q; 8 "9Z{peQF,w)7UjV$c|RO/mQW/NMgWfr5*$-Z%u46"/00mx-,\R'fLPe.)^ User-Agent: slrn/pre1.0.0-18 (Linux) X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201202/18 X-Sequence-Number: 36311 does the mailing list mangle these, or is it just GMANE? On 2012-02-06, zoulx1982 wrote: >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. possibly postgres doesn't know what size to make the result. -- ⚂⚃ 100% natural