[postmodern-devel] NIL interpreted as Boolean

Patrick May patrick.may at mac.com
Thu May 6 17:25:27 UTC 2010


	I have a class that looks something like this:

(defclass call-request ()
  ((phone-number :initarg :phone-number
                 :accessor phone-number
                 :type string
                 :col-type string)
   (call-time :initarg :callback-time
              :accessor callback-time
              :type (or null simple-date:timestamp
              :col-type (or db-null numeric)
              :initform nil)
   (extension :initarg :extension
              :accessor extension
              :type (or string null)
              :col-type (or db-null string)
              :initform nil))
  (:metaclass postmodern:dao-class)
  (:table-name "call_request")
  (:keys phone-number)
  (:documentation "A request to be called."))

When I try to insert a call-request with no call-time or extension, I get the error:

Database error 42804: column "call_time" is of type time with time zone but expression is of type boolean
You will need to rewrite or cast the expression.
Query: INSERT INTO call_request (extension, callback_time, phone_number) VALUES (false, false, E'8005551212')
   [Condition of type CL-POSTGRES-ERROR:SYNTAX-ERROR-OR-ACCESS-VIOLATION]

	How do I make Postmodern interpret nil as db-null rather than boolean?

Thanks,

Patrick

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2421 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/postmodern-devel/attachments/20100506/d7b7e3bb/attachment.bin>


More information about the postmodern-devel mailing list