I cannot reproduce this error. Boolean selects are tested in the Torque runtime test, and work fine. I just ran the test against the 8.0-311 version of the postgresql driver, and it works fine.

The code used is (see org.apache.torque.DataTest in the test project)

....
        // clean booleancheck table (because insert uses fixed keys)
        Criteria criteria = new Criteria();
criteria.add(BooleanCheckPeer.TEST_KEY, (Object) null, Criteria.NOT_EQUAL);
        BooleanCheckPeer.doDelete(criteria);

        BooleanCheck bc = new BooleanCheck();
        bc.setTestKey("t1");
        bc.setBintValue(true);
        bc.setBcharValue(true);
        bc.save();
        bc = new BooleanCheck();
        bc.setTestKey("f1");
        bc.setBintValue(false);
        bc.setBcharValue(false);
        bc.save();
....

        Criteria criteria = new Criteria();
        criteria.add(BooleanCheckPeer.BCHAR_VALUE, new Boolean(true));
        criteria.add(BooleanCheckPeer.BINT_VALUE, new Boolean(true));
        List booleanCheckList = BooleanCheckPeer.doSelect(criteria);
        assertTrue("Should have read 1 dataset with both values true "
                + "but read " + booleanCheckList.size(),
                booleanCheckList.size() == 1);
BooleanCheck booleanCheck = (BooleanCheck) booleanCheckList.get(0);
        // use trim() for testkey because some databases will return the
        // testkey filled up with blanks, as it is defined as char(10)
        assertTrue("Primary key of data set should be t1 but is "
                + booleanCheck.getTestKey().trim(),
                "t1".equals(booleanCheck.getTestKey().trim()));

        criteria.clear();
        criteria.add(BooleanCheckPeer.BCHAR_VALUE, new Boolean(false));
        criteria.add(BooleanCheckPeer.BINT_VALUE, new Boolean(false));
        booleanCheckList = BooleanCheckPeer.doSelect(criteria);
        assertTrue("Should have read 1 dataset with both values false "
                + "but read " + booleanCheckList.size(),
                booleanCheckList.size() == 1);
        booleanCheck = (BooleanCheck) booleanCheckList.get(0);
        assertTrue("Primary key of data set should be f1 but is "
                + booleanCheck.getTestKey().trim(),
                "f1".equals(booleanCheck.getTestKey().trim()));

The schema file snippet for the booleancheck table is

  <table name="boolean_check" idMethod="none">
<column name="test_key" required="true" primaryKey="true" type="CHAR" size="10" />
    <column name="bint_value" required="true" type="BOOLEANINT" size="1"/>
    <column name="bchar_value" required="true" type="BOOLEANCHAR" />
  </table>

If you are still of the opinion that this is a bug, can you please produce a test case and create a issue in Torque's bug tracker ?

  Thanks,

    Thomas


On Mon, 27 Mar 2006, Peter Ledbrook wrote:

Further to this, any query that involves a BOOLEANINT field fails with
the error:

 org.postgresql.util.PSQLException: ERROR: operator does not exist:
smallint = boolean

Apparently the query passes a boolean value for the field even though
it's implemented as an integer. From what I read elsewhere, this
strict behaviour in the PostgreSQL driver is unlikely to change, so
does anyone know of a workaround?

Thanks,

Peter

On 25/03/06, Peter Ledbrook <[EMAIL PROTECTED]> wrote:
Hi,

I have tried to build Scarab against a postgresql database, but I'm
running into a problem with the SQL generated by Torque. The Scarab
database schema specifies a size for some of its integer columns, and
these columns then have a type of INTEGER(n), where 'n' is the given
size. For example:

  <column name="DELETED" required="false" type="BOOLEANINT"
default="0" size="1" javaType="primitive"/>

becomes the SQL:

  DELETED INT2(1)

Unfortunately, postgresql does not support a size here, i.e. "INT2"
works, but "INT2(1)" does not. Note that this problem occurs with
INTEGER as well as BOOLEANINT.

Is this a know problem? Is there a workaround other than removing the
'size' attributes from integer columns?

Thanks,

Peter


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to