From peter@greatnowhere.com Sun Jul 20 10:41:20 2008 Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id BA72664FD02 for ; Sun, 20 Jul 2008 07:41:20 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 70572-02 for ; Sun, 20 Jul 2008 07:41:10 -0300 (ADT) X-Greylist: delayed 00:06:05.543972 by SQLgrey-1.7.6 Received: from mail2.fintrading.com (mail.fintrading.com [195.2.100.100]) by postgresql.org (Postfix) with ESMTP id 139DE64FCBD for ; Sun, 20 Jul 2008 07:41:10 -0300 (ADT) Received: from chipmunk (unknown [81.198.70.254]) by mail2.fintrading.com (Postfix) with ESMTP id DD09B3811D60 for ; Sun, 20 Jul 2008 13:34:39 +0300 (EEST) From: "Peter" To: Subject: numeric type Date: Sun, 20 Jul 2008 13:32:51 +0300 Message-ID: <005b01c8ea53$f64a9fd0$e2dfdf70$@com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_005C_01C8EA6D.1B97D7D0" X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcjqU/YMaSIxhmXKSYSDki7I+AJi8g== Content-Language: en-us X-greatnowhere.com-MailScanner: Found to be clean X-greatnowhere.com-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-4.899, required 6, BAYES_00 -5.00, HTML_MESSAGE 0.00, RDNS_NONE 0.10) X-greatnowhere.com-MailScanner-From: peter@greatnowhere.com X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200807/46 X-Sequence-Number: 18831 This is a multipart message in MIME format. ------=_NextPart_000_005C_01C8EA6D.1B97D7D0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit For numeric types (with no explicit scale and precision) JDBC returns 0 for both precision and scale (ResultSetMetaData.getPrecision and getScale methods). This is breaking my app and IMO does not reflect true state of things since Postgres docs state: "NUMERIC without any precision or scale creates a column in which numeric values of any precision and scale can be stored, up to the implementation limit on precision". Shouldn't PG JDBC driver return maximum possible values for precision and scale in such cases? Peter ------=_NextPart_000_005C_01C8EA6D.1B97D7D0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

For numeric types (with no explicit = scale and precision) JDBC returns 0 for both precision and scale = (ResultSetMetaData.getPrecision and getScale methods). This is breaking my app and IMO does not reflect = true state of things since Postgres docs state: „NUMERIC without = any precision or scale creates a column in which numeric values of any = precision and scale can be stored, up to the implementation limit on = precision”.

 

Shouldn’t PG JDBC driver return maximum = possible values for precision and scale in such cases?

 

Peter

 

