Thread: Problemas with update sentence in postgres from jdbc

Problemas with update sentence in postgres from jdbc

From
"Joksan Nempu Fernandez"
Date:
Hi:

I try this ...

String sql ="UPDATE crupier "+
                    "SET  c_estado='"+cestado+"' WHERE "+
                    " c_rut='"+crut+"' ";

and send me the next exception Error:

04-04-2008 07:00:03 PM Persistencia.Mesa ActualizarTupla
GRAVE: null
org.postgresql.util.PSQLException: ERROR: el valor de array debe comenzar con «{» o información de dimensión
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1548)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1316)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:191)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:337)

I no t understand what happen in my code and i put the sql sentence in pgadmin3 , i run this update and send me the same error.

Im using postgresql 8.3

THanx in advance.
--
Joksan Nempu Fernandez
Estudiante Ingeniería Civil en Computación e Informática.
Encargado del Laboratorio de Sistemas Distribuidos.

Re: Problemas with update sentence in postgres from jdbc

From
Craig Ringer
Date:
Joksan Nempu Fernandez wrote:
> Hi:
>
> I try this ...
>
> String sql ="UPDATE crupier "+
>                     "SET  c_estado='"+cestado+"' WHERE "+
>                     " c_rut='"+crut+"' ";
>
> and send me the next exception Error:
>
> 04-04-2008 07:00:03 PM Persistencia.Mesa ActualizarTupla
> GRAVE: null
> org.postgresql.util.PSQLException: ERROR: el valor de array debe comenzar
> con «{» o información de dimensión
>
If I'm not mistaken that's complaining that the array must (begin with?)
{ . There don't seem to be any arrays in your query.

Try turning on query logging in the database and obtaining the query,
and the error, from the PostgreSQL logs. It's possible that the query
you're writing isn't exactly what's being sent, especially since it
sounds like you're using a persistence layer. As it is, we can't see the
values of your variables or what the final SQL being sent is. Even the
output of  System.out.println(sql) would be helpful, though not as good
as information from the database logs.

If you set your locale to English for the testing you would probably get
a better response too.

Please also post the output of running "\d crupier" in psql.

--
Craig Ringer

Re: Problemas with update sentence in postgres from jdbc

From
Craig Ringer
Date:
Joksan Nempu Fernandez wrote:
> Hi , thanx for answer me, well here is the sql string that i send from my
> web app. Im using a context connection for the pool in tomcat.

In future I recommend replying to the mailing list, not just to me, so
that everybody can read your message. I was telling you that you should
send more information so that *everybody* on the list would have more
chance of helping you.

As it happens your query string does not explain the problem, so:

Please set:
    log_statement = 'all'
in your postgresql.conf, restart postgresql, and run your problem query
again. Look in the postgresql logs and find the query. Then include the
full text of the query as shown in PostgreSQL's logs, as well as the
following error message, in your reply.

Please also include the output of running "\d mesa" in psql. Without
being able to see your schema it is hard to tell what is going on.

I've left your statement included below.

> AbrirMesa: abriendo mesa...
> update mesa set  m_col1=1 , m_col2=2 , m_col3=3 , m_col4=4 , m_col5=5 ,
> m_col6=6 , m_col7=7 , m_col8=8 , m_col9=9 , m_col10=10 , m_col11=11 ,
> m_col12=12 , m_col13=13 , m_col14=0 , m_col15=0 , m_col16=0 ,
> m_estado='abierta' where m_cod='2'
> Mesa: AT ERROR:ERROR: el valor de array debe comenzar con «{» o información
> de dimensión
> AbrirMesa: mesa cerrada...
> 05-04-2008 01:15:46 PM Persistencia.Mesa ActualizarTupla
> GRAVE: null
> org.postgresql.util.PSQLException: ERROR: el valor de array debe comenzar
> con «{» o información de dimensión
>         at
> org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1548)
>         at
> org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1316)
>         at
> org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:191)
>         at
> org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:452)
>         at
> org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:337)
>         at
> org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:236)
>         at
> org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
>         at Persistencia.Mesa.ActualizarTupla(Mesa.java:207)
>         at Persistencia.Supervisor.abrirMesa(Supervisor.java:186)
>         at controladores.AbrirMesa.processRequest(AbrirMesa.java:46)
>         at controladores.AbrirMesa.doGet(AbrirMesa.java:67)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

Re: Problemas with update sentence in postgres from jdbc

From
olarte.andres@gmail.com
Date:
it seems you are trying to insert an int value in an array column. check your schema

---- Original Message ----
Hi:<br><br>I try this ...<br><br>String sql ="UPDATE crupier
"+<br>                   
"SET c_estado='"+cestado+"' WHERE
"+<br>                   
"c_rut='"+crut+"' ";<br>  
<br>and send me the next exception Error:<br><br>04-04-2008 07:00:03 PM Persistencia.Mesa ActualizarTupla<br>GRAVE:
null<br>org.postgresql.util.PSQLException:ERROR: el valor de array debe comenzar con «{» o información de dimensión<br>

        at
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1548)<br>       
at
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1316)<br>       
atorg...