[postmodern-devel] using dao-class on database with column names like "addr:city"

John Morrison john.nmi.morrison at gmail.com
Tue Jun 14 11:37:15 UTC 2011


Hi All;

Sorry if this is a dumb newbie question.  I have a PostGIS database
with column names that are rather unfortunate (and created not by me
but by/via many different bits of GIS software, and they sadly seem
not to have mechanisms to specify rewriting of column names on the
fly during the workflow).

Some of the tables have column names which have colons in them.  When
I try and do the first Obvious Thing I can think of (name my
dao-defclass slots e.g., |addr:city| in an attempt to match the column
name), get-dao complains thusly:

--- cut here ---
No slot named addr:city in class CM-LOCATION. DAO out of sync with table, or 
incorrect query used.
--- cut here

A trip into the debugger leads me to believe that the slot name
|addr:city| in the dao-class defclass gets rewritten as "addr_city",
and then the get-dao from the table with column name "addr:city"
(which does not seem to likewise get passed through to-sql-name, as it
IS in fact an sql name) fails.  (FWIW I have never had any trouble
whatsoever with normally-named columns in almost all other databases I
have processed.)

Another Obvious Thing to try - setting *escape-sql-names-p* around the
defclass (as suggested in another mailing to this list circa 2008)
didn't seem to affect things either (but that could be Pilot Error).

The final Obvious Thing to try was figuring out how to set the
sql-name in the slot definition, but there seemed to be no initarg or
other mechanisms I could spot.

If some kind soul out there would point me in the right direction, I'd
greatly appreciate it.

Thanks in advance,

-jm

p.s., and then there are the database column names (e.g., "type") that
are locked in various CL packages...

-- 
--- John Morrison
--- john.nmi.morrison at gmail.com




More information about the postmodern-devel mailing list