X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 25E8C56564 for ; Mon, 7 Mar 2005 16:16:01 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 14601-04 for ; Mon, 7 Mar 2005 16:15:59 +0000 (GMT) Received: from tbmail.tradebot.com (mail.tradebotsystems.com [209.83.219.42]) by svr1.postgresql.org (Postfix) with ESMTP id 70FE45654A for ; Mon, 7 Mar 2005 16:15:58 +0000 (GMT) Received: from 192.168.200.29 ([192.168.200.29]) by tbmail.tradebot.com ([192.168.1.50]) with Microsoft Exchange Server HTTP-DAV ; Mon, 7 Mar 2005 16:15:57 +0000 Received: from krb06 by tbmail; 07 Mar 2005 10:15:57 -0600 Subject: Insert SHRT_MIN fails for int2 column From: Kelly Burkhart To: pgsql-odbc@postgresql.org Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: Tradebot Systems, Inc. Message-Id: <1110212157.3206.10.camel@krb06> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Mon, 07 Mar 2005 10:15:57 -0600 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200503/35 X-Sequence-Number: 5053 When inserting SHRT_MIN into an int2 column, the odbc driver comes up with the following SQL: insert into dbc_test ( i16 ) values ( -32768::int2 ); This fails with an out of range error, and should be either: insert into dbc_test ( i16 ) values ( (-32768)::int2 ); Or have the ::int2 cast removed altogether. The ::int2 cast is added in convert.c on line 3024 (for 08.00.0005) preceded by a comment stating it is necessary: /* needs cast because there is no automatic downcast from int4 constants */ CVT_APPEND_STR(qb, "::int2"); Is this really necessary? On my 7.4.2 database, the following works just fine: create table tst ( i16 int2 ); insert into tst ( i16 ) values ( -32768 ); insert into tst ( i16 ) values ( 32767 ); -Kelly