Re: Correct getScale() behavior? - Mailing list pgsql-jdbc

From Tom Lane
Subject Re: Correct getScale() behavior?
Date
Msg-id 8545.1210378146@sss.pgh.pa.us
Whole thread Raw
In response to Re: Correct getScale() behavior?  (Kris Jurka <books@ejurka.com>)
List pgsql-jdbc
Kris Jurka <books@ejurka.com> writes:
> On Fri, 9 May 2008, dombrd@gmail.com wrote:
>> I would think it should be returning a scale and precision if the
>> argument column has scale and precision specified, such as in the
>> NUMERIC(7,2) example I previously showed.  It seems wrong to return 0
>> in this case.
>>
>> I am guessing the postgresql server code would need to be changed for
>> that to work though.  Maybe I should be suggesting this change on a
>> different list?

> Right, that change would be nice, but it would require a server change.
> The best place to ask about that would be -hackers.  Also how do you
> determine the precision of sum(numeric(7,2))?

The chances of anything being done about that are not measurably
different from zero.  Postgres is by and large an abstract-data-type
system that tries hard not to have too much knowledge about specific
data types, let alone specific functions for specific data types,
wired into the core server.  So even assuming that you could determine
the correct typmod to return (which, as Kris implies, you really cannot
for this example or most others), any sort of quick-hack patch to
inject the knowledge would probably be rejected.  We'd want to see it
formulated as a plugin API available to all datatypes and functions
... and the effort to do that, in comparison to the number of actual
use cases, doesn't look very promising.

            regards, tom lane

pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: Correct getScale() behavior?
Next
From: "Marco Solinas"
Date:
Subject: JDBC types vs postgres types correspondation