------=_NextPart_000_005C_01C8EA6D.1B97D7D0-- From books@ejurka.com Tue Jul 29 04:20:01 2008 Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 20C7F64FCED for ; Tue, 29 Jul 2008 01:20:01 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 64612-04-5 for ; Tue, 29 Jul 2008 01:19:40 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail63.csoft.net (leary.csoft.net [205.205.214.5]) by postgresql.org (Postfix) with SMTP id 963AD650119 for ; Tue, 29 Jul 2008 01:17:27 -0300 (ADT) Received: (qmail 13094 invoked by uid 1112); 29 Jul 2008 04:17:26 -0000 Date: Tue, 29 Jul 2008 00:17:26 -0400 (EDT) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Peter cc: pgsql-jdbc@postgresql.org Subject: Re: numeric type In-Reply-To: <005b01c8ea53$f64a9fd0$e2dfdf70$@com> Message-ID: References: <005b01c8ea53$f64a9fd0$e2dfdf70$@com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200807/57 X-Sequence-Number: 18842 On Sun, 20 Jul 2008, Peter wrote: > For numeric types (with no explicit scale and precision) JDBC returns 0 for > both precision and scale (ResultSetMetaData.getPrecision and getScale > methods). This is breaking my app and IMO does not reflect true state of > things since Postgres docs state: "NUMERIC without any precision or scale > creates a column in which numeric values of any precision and scale can be > stored, up to the implementation limit on precision". > > Shouldn't PG JDBC driver return maximum possible values for precision and > scale in such cases? > There are a couple of issues here: 1) While PG supports larger numeric values, the maximum precision you can constrain it to is 1000. jurka=# create temp table tt (a numeric (1001, 1)); ERROR: NUMERIC precision 1001 must be between 1 and 1000 So do you return 1000 as the maximum precision because that's the maximum that they can pass into create table even if they might actually receive a value back that has a higher precision? Or do you return something larger (the internal pg limit which I don't know offhand) even though they can't create a table column with that limit? 2) Once you've set the maximum precision, how do you set the maximum scale as the scale is a dependent on the precision. Is it (1000,500) ? (1000, 0)? (1000, 1000)? What we do now certainly isn't all that great, but I haven't heard a concrete suggestion on what's better. Kris Jurka From peter@greatnowhere.com Tue Jul 29 07:38:06 2008 Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id D563C64FCEA for ; Tue, 29 Jul 2008 04:38:06 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 45100-02 for ; Tue, 29 Jul 2008 04:37:56 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail2.fintrading.com (mail.fintrading.com [195.2.100.100]) by postgresql.org (Postfix) with ESMTP id 0B97C64FD02 for ; Tue, 29 Jul 2008 04:37:59 -0300 (ADT) Received: from chipmunk (unknown [81.198.70.254]) by mail2.fintrading.com (Postfix) with ESMTP id D115A3807B53; Tue, 29 Jul 2008 10:37:26 +0300 (EEST) From: "Peter" To: "'Kris Jurka'" Cc: References: <005b01c8ea53$f64a9fd0$e2dfdf70$@com> In-Reply-To: Subject: Re: numeric type Date: Tue, 29 Jul 2008 10:36:24 +0300 Message-ID: <001d01c8f14d$cdd715a0$698540e0$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcjxMgLvQ6CU2YSjQ7W5MjCFo4x7EAAGwh3w Content-Language: en-us X-greatnowhere.com-MailScanner: Found to be clean X-greatnowhere.com-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-4.9, required 6, BAYES_00 -5.00, RDNS_NONE 0.10) X-greatnowhere.com-MailScanner-From: peter@greatnowhere.com X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200807/61 X-Sequence-Number: 18846 >> For numeric types (with no explicit scale and precision) JDBC returns 0 for >> both precision and scale (ResultSetMetaData.getPrecision and getScale >> methods). This is breaking my app and IMO does not reflect true state of >> things since Postgres docs state: "NUMERIC without any precision or scale >> creates a column in which numeric values of any precision and scale can be >> stored, up to the implementation limit on precision". >> >> Shouldn't PG JDBC driver return maximum possible values for precision and >> scale in such cases? >> > > There are a couple of issues here: > > 1) While PG supports larger numeric values, the maximum precision you can > constrain it to is 1000. > > jurka=# create temp table tt (a numeric (1001, 1)); > ERROR: NUMERIC precision 1001 must be between 1 and 1000 > > So do you return 1000 as the maximum precision because that's the maximum > that they can pass into create table even if they might actually receive a > value back that has a higher precision? Or do you return something larger > (the internal pg limit which I don't know offhand) even though they can't > create a table column with that limit? > What we do now certainly isn't all that great, but I haven't heard a > concrete suggestion on what's better. OK, I hear ya. How about allowing user to set the default precision and scale values for "numeric" type? Not sure how this would be done in JDBC world but should be doable. IMO a reasonable default maxing out both precision and scale (1000,500) should work for most applications. Numeric type is not all that common anyway. Peter From books@ejurka.com Tue Jul 29 17:10:03 2008 Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id ABD9964FD2F for ; Tue, 29 Jul 2008 14:10:03 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 66145-05 for ; Tue, 29 Jul 2008 14:09:57 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail63.csoft.net (leary.csoft.net [205.205.214.5]) by postgresql.org (Postfix) with SMTP id 847B464FD0A for ; Tue, 29 Jul 2008 14:09:58 -0300 (ADT) Received: (qmail 3832 invoked by uid 1112); 29 Jul 2008 17:09:56 -0000 Date: Tue, 29 Jul 2008 13:09:56 -0400 (EDT) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Peter cc: pgsql-jdbc@postgresql.org Subject: Re: numeric type In-Reply-To: <001d01c8f14d$cdd715a0$698540e0$@com> Message-ID: References: <005b01c8ea53$f64a9fd0$e2dfdf70$@com> <001d01c8f14d$cdd715a0$698540e0$@com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200807/63 X-Sequence-Number: 18848 On Tue, 29 Jul 2008, Peter wrote: > OK, I hear ya. How about allowing user to set the default precision and > scale values for "numeric" type? Not sure how this would be done in JDBC > world but should be doable. You could add URL parameters like unspecifiedNumericPrecision=1000 and unspecificedNumericScale=500, but the tradeoff is how much work is it to add these options to the URL parsing code and then pass them around, add it to the datasource implementation, add it to the documentation, and ... If there was some big important app that everyone wanted to use that blew up on this I'd bet we'd do it, but I haven't heard a whole lot of complaints about this problem. Is this an important issue for other people? Kris Jurka From peter@greatnowhere.com Tue Jul 29 21:24:22 2008 Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 31B7765003C for ; Tue, 29 Jul 2008 18:24:22 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 96375-05 for ; Tue, 29 Jul 2008 18:24:16 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail2.fintrading.com (mail.fintrading.com [195.2.100.100]) by postgresql.org (Postfix) with ESMTP id 59DC664FD0A for ; Tue, 29 Jul 2008 18:24:19 -0300 (ADT) Received: from [192.168.2.226] (unknown [81.198.70.254]) by mail2.fintrading.com (Postfix) with ESMTP id 7D87D3811D6C; Wed, 30 Jul 2008 00:23:32 +0300 (EEST) Subject: Re: numeric type From: Peter Zeltins To: Kris Jurka Cc: pgsql-jdbc@postgresql.org In-Reply-To: References: <005b01c8ea53$f64a9fd0$e2dfdf70$@com> <001d01c8f14d$cdd715a0$698540e0$@com> Content-Type: text/plain Date: Wed, 30 Jul 2008 00:23:33 +0300 Message-Id: <1217366613.5193.11.camel@peter-laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Content-Transfer-Encoding: 7bit X-greatnowhere.com-MailScanner: Found to be clean X-greatnowhere.com-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-4.9, required 6, BAYES_00 -5.00, RDNS_NONE 0.10) X-greatnowhere.com-MailScanner-From: peter@greatnowhere.com X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200807/66 X-Sequence-Number: 18851 > > OK, I hear ya. How about allowing user to set the default precision and > > scale values for "numeric" type? Not sure how this would be done in JDBC > > world but should be doable. > > You could add URL parameters like unspecifiedNumericPrecision=1000 and > unspecificedNumericScale=500, but the tradeoff is how much work is it to > add these options to the URL parsing code and then pass them around, add > it to the datasource implementation, add it to the documentation, and ... > > If there was some big important app that everyone wanted to use that blew > up on this I'd bet we'd do it, but I haven't heard a whole lot of > complaints about this problem. I would assume this is not a major issue for most. Personally I ran into this problem when writing automated PG->MS Access converter (Jackcess is the only lib capable of creating MDB files on Linux/BSD) and it bailed on numeric fields. Peter From dmigowski@ikoffice.de Wed Jul 30 08:24:58 2008 Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 1C2B364FD13 for ; Wed, 30 Jul 2008 05:24:58 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 46298-01 for ; Wed, 30 Jul 2008 05:24:51 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from ikoffice.de (ikoffice.de [81.169.166.92]) by postgresql.org (Postfix) with ESMTP id 20DAE64FCE1 for ; Wed, 30 Jul 2008 05:24:53 -0300 (ADT) Received: from p5481f753.dip.t-dialin.net ([84.129.247.83] helo=[192.168.1.16]) by ikoffice.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.66) (envelope-from ) id 1KO6zJ-0005Sp-AW; Wed, 30 Jul 2008 10:24:49 +0200 Message-ID: <48902552.6030308@ikoffice.de> Date: Wed, 30 Jul 2008 10:24:50 +0200 From: Daniel Migowski User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: Peter Zeltins CC: pgsql-jdbc@postgresql.org Subject: Re: numeric type References: <005b01c8ea53$f64a9fd0$e2dfdf70$@com> <001d01c8f14d$cdd715a0$698540e0$@com> <1217366613.5193.11.camel@peter-laptop> In-Reply-To: <1217366613.5193.11.camel@peter-laptop> Content-Type: text/html; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit X-Spam-Bar: - X-Spam-Score-Int: -14 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.673 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001, MIME_HTML_ONLY=1.672 X-Spam-Level: * X-Archive-Number: 200807/67 X-Sequence-Number: 18852 Hello Peter,

