Hi,
I'm defining tables with Postmodern and made the mistake of specifying
a column type such as (OR TEXT DB-NULL), where DB-NULL was a symbol
newly interned into my current package rather than the symbol in the
S-SQL package. This resulted in SQL expressions with illegal syntax
being generated (e.g. "column_name OR NOT NULL").
After tracking down the problem and finding it was my fault, I made
changes (attached) to catch column-type errors earlier.
The patch signals an error in DEF-SQL-OP :CREATE-TABLE when a column
type is a list which begins with OR and does not meet the other
original criteria for an or-db-null type: DB-NULL is a member, and
length is 3. It also now ensures that DB-NULL doesn't occur twice, or
on its own, outside of an OR compound type.
I didn't do anything to validate other "compound" types such as
NUMERIC.
You might find it a bit odd that I format the DB-NULL symbol in my
ERROR calls with ~S in the format control string instead of simply
putting "DB-NULL" in the string:
(error "Illegal compound type for column: ~S~
~&(Only (~S x ~S) and (~S ~S x) are allowed.)"
type 'or 'db-null 'or 'db-null))
This ensures that the S-SQL package name is prefixed to the symbol
name--but only if S-SQL was not imported by the current package. This
emphasizes to these users that DB-NULL was not imported into their
current package and this is probably what their problem is.
For instance:
Illegal compound type for column: (OR TEXT DB-NULL)
(Only (OR x S-SQL) and (OR S-SQL x) are allowed.)
[Condition of type SIMPLE-ERROR]
--
J.P. Larocque: <jpl(a)thoughtcrime.us>, +1 509 324-2410