Received: from sss2.sss.pgh.pa.us (sss.pgh.pa.us [209.114.166.2]) by hub.org (8.10.1/8.10.1) with ESMTP id e5KJn9M19575 for ; Tue, 20 Jun 2000 15:49:09 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss2.sss.pgh.pa.us (8.9.3/8.9.3) with ESMTP id PAA01731; Tue, 20 Jun 2000 15:48:46 -0400 (EDT) To: Ice Planet cc: pgsql-sql@postgresql.org Subject: Re: Type conversion In-reply-to: References: Comments: In-reply-to Ice Planet message dated "Tue, 20 Jun 2000 21:24:48 +0200" Date: Tue, 20 Jun 2000 15:48:45 -0400 Message-ID: <1728.961530525@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200006/185 Ice Planet writes: > B: insert into t2 values (select int2(int4(b)) from t1 where a = 1) Works for me when spelled correctly: regression=# insert into t2 (select int2(int4(b)) from t1 where a = 1); INSERT 314647 1 If you make a suitable conversion function then you can omit the explicit conversion: regression=# create function int2(int8) returns int2 as regression-# 'begin return int2(int4($1)); end;' language 'plpgsql'; CREATE regression=# insert into t2 (select b from t1 where a = 1); INSERT 314649 1 regards, tom lane