On Monday, February 06, 2012 6:42:45 pm zoulx1982 wrote: > you mean there is no cast function for int to varchar ? > i see sure it is. > That is why I said my guess:) If you want to see what is actually going on take a look at: http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/utils/adt/varbit.c;h=adb08369ed28ab6b52aa2cd5213bcd5b4d8de7ad;hb=HEAD
The ERROR though is coming further up, in the parser , if I am following correctly. This because as you have found out there is no direct cast from integer to varbit. Why that is for someone else to answer, as I don't know. Though a little playing around got this, not pretty but it seems to work: test(5432)aklaver=>SELECT 10::bit(3)::varbit(3); varbit -------- 010 (1 row) test(5432)aklaver=>SELECT 10::bit(3)::varbit(4); varbit -------- 010 (1 row) test(5432)aklaver=>SELECT 10::bit(4)::varbit(4); varbit -------- 1010 (1 row) test(5432)aklaver=>SELECT 10::bit(4)::varbit(3); varbit -------- 101 -- Adrian Klaver adrian.kla...@gmail.com -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql