You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Andrea Bertucci <ab...@aitek.it> on 2009/11/09 12:50:38 UTC

Postgresql table aliases

Hi everyone.
I'm new of this list.
I'm writing because I've a schema generated for MySql used for a web 
application.
I've already migrated the schema for Oracle and the application it's 
working fine.
Now I'm trying to migrate everything for Postgresql but the main problem 
is that when
I execute an UPDATE query I receive an error from torque, because the 
update query automatically
generated are of the form
    update a set a.b = c;
that in PostgreSQL it's an error because table name can't be a prefix 
for a column in set statement.

Do you know how it's possible to say torque to avoid column prefix in 
this case?

Thanks in advance,
Andrea.


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


RE: Postgresql table aliases

Posted by Thomas Fischer <fi...@seitenbau.net>.
> I also wonder if this isn't a PostGres version issue.  If I remember the
> SQL standards correctly, the query that PostGres is choking on is
perfectly
> valid SQL.  PostGres, like MySQL and the like, have all been working to
> follow the SQL Standard more closely.  This could be a standards bug in
> your version of PostGres.

I checked that postgres 8.4 indeed chokes on updates with fully qualified
column names. Dunno about earlier versions.

> > ...
> > > ...
> > > Now I'm trying to migrate everything for Postgresql but the main
> > problem
> > > is that when
> > > I execute an UPDATE query I receive an error from torque, because the
> > > update query automatically
> > > generated are of the form
> > >     update a set a.b = c;
> > > that in PostgreSQL it's an error because table name can't be a prefix
> > > for a column in set statement.


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: Postgresql table aliases

Posted by Andrea Bertucci <ab...@aitek.it>.
Greg Monroe wrote:
> I also wonder if this isn't a PostGres version issue.  If I remember the 
> SQL standards correctly, the query that PostGres is choking on is perfectly
> valid SQL.  PostGres, like MySQL and the like, have all been working to 
> follow the SQL Standard more closely.  This could be a standards bug in
> your version of PostGres.
>   
Thank you!
Few minutes ago I understand that the problem was a mistake in my code.

In some cases I'm composing the update query using column names defined 
in OM Peer (for some reason I can't use Criteria) and execute query with
executeStatement function.
In this classes, automatically generated by torque using my schema 
definition, each column has a prefix
that is table name. This has generated the query error, because I obtain 
query of the form:
update a set a.b=c
that it's not a right syntax for postgres

I correct the problem deleting table prefix in the query generated by hand.

Andrea.

-- 

Andrea Bertucci
Aitek S.p.A. - Via della Crocetta, 15 - I-16122 Genova
tel.: +39 010 846731 
fax: +39 010 8467350 - e-mail: abertucci@aitek.it

---
Questo  messaggio di posta elettronica e gli allegati sono riservati e destinati esclusivamente alle persone cui sono indirizzati. Se avete ricevuto questo messaggio per errore, Vi preghiamo di rispedirlo al mittente o cancellarlo dal Vostro sistema. La pubblicazione, l'uso, la diffusione, l'inoltro, la stampa o la copia non autorizzati di questo messaggio e degli allegati sono vietati.

This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual to whom it is addressed. If you have received this email in error please send it back. Unauthorized publication, use, disclosure, forwarding, printing or copying of this email and its associated attachments is strictly prohibited.


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


RE: Postgresql table aliases

Posted by Greg Monroe <Gr...@dukece.com>.
I also wonder if this isn't a PostGres version issue.  If I remember the 
SQL standards correctly, the query that PostGres is choking on is perfectly
valid SQL.  PostGres, like MySQL and the like, have all been working to 
follow the SQL Standard more closely.  This could be a standards bug in
your version of PostGres.

> -----Original Message-----
> From: Thomas Fischer [mailto:fischer@seitenbau.net]
> Sent: Thursday, November 12, 2009 3:22 AM
> To: Apache Torque Users List
> Subject: RE: Postgresql table aliases
> 
> I cannot reproduce this. When I run the DataTest.testUpdate in the test
> project I see the following update statement in the save() method of an
> updated author:
> 
> UPDATE author SET name = ? WHERE author_id = ?
> 
> Could you provide more detail how the update clause is produced ?
> 
>    Thomas
> 
> > ...
> > Now I'm trying to migrate everything for Postgresql but the main
> problem
> > is that when
> > I execute an UPDATE query I receive an error from torque, because the
> > update query automatically
> > generated are of the form
> >     update a set a.b = c;
> > that in PostgreSQL it's an error because table name can't be a prefix
> > for a column in set statement.
> >
> > Do you know how it's possible to say torque to avoid column prefix in
> > this case?
> >
> > Thanks in advance,
> > Andrea.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: torque-user-help@db.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org

DukeCE Privacy Statement:
Please be advised that this e-mail and any files transmitted with
it are confidential communication or may otherwise be privileged or
confidential and are intended solely for the individual or entity
to whom they are addressed. If you are not the intended recipient
you may not rely on the contents of this email or any attachments,
and we ask that you please not read, copy or retransmit this
communication, but reply to the sender and destroy the email, its
contents, and all copies thereof immediately. Any unauthorized
dissemination, distribution or copying of this communication is
strictly prohibited.

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


RE: Postgresql table aliases

Posted by Thomas Fischer <fi...@seitenbau.net>.
I cannot reproduce this. When I run the DataTest.testUpdate in the test
project I see the following update statement in the save() method of an
updated author:

UPDATE author SET name = ? WHERE author_id = ?

Could you provide more detail how the update clause is produced ?

   Thomas

> ...
> Now I'm trying to migrate everything for Postgresql but the main problem
> is that when
> I execute an UPDATE query I receive an error from torque, because the
> update query automatically
> generated are of the form
>     update a set a.b = c;
> that in PostgreSQL it's an error because table name can't be a prefix
> for a column in set statement.
>
> Do you know how it's possible to say torque to avoid column prefix in
> this case?
>
> Thanks in advance,
> Andrea.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org