Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 750149FBA1D for ; Thu, 12 Apr 2007 05:03:43 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 16696-04 for ; Thu, 12 Apr 2007 05:03:26 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.174]) by postgresql.org (Postfix) with ESMTP id 4AC7F9FBA1C for ; Thu, 12 Apr 2007 05:03:26 -0300 (ADT) Received: by ug-out-1314.google.com with SMTP id k3so237945ugf for ; Thu, 12 Apr 2007 01:03:24 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=OHXlFZxqDZASij3vQoVplXIYO6dqzX4kuepQJ0zzoGu3v8OV/eu1LAqEEPcNOZffcDQWn+GVHANptDCZavTHZmdrw/k+PSgicYjCvEvblf7VZzS337mhxykto/oWmA86IsC2ZE0sGHxNxm3uYIvloWJnRGmiwgOLBRoedOqk8aE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=XgZMM4RtAEU0hzjv90AYvwH1vuLZlYABz3x2TCwwYK4IYCYUCJFohZQBf9v1lhY+Q3MMw+CMupBGDFXdD9ezO/QO7ppRYOAoZKpq7WlyMgRkD8Ov4ZvEC++MyqWBWR6l6MU9qECDnDQVfjbk9DRd3/WRJuy/8oooqjZJE/LiGCk= Received: by 10.67.27.15 with SMTP id e15mr1052100ugj.1176365004601; Thu, 12 Apr 2007 01:03:24 -0700 (PDT) Received: from ?192.168.1.33? ( [82.20.24.72]) by mx.google.com with ESMTP id z40sm871347ikz.2007.04.12.01.03.21; Thu, 12 Apr 2007 01:03:23 -0700 (PDT) Message-ID: <461DE7C7.3070707@enterprisedb.com> Date: Thu, 12 Apr 2007 09:03:19 +0100 From: Heikki Linnakangas User-Agent: Icedove 1.5.0.8 (X11/20061116) MIME-Version: 1.0 To: ismo.tuononen@solenovo.fi CC: pgsql-jdbc@postgresql.org Subject: Re: 7.4 driver vs 8.2 driver References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/27 X-Sequence-Number: 16876 ismo.tuononen@solenovo.fi wrote: > select trunc($1,2); > and that $1 is binded to double precision > > works with pg74.216.jdbc3.jar driver but with postgresql-8.2-504.jdbc4.jar > we get error: > > ERROR: function round(double precision, integer) does not exist at > character 26 > HINT: No function matches the given name and argument types. You may need > to add explicit type casts. > > to change all queries to: > select > trunc(to_number(to_char($1,'99999999999999.999999),'99999999999999.999999'); > > is just stupid and takes very long time, because it must be done manually > (queries are in reality much more complex) > > any ideas what to do? You can use a cast: select trunc(($1)::numeric). > I just don't understand why postgresql dont have trunc(double > precision,int) when it have trunc(double precision),trunc(numeric) and > trunc(numeric,int) trunc(double precision, int) wouldn't make much sense. The value would be given in base 2 floating point format, while the precision would be given as a number of *decimal* places, IOW base 10. If you find that you need to do that, you should reconsider the data types you use. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com