Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 3CB7C634FB0 for ; Fri, 29 Jan 2010 17:36:02 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 41065-05 for ; Fri, 29 Jan 2010 21:35:47 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from leary.csoft.net (leary.csoft.net [205.205.214.5]) by mail.postgresql.org (Postfix) with ESMTP id 9F23C634A35 for ; Fri, 29 Jan 2010 17:35:51 -0400 (AST) Received: by leary.csoft.net (Postfix, from userid 1112) id 541FDA3BE; Fri, 29 Jan 2010 16:35:50 -0500 (EST) Date: Fri, 29 Jan 2010 16:35:50 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Simon Temple cc: pgsql-jdbc@postgresql.org Subject: Re: ParameterMetaData getPrecision() always zero? In-Reply-To: <3CF1F297-BA57-4725-830E-DD282228A284@amalto.com> Message-ID: References: <3CF1F297-BA57-4725-830E-DD282228A284@amalto.com> User-Agent: Alpine 2.00 (BSO 1167 2008-08-23) MIME-Version: 1.0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.546 tagged_above=-10 required=5 tests=AWL=0.053, BAYES_00=-2.599 X-Spam-Level: Content-Type: TEXT/PLAIN; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Archive-Number: 201001/78 X-Sequence-Number: 20274 On Thu, 28 Jan 2010, Simon Temple wrote: > =A0=A0 =A0ParameterMetaData m =3D stat.getParameterMetaData(=A0 ); > =A0=A0 =A0int colWidth =3D m.getPrecision( parameterIndex ); >=20 > For varchar columns I would expect to get the maximum column width. =A0So= 8 > for a varchar(8). >=20 > I always get zero as a result. > This is the best the JDBC driver can do. When preparing a statement, the= =20 server only returns the datatypes, not additional details about the size.= =20 This is because the parameters do not always match up with a table column.= =20 Consider "WHERE replace(col, 'a', 'bb') =3D ?" you won't be able to tell= =20 the parameter size from that. Kris Jurka