Date: 2004-05-06T10:58:42 Editor: 213.78.116.250 <> Wiki: DB Torque Wiki Page: FrequentlyAskedQuestions URL: http://wiki.apache.org/db-torque/FrequentlyAskedQuestions
no comment Change Log: ------------------------------------------------------------------------------ @@ -293,3 +293,32 @@ torque.defaults.pool.maxWait=10 }}} Read the Jakarta Commons DBCP docs about DBCP configuration and adapt your torque properties file accordingly. + +-- Tarlika Elisabeth Schmitz + +== Why does Torque generate invalid SQL for PostgeSQL BOOL columns? == + +Torque generates invalid SQL for bool comparisons: +generated "WHERE xyz=0", but it should be ''WHERE xyz=FALSE'' or "WHERE xyz='0'". + +The fault is in the adapter class \org\apache\torque\adapter\DBPostgres.class: +{{{ +public String getBooleanString(Boolean b) +{ + //was : return (b == null) ? "0" : (Boolean.TRUE.equals(b) ? "1" : "0"); + return (b == null) ? "NULL" : (Boolean.TRUE.equals(b) ? "TRUE" : "FALSE"); +} +}}} + +-- Tarlika Elisabeth Schmitz + +== Why does the generated SQL fail with PostgreSQL? == + +The SQL generated for PostgreSQL using defaultIdMethod "native" causes a problem with PostGreSQL 7.2 or higher: + +For each autoIncrement primary key a CREATE SEQUENCE statement is generated followed by the CREATE TABLE statement. The latter fails because this version of PostgreSQL automatically creates a SEQUENCE for each serial column. The table will not be created if the SEQUENCE already exists. + +Remove line 7 ''#if ($sequence.length()>0)$sequence#end'' from the template sql\base\postgresql\table.vm + +-- Tarlika Elisabeth Schmitz + --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]