Thread: Strange error

Strange error

From
Felipe Schnack
Date:
  I'm getting this very strange error. I'm setting the null to Types.NULL..

 INSERT INTO PESSOAS (rg, cpf, nomepessoa, nascimento, sexo, email,
 endereco,bairro, codcidade,codpessoa) VALUES (null, null, 'Arno João
 Bosetti', null, 'M', null, 'Av. Prof. Oscar Pereira,1220  /908', 'Santo
 Antonio',1,1)

 java.sql.SQLException: ERROR:  column "cpf" is of type bigint but
 expression is of type text
     You will need to rewrite or cast the expression

     at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:126)
     at
 org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:497)
     at
 org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:320)
     at
 org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:48)
     at
 org.postgresql.jdbc1.AbstractJdbc1Statement.executeUpdate(AbstractJdbc1Statement.java:197)
     at
 com.w2.login.daemons.UniversusImport.importPessoas(UniversusImport.java:238)



--

Felipe Schnack
Analista de Sistemas
felipes@ritterdosreis.br
Cel.: (51)91287530
Linux Counter #281893

Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
ritter@ritterdosreis.br
Fone/Fax.: (51)32303341


Re: Strange error

From
Felipe Schnack
Date:
  Doesn't work either, and as far as I know, there is no need to do that
using pgsql driver.

On Thu, 2003-01-02 at 12:53, Andreas Joseph Krogh wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Thursday 02 January 2003 14:48, you wrote:
> >   I'm getting this very strange error. I'm setting the null to Types.NULL..
>
> The correct syntax is:
> ps.setNull(1, Types.BIGINT);
>
> - --
> Andreas Joseph Krogh <andreak@officenet.no>
>     There will always be someone who agrees with you
>     but is, inexplicably, a moron.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.0.7 (GNU/Linux)
>
> iD8DBQE+FFJTUopImDh2gfQRArwVAJ9npLjM/RnovD+Xvr6xbikNGsd18QCcD0qT
> IBYUYzj26ldcFs3XDBk9LKg=
> =xCXs
> -----END PGP SIGNATURE-----
>
--

Felipe Schnack
Analista de Sistemas
felipes@ritterdosreis.br
Cel.: (51)91287530
Linux Counter #281893

Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
ritter@ritterdosreis.br
Fone/Fax.: (51)32303341


Re: Strange error

From
Dave Cramer
Date:
Felipe,

Are you using prepared statements to do this?

Dave
On Thu, 2003-01-02 at 08:48, Felipe Schnack wrote:
>   I'm getting this very strange error. I'm setting the null to Types.NULL..
>
>  INSERT INTO PESSOAS (rg, cpf, nomepessoa, nascimento, sexo, email,
>  endereco,bairro, codcidade,codpessoa) VALUES (null, null, 'Arno João
>  Bosetti', null, 'M', null, 'Av. Prof. Oscar Pereira,1220  /908', 'Santo
>  Antonio',1,1)
>
>  java.sql.SQLException: ERROR:  column "cpf" is of type bigint but
>  expression is of type text
>      You will need to rewrite or cast the expression
>
>      at org.postgresql.core.QueryExecutor.execute(QueryExecutor.java:126)
>      at
>  org.postgresql.jdbc1.AbstractJdbc1Connection.ExecSQL(AbstractJdbc1Connection.java:497)
>      at
>  org.postgresql.jdbc1.AbstractJdbc1Statement.execute(AbstractJdbc1Statement.java:320)
>      at
>  org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:48)
>      at
>  org.postgresql.jdbc1.AbstractJdbc1Statement.executeUpdate(AbstractJdbc1Statement.java:197)
>      at
>  com.w2.login.daemons.UniversusImport.importPessoas(UniversusImport.java:238)
>
--
Dave Cramer <Dave@micro-automation.net>


Re: Strange error

From
Felipe Schnack
Date:
  Yes, I do, why?

On Thu, 2003-01-02 at 12:06, Dave Cramer wrote:
> Felipe,
>
> Are you using prepared statements to do this?
>
> Dave
> On Thu, 2003-01-02 at 08:48, Felipe Schnack wrote:

--

Felipe Schnack
Analista de Sistemas
felipes@ritterdosreis.br
Cel.: (51)91287530
Linux Counter #281893

Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
ritter@ritterdosreis.br
Fone/Fax.: (51)32303341


Re: Strange error

From
Dave Cramer
Date:
Just checking, ok I tried this with psql and it works fine, does your
insert work in psql?

what version of the server are you using?

Dave
On Thu, 2003-01-02 at 09:30, Felipe Schnack wrote:
>   Yes, I do, why?
>
> On Thu, 2003-01-02 at 12:06, Dave Cramer wrote:
> > Felipe,
> >
> > Are you using prepared statements to do this?
> >
> > Dave
> > On Thu, 2003-01-02 at 08:48, Felipe Schnack wrote:
--
Dave Cramer <Dave@micro-automation.net>


Re: Strange error

From
Felipe Schnack
Date:
  I'm using 7.3
  the query have an error, but related to constraints, not to data
types...

On Thu, 2003-01-02 at 12:42, Dave Cramer wrote:
> Just checking, ok I tried this with psql and it works fine, does your
> insert work in psql?
>
> what version of the server are you using?
>
> Dave
> On Thu, 2003-01-02 at 09:30, Felipe Schnack wrote:
> >   Yes, I do, why?
> >
> > On Thu, 2003-01-02 at 12:06, Dave Cramer wrote:
> > > Felipe,
> > >
> > > Are you using prepared statements to do this?
> > >
> > > Dave
> > > On Thu, 2003-01-02 at 08:48, Felipe Schnack wrote:
> --
> Dave Cramer <Dave@micro-automation.net>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
--

Felipe Schnack
Analista de Sistemas
felipes@ritterdosreis.br
Cel.: (51)91287530
Linux Counter #281893

Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
ritter@ritterdosreis.br
Fone/Fax.: (51)32303341


Re: Strange error

From
Dave Cramer
Date:
Felipe,

I'm not sure what that means, does it work in psql? Can you create a
small table and try it without constraints?


Dave
On Thu, 2003-01-02 at 10:46, Felipe Schnack wrote:
>   I'm using 7.3
>   the query have an error, but related to constraints, not to data
> types...
>
> On Thu, 2003-01-02 at 12:42, Dave Cramer wrote:
> > Just checking, ok I tried this with psql and it works fine, does your
> > insert work in psql?
> >
> > what version of the server are you using?
> >
> > Dave
> > On Thu, 2003-01-02 at 09:30, Felipe Schnack wrote:
> > >   Yes, I do, why?
> > >
> > > On Thu, 2003-01-02 at 12:06, Dave Cramer wrote:
> > > > Felipe,
> > > >
> > > > Are you using prepared statements to do this?
> > > >
> > > > Dave
> > > > On Thu, 2003-01-02 at 08:48, Felipe Schnack wrote:
> > --
> > Dave Cramer <Dave@micro-automation.net>
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 2: you can get off all lists at once with the unregister command
> >     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
--
Dave Cramer <Dave@micro-automation.net>