Peter Zeltins schrieb:
I would assume this is not a major issue for most. Personally I ran into
this problem when writing automated PG->MS Access converter (Jackcess is
the only lib capable of creating MDB files on Linux/BSD) and it bailed
on numeric fields. 
  
Great gods, why would anyone do this in the first place? :) I once wrote one for the opposite direction, but please tell us, which requirements needs you to convert a postgres database to MS Access?

With best regards,
Daniel Migowski
--
 |¯¯|¯¯|    IKOffice GmbH             Daniel Migowski
 |  |  |/|                            Mail: dmigowski@ikoffice.de
 |  | // |  Nordstr. 10               Tel.: 0441 21 98 89 52
 |  | \\ |  26135 Oldenburg           Fax.: 0441 21 98 89 55
 |__|__|\|  http://www.ikoffice.de    Mob.: 0176 22 31 20 76
From peter@greatnowhere.com Wed Jul 30 08:36:46 2008 Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 0004E6501A0 for ; Wed, 30 Jul 2008 05:36:46 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 52898-08 for ; Wed, 30 Jul 2008 05:36:29 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail2.fintrading.com (mail.fintrading.com [195.2.100.100]) by postgresql.org (Postfix) with ESMTP id 9A23465016B for ; Wed, 30 Jul 2008 05:36:15 -0300 (ADT) Received: from chipmunk (unknown [81.198.70.254]) by mail2.fintrading.com (Postfix) with ESMTP id 702893807B53; Wed, 30 Jul 2008 11:35:55 +0300 (EEST) From: "Peter" To: "'Daniel Migowski'" Cc: References: <005b01c8ea53$f64a9fd0$e2dfdf70$@com> <001d01c8f14d$cdd715a0$698540e0$@com> <1217366613.5193.11.camel@peter-laptop> <48902552.6030308@ikoffice.de> In-Reply-To: <48902552.6030308@ikoffice.de> Subject: Re: numeric type Date: Wed, 30 Jul 2008 11:34:28 +0300 Message-ID: <001701c8f21f$158ab920$40a02b60$@com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0018_01C8F238.3AD7F120" X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcjyHb2oOOdwhwaiS2mTJYTSEbbwLwAALsXw Content-Language: en-us X-greatnowhere.com-MailScanner: Found to be clean X-greatnowhere.com-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-4.899, required 6, BAYES_00 -5.00, HTML_MESSAGE 0.00, RDNS_NONE 0.10) X-greatnowhere.com-MailScanner-From: peter@greatnowhere.com X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200807/68 X-Sequence-Number: 18853 This is a multipart message in MIME format. ------=_NextPart_000_0018_01C8F238.3AD7F120 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit From: Daniel Migowski [mailto:dmigowski@ikoffice.de] Sent: Wednesday, July 30, 2008 11:25 AM To: Peter Zeltins Cc: pgsql-jdbc@postgresql.org Subject: Re: [JDBC] numeric type I would assume this is not a major issue for most. Personally I ran into this problem when writing automated PG->MS Access converter (Jackcess is the only lib capable of creating MDB files on Linux/BSD) and it bailed on numeric fields. Great gods, why would anyone do this in the first place? :) I once wrote one for the opposite direction, but please tell us, which requirements needs you to convert a postgres database to MS Access? Long story. We're migrating old Access app to Postgres but still need to be able to exchange datasets with the old app users (app supports it's own import/export in MDB format). Since migration is expected to last several years we need some sort of automated PG->MDB thing. Peter ------=_NextPart_000_0018_01C8F238.3AD7F120 Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable

 

 

