Re: Re: Trouble with floats in Postgresql

Friedrich Dominicus <[email protected]> Mon, 08 May 2006 07:37:45 +0200
Newsgroups gmane.lisp.clsql.devel
Organization Q Software Solutions GmbH
Message-ID <[email protected]>
I downloaded the sources for clsq-3.5.7 and it happens again. I posted
this bug more then once here's code

DB> (db-connect)
#<CLSQL-POSTGRESQL:POSTGRESQL-DATABASE localhost:5432/qss/webdb OPEN {100369AC31}>
DB> (select 'products)



Here's the backtrace:
#<SQL "products_seq"> fell through ETYPECASE expression.
Wanted one of (SYMBOL CLSQL-SYS:SQL-IDENT STRING).
   [Condition of type SB-KERNEL:CASE-FAILURE]

Restarts:
  0: [ABORT-REQUEST] Abort handling SLIME request.
  1: [TERMINATE-THREAD] Terminate this thread (#<THREAD "new-repl-thread" {100276DFB1}>)

Backtrace:
  0: (CLSQL-SYS::DATABASE-IDENTIFIER #<SQL "products_seq"> #<CLSQL-POSTGRESQL:POSTGRESQL-DATABASE localhost:5432/qss/webdb OPEN {100369AC31}>)
  1: (SEQUENCE-EXISTS-P #<SQL "products_seq"> :OWNER NIL :DATABASE NIL)


Here's the offending function
(defun database-identifier (name database)
  (sql-escape (etypecase name
		;; honor case of strings
                (string name
			#+nil (convert-to-db-default-case name database))
                (sql-ident (sql-output name database))
                (symbol (sql-output name database)))))


Here's the fixed function:
(defun database-identifier (name database)
  (sql-escape (etypecase name
		;; honor case of strings
                (string name
			#+nil (convert-to-db-default-case name database))
                (sql-ident (sql-output name database))
                (sql (sql-output name database))
                (symbol (sql-output name database)))))


It is in there for ages, and it can be shown with a simple select on
a def-view-class object. 

I'm using SQBL 0.9.12.5 here. 
(def-view-class t1 ()
      ((val :type float :accessor val)))

DB> (defun test-t1 ()
      (drop-table 't1)
      (create-view-from-class 't1)
      (let ((obj (make-instance 't1)))
        (setf (val obj) 0.07)
        (update-records-from-instance obj)
        (let ((fobj (car (select 't1 :flatp t))))
          (val fobj))))
TEST-T1
DB> (test-t1)
0.0d0



So this error ist still there

Regards
Friedrich