Re: hsqldb, doubles, and precision

From: Robert Zeigler (robert.zeigle..mail.com)
Date: Tue Aug 12 2008 - 22:55:20 EDT

  • Next message: Lachlan Deck: "ObjEntity.translateToDbPath"

    Interestingly, according to:
    http://hsqldb.org/doc/guide/ch09.html
    "In table definition statements, HSQLDB accepts size, precision and
    scale qualifiers only for certain types: CHAR(s), VARCHAR(s),
    DOUBLE(p), NUMERIC(p), DECIMAL(p,s) and TIMESTAMP(p)"

    And a little further:

    By default specified precision and scale for the column is simply
    ignored by the engine. Instead, the values for the corresponding Java
    types are always used, which in the case of DECIMAL is an unlimited
    precision and scale. If a size is specified, it is stored in the
    database definition but is not enforeced by default.

    But firing up hsqldb version 1.8.0.7 (or 1.8.0.10, the latest
    version) and doing:
    create [cached] table foo (bar DOUBLE(22) NULL);
    ([cached] meaning with or without the cached keyword) gives:
    Unexpected token in statement [create table foo( bar DOUBLE(1].

    Looking through the bug database, I didn't see anything relating to
    this discrepancy, so I filed a new bug report with them.

    Robert

    On Aug 12, 2008, at 8/128:36 PM , Aristedes Maniatis wrote:

    >
    > On 13/08/2008, at 11:02 AM, Robert Zeigler wrote:
    >
    >> Hi all,
    >>
    >> While writing some unit tests today, I found that hsqldb was
    >> choking on a table creation statement along the lines of:
    >>
    >> CREATE CACHED TABLE foo (bar DOUBLE(22))
    >>
    >> A bit of research showed that this is a known issue: hsqldb doesn't
    >> support precision on doubles.
    >> I found some workarounds suggested here on the list (such as
    >> dropping the precision for doubles in the modeler; dropping
    >> precision when setting up the test environment, in code, and so
    >> forth). But I got to wondering why there wasn't a fix at the
    >> adapter level? Shouldn't this be something that the hsqldb adapter
    >> takes care of automatically? If so, I'll file a jira, and will
    >> likely contribute a patch. This is running 3.0M4, btw.
    >
    >
    > If you do write a patch, please add a javadoc with the URL to the
    > hsqldb bug report/feature request/documentation for this, so we can
    > track if this limitation is lifted and adjust Cayenne appropriately.
    >
    > Ari
    >
    >
    > -------------------------->
    > ish
    > http://www.ish.com.au
    > Level 1, 30 Wilson Street Newtown 2042 Australia
    > phone +61 2 9550 5001 fax +61 2 9550 4001
    > GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A
    >
    >



    This archive was generated by hypermail 2.0.0 : Tue Aug 12 2008 - 22:55:59 EDT