From: Daniel Migowski [mailto:dmigowski@ikoffice.de]
Sent: Wednesday, July 30, 2008 11:25 AM
To: Peter Zeltins
Cc: pgsql-jdbc@postgresql.org
Subject: Re: [JDBC] numeric type

 

 
I would =
assume this is not a major issue for most. Personally I ran =
into
this problem when writing automated PG->MS =
Access converter (Jackcess is
the only lib capable of creating MDB files on =
Linux/BSD) and it bailed
on numeric fields. 
  

Great gods, why would = anyone do this in the first place? :) I once wrote one for the opposite direction, = but please tell us, which requirements needs you to convert a postgres = database to MS Access?


Long story. We’re migrating old Access app to = Postgres but still need to be able to exchange datasets with the old app users (app = supports it’s own import/export in MDB format). Since migration is expected = to last several years we need some sort of automated PG->MDB thing… =

 

Peter

 

------=_NextPart_000_0018_01C8F238.3AD7F120-- From dmigowski@ikoffice.de Wed Jul 30 08:39:53 2008 Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id EC89464FD13 for ; Wed, 30 Jul 2008 05:39:53 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 60057-01 for ; Wed, 30 Jul 2008 05:39:47 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from ikoffice.de (ikoffice.de [81.169.166.92]) by postgresql.org (Postfix) with ESMTP id C3EA264FCE1 for ; Wed, 30 Jul 2008 05:39:49 -0300 (ADT) Received: from p5481f753.dip.t-dialin.net ([84.129.247.83] helo=[192.168.1.16]) by ikoffice.de with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.66) (envelope-from ) id 1KO7Dm-0005VJ-Dm; Wed, 30 Jul 2008 10:39:46 +0200 Message-ID: <489028D3.4050706@ikoffice.de> Date: Wed, 30 Jul 2008 10:39:47 +0200 From: Daniel Migowski User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: Peter CC: pgsql-jdbc@postgresql.org Subject: Re: numeric type References: <005b01c8ea53$f64a9fd0$e2dfdf70$@com> <001d01c8f14d$cdd715a0$698540e0$@com> <1217366613.5193.11.camel@peter-laptop> <48902552.6030308@ikoffice.de> <001701c8f21f$158ab920$40a02b60$@com> In-Reply-To: <001701c8f21f$158ab920$40a02b60$@com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Bar: - X-Spam-Score-Int: -17 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200807/69 X-Sequence-Number: 18854 Hello Peter, Peter schrieb: > > > > Long story. We’re migrating old Access app to Postgres but still need > to be able to exchange datasets with the old app users (app supports > it’s own import/export in MDB format). Since migration is expected to > last several years we need some sort of automated PG->MDB thing… > Why don't you just make you converter configurable on how it handles decimal without specs? From peter@greatnowhere.com Wed Jul 30 08:47:03 2008 Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 9124D64FD13 for ; Wed, 30 Jul 2008 05:47:03 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 65518-03 for ; Wed, 30 Jul 2008 05:46:50 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail2.fintrading.com (mail.fintrading.com [195.2.100.100]) by postgresql.org (Postfix) with ESMTP id B703D64FCE1 for ; Wed, 30 Jul 2008 05:46:53 -0300 (ADT) Received: from chipmunk (unknown [81.198.70.254]) by mail2.fintrading.com (Postfix) with ESMTP id 528083807B53; Wed, 30 Jul 2008 11:46:30 +0300 (EEST) From: "Peter" To: "'Daniel Migowski'" Cc: References: <005b01c8ea53$f64a9fd0$e2dfdf70$@com> <001d01c8f14d$cdd715a0$698540e0$@com> <1217366613.5193.11.camel@peter-laptop> <48902552.6030308@ikoffice.de> <001701c8f21f$158ab920$40a02b60$@com> <489028D3.4050706@ikoffice.de> In-Reply-To: <489028D3.4050706@ikoffice.de> Subject: Re: numeric type Date: Wed, 30 Jul 2008 11:45:03 +0300 Message-ID: <002a01c8f220$8faeec20$af0cc460$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcjyH9O3N2Q03BdqQoqM16vg0muRngAAGonw Content-Language: en-us X-greatnowhere.com-MailScanner: Found to be clean X-greatnowhere.com-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-4.9, required 6, BAYES_00 -5.00, RDNS_NONE 0.10) X-greatnowhere.com-MailScanner-From: peter@greatnowhere.com X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200807/70 X-Sequence-Number: 18855 >> Long story. We're migrating old Access app to Postgres but still need >> to be able to exchange datasets with the old app users (app supports >> it's own import/export in MDB format). Since migration is expected to >> last several years we need some sort of automated PG->MDB thing. >> >Why don't you just make you converter configurable on how it handles >decimal without specs? I would need to hack Jackcess library in order to do that... besides it does not seem the proper way to do it, more like an ugly hack. getPrecision and getScale are supposed to return the true precision and scale after all... Peter From tivvpgsqljdbc@gtech-ua.com Wed Jul 30 09:12:29 2008 Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id B6BFB64FF8A for ; Wed, 30 Jul 2008 06:12:29 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 85638-08-3 for ; Wed, 30 Jul 2008 06:12:23 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.zoral.com.ua (skuns.zoral.com.ua [91.193.166.194]) by postgresql.org (Postfix) with ESMTP id E6FF76501C6 for ; Wed, 30 Jul 2008 06:12:25 -0300 (ADT) Received: from [10.1.1.57] (tivv.kiev.zoral.com.ua [10.1.1.57]) (authenticated bits=0) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id m6U9CK9i086619 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 30 Jul 2008 12:12:21 +0300 (EEST) (envelope-from tivvpgsqljdbc@gtech-ua.com) Message-ID: <48903074.30207@gtech-ua.com> Date: Wed, 30 Jul 2008 12:12:20 +0300 From: tivvpgsqljdbc@gtech-ua.com User-Agent: Thunderbird 2.0.0.14 (X11/20080421) MIME-Version: 1.0 CC: pgsql-jdbc@postgresql.org Subject: Re: numeric type References: <005b01c8ea53$f64a9fd0$e2dfdf70$@com> <001d01c8f14d$cdd715a0$698540e0$@com> <1217366613.5193.11.camel@peter-laptop> <48902552.6030308@ikoffice.de> <001701c8f21f$158ab920$40a02b60$@com> <489028D3.4050706@ikoffice.de> <002a01c8f220$8faeec20$af0cc460$@com> In-Reply-To: <002a01c8f220$8faeec20$af0cc460$@com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV version 0.93.3, clamav-milter version 0.93.3 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=4.777 tagged_above=0 required=5 tests=FROM_LOCAL_NOVOWEL=3.196, MISSING_HEADERS=1.581 X-Spam-Level: **** X-Archive-Number: 200807/71 X-Sequence-Number: 18856 Peter напиÑ�ав(ла): >>> Long story. We're migrating old Access app to Postgres but still need >>> to be able to exchange datasets with the old app users (app supports >>> it's own import/export in MDB format). Since migration is expected to >>> last several years we need some sort of automated PG->MDB thing. >>> >>> >> Why don't you just make you converter configurable on how it handles >> decimal without specs? >> > > I would need to hack Jackcess library in order to do that... besides it does > not seem the proper way to do it, more like an ugly hack. getPrecision and > getScale are supposed to return the true precision and scale after all... > > Peter > > It may be easier to write a wrapper over JDBC driver doing needed conversion. With Java Proxy it is not a complex task. It may look much like the next: public class DelegatingHandler implements InvocationHandler { protected final TP parent; public DelegatingHandler(TP parent) { this.parent = parent; } public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Method override = this.getClass().getMethod(method.getName(), method.getParameterTypes()); if (override != null) return override.invoke(this, args); return method.invoke(parent, args); } } public class ConnectionWrapper extends DelegatingHandler { public static Connection makeConnectionWrapper(Connection connection) { return (Connection) Proxy.newProxyInstance(ConnectionWrapper.class.getClassLoader(), new Class[]{Connection.class}, new ConnectionWrapper(connection)); } ... public PreparedStatement prepareStatement(String sql) throws SQLException { return makePreparedStatementWrapper(parent.prepareStatement(sql)); } ... } You simply create a wrapper and "override" needed methods by making methods in wrapper with exactly same name and signature, calling parent instead of super when needed.