Error Message Inconsistencies?
Cyrus Harmon <ch-clsql-dl6SmSK5uza1Z/[email protected]>
| Newsgroups | gmane.lisp.clsql.devel |
|---|---|
| Message-ID | <[email protected]> |
Let me start by saying I don't know that much about handling errors and
warnings in lisp. But when I run the attached code with postgresql (not
sockets) I get the following error (at least on the second run):
While accessing database #<POSTGRESQL-DATABASE /test/test OPEN
#x6519FD6>
with expression "CREATE TABLE employee2 (emplid INT NOT NULL,
first_name CHAR$
Error 7 / relation "employee2" already exists
has occurred.
[Condition of type CLSQL-SYS:SQL-DATABASE-DATA-ERROR]
When I run this postgresql-sockets, I see my print of got-warning1 and
that's it. It strikes me as add that I would get such different results
just by using different mechanisms of talking to pg. Any
thoughts/suggestions? This happens on PPC/OpenMCL PPC/SBCL and
FreeBSD/SBCL.
Thanks,
Cyrus
(require 'asdf)
(defparameter *shared-lisp-packages-directory* #p"/bobo/share/lisp/")
(pushnew (merge-pathnames
(make-pathname :directory (list :relative "uffi"))
*shared-lisp-packages-directory*)
asdf:*central-registry*)
(pushnew (merge-pathnames
(make-pathname :directory (list :relative "clsql"))
*shared-lisp-packages-directory*)
asdf:*central-registry*)
(pushnew (merge-pathnames
(make-pathname :directory (list :relative "cl-rt"))
*shared-lisp-packages-directory*)
asdf:*central-registry*)
(pushnew (merge-pathnames
(make-pathname :directory (list :relative "md5"))
*shared-lisp-packages-directory*)
asdf:*central-registry*)
(asdf:operate 'asdf:load-op 'clsql)
(defparameter *use-sockets* nil)
(if *use-sockets*
(progn
(defparameter *dbtype* :postgresql-socket)
(defparameter *dbhost* "localhost"))
(progn
(defparameter *dbtype* :postgresql)
(defparameter *dbhost* "")))
(defparameter *dbdb* "test")
(defparameter *dbuser* "test")
(defparameter *dbpasswd* "test")
(clsql:def-view-class employee2()
((emplid :db-kind :key :db-constraints :not-null
:type integer :initarg :emplid)
(first-name :accessor first-name :type (string 30) :initarg
:first-name)
(last-name :accessor last-name :type (string 30) :initarg :last-name)
(email :accessor employee-email :type (string 100) :initarg :email)
(ecompanyid :type integer :initarg :ecompanyid)
(managerid :type integer :initarg :managerid))
(:base-table employee2))
(let ((db (clsql:connect (list *dbhost* *dbdb* *dbuser* *dbpasswd*)
:database-type *dbtype*)))
(unwind-protect
(progn
(handler-case
(handler-case
(clsql:create-view-from-class 'employee2 :database db)
(warning (w) (print (cons 'got-warning1 w))))
(warning (w) (print (cons 'got-warning2 w)))
)
)
(clsql:disconnect :database db)
))