Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TItao-0002zZ-ND for pgsql-jdbc@postgresql.org; Tue, 02 Oct 2012 03:56:22 +0000 Received: from mail-da0-f46.google.com ([209.85.210.46]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TItam-0002Xz-52 for pgsql-jdbc@postgresql.org; Tue, 02 Oct 2012 03:56:21 +0000 Received: by dakn41 with SMTP id n41so624329dak.19 for ; Mon, 01 Oct 2012 20:56:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=ENpxeg3EnMgGRXdqWUrArXbNipkURA5fXx7S4KEEx7Y=; b=U7UfMKAsPDf40v7ySusJWOg384LP+JIUEqbThjCc+zbHf6iT6Bjn0OVT3OttoUYWIG tOex4jfYjUt/t2Dqc3BjpjqIA6Qv8GAWOGemAk4iMaywLTl9PzRCi56U3XMSaqWdkE3u BJ8dg16vaYqdi74w/HsNLeSmLpDsg+yV2ARSxJjyHfvuMjboCZMK/VbdIQbbNKSOG1tV XIWgYy69fp9aISdu0ZhCEZbb3Q+fciAOjuE2C7oKPoMljvHb/VnB0X8/p3XAozjiBgZ6 6niFZSxFs+KMh8ITohD8gKOxJreVkgmDxG/fKznqwocLntj2BoViUFZXW4VwniYfMxKp 2h7w== Received: by 10.68.237.38 with SMTP id uz6mr1152091pbc.23.1349150176317; Mon, 01 Oct 2012 20:56:16 -0700 (PDT) Received: from ayaki.localdomain (office1.postnewspapers.com.au. [150.101.171.128]) by mx.google.com with ESMTPS id qq1sm12515pbc.74.2012.10.01.20.56.13 (version=SSLv3 cipher=OTHER); Mon, 01 Oct 2012 20:56:15 -0700 (PDT) Message-ID: <506A65DA.5000500@ringerc.id.au> Date: Tue, 02 Oct 2012 11:56:10 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0 MIME-Version: 1.0 To: the6campbells CC: pgsql-jdbc@postgresql.org Subject: Re: data set combination of integer and decimal/numeric returns wrong result type References: <50662D84.90202@ringerc.id.au> <5069867E.80208@ringerc.id.au> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQnJyKn/LB6B5Rn4rFsn85zVoiLLg9E2wl3n3XjiSJ76+2NNdStT/qXUzwOwkA/N3WA12QC0 X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201210/5 X-Sequence-Number: 23329 On 10/02/2012 01:47 AM, the6campbells wrote: > The test case can be shown with one table that contains a column for > each supported Postgres type that maps to ISO-SQL or one table per type. > This example compares an integer and a precise numeric type. OK, so your issue is that PgJDBC reports zero scale and precision for numerics as results when the numeric didn't come directly from a column with defined scale and precision. Right? If so, this has nothing to do with integer combinations, it's *any* operation on numeric. It isn't a JDBC driver issue as such, it's the behaviour of the underlying PostgreSQL backend. Witness: regress=# CREATE TABLE plain AS SELECT NUMERIC(6,4) '12.345678' ; SELECT 1 regress=# CREATE TABLE modified AS SELECT ABS(NUMERIC(6,4) '12.345678') ; SELECT 1 regress=# \d plain Table "public.plain" Column | Type | Modifiers ---------+--------------+----------- numeric | numeric(6,4) | regress=# \d modified Table "public.modified" Column | Type | Modifiers --------+---------+----------- abs | numeric | As such there isn't tons the JDBC driver can do about it. The scale and precision aren't preserved in results, so the JDBC driver has no way to obtain them. Would it be better if PgJDBC reported these numerics as having the maximum supported size? -- Craig Ringer