agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: TJ O'Donnell <tjo@acm.org>
To: Christoph Haller <ch@rodos.fzk.de>
Cc: pgsql-sql@postgresql.org
Cc: adrian.din@easynet.ro
Cc: dev@archonet.com
Subject: Re: SQL error: function round(double precision, integer) does
Date: Mon, 28 Feb 2005 06:40:24 -0800
Message-ID: <42232D58.90307@acm.org> (raw)
In-Reply-To: <42231EB6.9F6D20F3@rodos.fzk.de>
References: <4222570F.5080901@acm.org>
	<42231EB6.9F6D20F3@rodos.fzk.de>

Thanks everyone.  Your tips about casting my arg to round()
as ::numeric worked just fine.  I guess I was surprised
that plpgsql didn't that on it's own!  I'm used to too
many forgiving c compilers, and such.

TJ

Christoph Haller wrote:
> TJ O'Donnell wrote:
> 
>>I received the following error when executing a SQL statement:
>>
>>SQL error:
>>ERROR:  function round(double precision, integer) does not exist
>>
>>In statement:
>>
>>select id,smiles,smarts,parameter,oe_count_matches(smiles,smarts) as count,
>>  round((parameter*oe_count_matches(smiles,smarts)),2) as psa,tpsa(smiles) as ctpsa,tpsa
>>  from structure,tpsa
>>  where id < 237610
>>  and oe_count_matches(smiles,smarts) > 0
>>
>>order by id;
>>
>>The functions described at:
>>http://www.postgresql.org/docs/7.4/static/functions-math.html
>>show that round(numeric,int) should work ok.
>>If I use round() without a second argument, it works OK, but
>>this gives a loss of precision which I do not want.
>>
>>Can anyone help me with this?
>>
>>Thanks,
>>TJ
>>
> 
> 
> And round(numeric,int) does work ok. 
> The error message is telling you 
> there is double precision argument where a numeric 
> is expected. 
> And with 7.4.5 it says in addition 
> HINT:  No function matches the given name and argument types. 
> You may need to add explicit type casts.
> 
> Try 
> round((parameter*oe_count_matches(smiles,smarts))::numeric,2) 
> 
> Works for me with double precision arguments. 
> 
> Regards, Christoph



view thread (16+ messages)  latest in thread

Message-ID: <42232D58.90307@acm.org>
Permalink:  ../42232D58.90307@acm.org/
Also on:    postgresql.org/message-id/42232D58.90307@acm.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tjo@acm.org, ch@rodos.fzk.de, adrian.din@easynet.ro, dev@archonet.com
  Subject: Re: SQL error: function round(double precision, integer) does
  In-Reply-To: <42232D58.90307@acm.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox