Skip site navigation (1) Skip section navigation (2)

Re: BUG #2250: JSTL parameterized queries inserting numeric

From: Kris Jurka <books(at)ejurka(dot)com>
To: Ian Moore <ian(dot)moore(at)ism-online(dot)co(dot)uk>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2250: JSTL parameterized queries inserting numeric
Date: 2006-02-10 08:15:25
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs

On Thu, 9 Feb 2006, Ian Moore wrote:

> The following bug has been logged online:
> Bug reference:      2250
> PostgreSQL version: 8.0.3
> Description:        JSTL parameterized queries inserting numeric values
> Details:
> When using the JSTL via JDBC, there is the option to write INSERT/UPDATE
> statements with parameters in JSP's.
> There is only two types the data parameters can be, a date or a character
> varying string.
> In most databases, if a character varying string is provided that contains a
> numeric value, and this is used to insert/update a numeric field, the driver
> will attempt a type conversion to the numeric value of the string and report
> errors only if the string is not a valid . However trying this in JSTL,
> which only provides support for text or date parameters results in the
> following error:
> 	ERROR: column "????" is of type integer but expression is of type character
> varying

Your options are to rewrite your query like:
INSERT INTO mytable (intcol) VALUES (CAST(? AS int))

or you may use the 8.2dev driver and add ?stringtype=unspecified to your 

Kris Jurka

In response to

pgsql-bugs by date

Next:From: Denis de BernardyDate: 2006-02-10 22:02:06
Subject: overlapping rules can let you break referential integrity
Previous:From: Kalador Tech SupportDate: 2006-02-09 16:40:32
Subject: Re: BUG #2236: extremely slow to get unescaped bytea data

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group