Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 85A196323D3 for ; Wed, 17 Feb 2010 22:15:05 -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 59780-10 for ; Thu, 18 Feb 2010 02:14:46 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pz0-f179.google.com (mail-pz0-f179.google.com [209.85.222.179]) by mail.postgresql.org (Postfix) with ESMTP id B0154632343 for ; Wed, 17 Feb 2010 22:14:54 -0400 (AST) Received: by pzk9 with SMTP id 9so24195pzk.28 for ; Wed, 17 Feb 2010 18:14:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=G4CJSnh8ryauQVl247mTSFhh+9edVkbMkf4b6E2gzyc=; b=GA/3AgGWW0sPJ8E9pF9ChwdARQNp/vmymsJ3JO1BsJChsTbHhW4+/Ym7VJ++tIrxUY u1lwLJCm0rMyMlz5DCw1RXKDbyCxwd/lfZAOxGEt8gAKCvVY4Kq1wSj/kWYyY6YyMLK6 Z2JsVm1SEQLPmRVkLFuNY84W8kr9hK/7bX0mk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=io34VHlLiblR/pMYtlYEi1XfY7tqTTMwBLgijaUa/INASiom//kcGbCxpRlDvZUK81 aW4lTcreroi85c/dGH/l7MnVc0Cw1KQ6sKTm4BBdFIxHpHSFAmaKIO0PKAoJM86IlRJf +2G6kWjSDiXWhNCCjSLAscgQKAl2tKkOgK/D4= MIME-Version: 1.0 Received: by 10.143.154.29 with SMTP id g29mr3136579wfo.20.1266459290947; Wed, 17 Feb 2010 18:14:50 -0800 (PST) Date: Wed, 17 Feb 2010 21:14:50 -0500 X-Google-Sender-Auth: c3ca75520e64d506 Message-ID: <1e11c2271002171814i704d31f4oca1d819dc5a02103@mail.gmail.com> Subject: Column is of type date but expression is of type text From: list_usr@spacebox.net To: pgsql-jdbc@postgresql.org Content-Type: multipart/alternative; boundary=001636e0b89128d230047fd68886 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.391 tagged_above=-10 required=5 tests=AWL=1.207, BAYES_00=-2.599, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 201002/28 X-Sequence-Number: 20315 --001636e0b89128d230047fd68886 Content-Type: text/plain; charset=ISO-8859-1 I'm trying to call a stored procedure from a Java app; the stored procedure just makes an insert on a table and returns true or false. It seems there's a problem when a java.sql.Date type parameter is passed from Java to the PostgreSQL stored procedure, and then to the insert: LOG: execute : select * from athlete.create_athlete($1,$2,$3,$4,$5,$6,$7) as result DETAIL: parameters: $1 = '', $2 = 'foo@bar.com', $3 = 'Joe', $4 = 'Blow', $5 = 'foobar', $6 = 'M', $7 = '1979-03-22 -04:00:00' ERROR: column "dob" is of type date but expression is of type text at character 122 HINT: You will need to rewrite or cast the expression. QUERY: INSERT INTO athlete.athlete (email, first_name, last_name, password, gender, dob) VALUES ( $1 , $2 , $3 , $4 , $5 , $6 ) CONTEXT: PL/pgSQL function "create_athlete" line 2 at SQL statement STATEMENT: select * from athlete.create_athlete($1,$2,$3,$4,$5,$6,$7) as result The Java code, in brief: registerQuery = "{? = call athlete.create_athlete(?,?,?,?,?,?)}"; ... CallableStatement cs = conn.prepareCall(registerQuery); cs.registerOutParameter(1, Types.BOOLEAN); cs.setString(2, email); ... createAthlete.setDate(7, birthdate); // birthdate is of type java.sql.Date I've asked elsewhere, and it seems my Java code is correct for a stored procedure that returns a single value. However I'm still uncertain because the logs show 7 parameters in the call to create_athlete() when there should only be 6 - if parameters $1-$6 in the call to create_athlete() are the parameters passed to the insert statement, then the dob parameter would be mismatched with the gender parameter. Are parameters $2-$7 actually passed to the insert? If yes, where am I going wrong? Thanks. --001636e0b89128d230047fd68886 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I= 9;m trying to call a stored procedure from a Java app; the stored procedure= just makes an insert on a table and returns true or false. It seems there= 's a problem when a java.sql.Date type parameter is passed from Java to= the PostgreSQL stored procedure, and then to the insert: LOG: execute <unnamed>: select * from athlete.create_athlete($1,$2,$= 3,$4,$5,$6,$7) as result DETAIL: parameters: $1 =3D '', $2 =3D 'foo@bar.com', $3 =3D 'Joe', $4 =3D 'Blow', = $5 =3D 'foobar', $6 =3D 'M', $7 =3D '1979-03-22 -04:00:= 00' ERROR: column "dob" is of type date but expression is of type te= xt at character 122 HINT: You will need to rewrite or cast the expression. QUERY: INSERT INTO athlete.athlete (email, first_name, last_name, password= , gender, dob) VALUES ( $1 , $2 , $3 , $4 , $5 , $6 ) CONTEXT: PL/pgSQL function "create_athlete" line 2 at SQL statem= ent STATEMENT: select * from athlete.create_athlete($1,$2,$3,$4,$5,$6,$7) as r= esult The Java code, in brief: registerQuery =3D "{? =3D call athlete.create_athlete(?,?,?,?,?,?)}&qu= ot;; ... CallableStatement cs =3D conn.prepareCall(registerQuery); cs.registerOutParameter(1, Types.BOOLEAN); cs.setString(2, email); ... createAthlete.setDate(7, birthdate); // birthdate is of type java.sql.Date I've asked elsewhere, and it seems my Java code is correct for a stored= procedure that returns a single value. However I'm still uncertain be= cause the logs show 7 parameters in the call to create_athlete() when there= should only be 6 - if parameters $1-$6 in the call to create_athlete() are= the parameters passed to the insert statement, then the dob parameter woul= d be mismatched with the gender parameter. Are parameters $2-$7 actually p= assed to the insert? If yes, where am I going wrong?

Thanks.
--001636e0b89128d230047fd68886--