X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 9C5D2D1B8EA for ; Sun, 14 Mar 2004 10:01:24 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 33334-10 for ; Sun, 14 Mar 2004 06:01:12 -0400 (AST) Received: from gpdnet.co.uk (gpdnet.plus.com [212.56.100.243]) by svr1.postgresql.org (Postfix) with ESMTP id 70B2AD1B467 for ; Sun, 14 Mar 2004 06:01:08 -0400 (AST) Received: from Spooler by gpdnet.co.uk (Mercury/32 v4.01a) ID MO000E14; 14 Mar 2004 10:03:31 -0000 Received: from spooler by gpdnet.co.uk (Mercury/32 v4.01a); 14 Mar 2004 10:03:15 -0000 Received: from gary (192.168.1.2) by gpdnet.co.uk (Mercury/32 v4.01a) with ESMTP ID MG000E13; 14 Mar 2004 10:03:08 -0000 From: "Gary Doades" To: pgsql-odbc@postgresql.org Date: Sun, 14 Mar 2004 10:03:08 -0000 MIME-Version: 1.0 Subject: Re: ODBC int2 parameters to pg function Message-ID: <40542DDC.31043.304B562@localhost> In-reply-to: <8315.1079224814@sss.pgh.pa.us> References: <08eu40du2j0hjmc1k36a3k5m73moqm34n9@4ax.com> X-mailer: Pegasus Mail for Windows (v4.12a) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/51 X-Sequence-Number: 3853 Tom, Thanks for the reply. I agree with your solution in principle, but I have nearly 100 databases so far across several servers and many at customer sites. I am trying to migrate some from and maintain compatibility with MS SQLServer. These quantities have been smallint for quite some time. Changing the underlying database types now would be a problem. I can cast inside the function, this is my current solution. Given that there is no implicit downcast wouldn't the best solution be to get the ODBC driver do the cast on the function call? Thanks, Gary. On 13 Mar 2004 at 19:40, Tom Lane wrote: > Gary Doades writes: > > I have delcared a pg function as: > > function GENERATE_TIMESHEETS(timestamp,timestamp,smallint,smallint) > > .... > > You're probably best off to declare the inputs as integer not smallint. > Integer literals are assumed to be int4 by default, and since there's > no implicit downcast to int2 (anymore), writing a function this way will > require you to cast to smallint explicitly a lot. It's seldom worth > that notational hassle. You can cast inside the function if you really > need the values to be int2 inside it. > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings