Re: postgresql "TABLENAME" versus TABLENAME

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Jul 07 2004 - 11:04:03 EDT

  • Next message: Twan Kogels: "Re: conflict with automatic session serialization by tomcat?"

    Ok, now I see where this is coming from... I just confirmed that this
    is an XML escaping bug. Here is the bug report -
    http://objectstyle.org/jira/secure/ViewIssue.jspa?key=CAY-159 . I will
    fix it soon.

    Andrus

    On Jul 6, 2004, at 3:11 PM, dan17..elus.net wrote:
    > In Oracle SQL, putting doublesquotes around a table name makes it case-
    > sensitive.
    >
    > ie, in Oracle:
    >
    > SELECT field FROM table;
    > is the same as
    > SELECT FIELD FROM TABLE;
    > and
    > SELECT "FIELD" FROM "TABLE"
    >
    > but not the same as
    >
    > SELECT "field" FROM "table";
    >
    > if you want the last one to work, you had to have done a
    >
    > CREATE TABLE "table" (
    > "field" NUMBER
    > )
    >
    > I've never worked with postgresql, but the issue may be similar.
    >
    > - Dan
    >
    >
    >
    >
    >
    >
    > Quoting Andrus Adamchik <andru..bjectstyle.org>:
    >
    >> Hi Tore,
    >>
    >> So are you saying that a doublequote is actually a part of the table
    >> name? That's weird, but still I think we should support this in
    >> Cayenne. Could you open a bug report please, showing where exactly
    >> this
    >> breaks. I'll make sure that when the XML is stored the name is
    >> properly
    >> escaped.
    >>
    >> Andrus
    >>
    >>
    >> On Jul 1, 2004, at 3:32 PM, Tore Halset wrote:
    >>
    >>> Hello.
    >>>
    >>> I have a database created by a import/export tool called ogr2ogr. It
    >>> creates tables and columns with captial letters as shown in the
    >>> example below. I am having trouble mapping this in cayenne. Using "s
    >>> in the Modeler makes the mapping xml file unparsable.
    >>>
    >>> Perhaps cayenne should use "s around every table name and field name
    >>> for every query? Perhaps only for postgresql databases? This would
    >>> make "TABLENAME" work, but will potensially break lots of old mapping
    >>> files. Perhaps this can be solved by configuring the database or the
    >>> jdbc driver?
    >>>
    >>> toretest=> create table "TABLENAME" ("FIELD" int);
    >>> CREATE TABLE
    >>> toretest=> \d "TABLENAME"
    >>> Table "public.TABLENAME"
    >>> Column | Type | Modifiers
    >>> --------+---------+-----------
    >>> FIELD | integer |
    >>>
    >>> toretest=> select * from TABLENAME;
    >>> ERROR: relation "tablename" does not exist
    >>> toretest=> select FIELD from "TABLENAME";
    >>> ERROR: column "field" does not exist
    >>> toretest=> select "FIELD" from "TABLENAME";
    >>> FIELD
    >>> -------
    >>> (0 rows)
    >>>
    >>> Regards,
    >>> - Tore.
    >>>
    >>>
    >>
    >>
    >
    >
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Wed Jul 07 2004 - 11:04:07 EDT