From matt.lamari at gmail.com Mon Feb 4 05:56:05 2008 From: matt.lamari at gmail.com (Matt.Lamari) Date: Sun, 3 Feb 2008 23:56:05 -0600 Subject: [postmodern-devel] Possible bug/Lispworks incompatibility on function type discriminator In-Reply-To: <1201118759.6570.21.camel@localhost.localdomain> References: <1201118759.6570.21.camel@localhost.localdomain> Message-ID: <000001c866f2$a21c94c0$3301a8c0@seaviewrange.com> Found in 1.03, and it's still in 1.05: File protocol.lisp Look for the line: (funcall (the (function (stream (unsigned-byte 32)) t) (field-interpreter field)) Lispworks (5.02 Win32 in my test; but nothing win32-specific here) complains of inability to use a call signature function specifier. I.e. I think you can say (the function f) but not (the (function integer) f). I believe specifying a function to this degree is unsupported in lispworks. I could be wrong; but this stops doquery from working, and when I change the code to a "straight" function call (no "the") it works. IMHO this may warrant some #+Lispworks (If omission is inherent to LW) or #+SBCL (if this is a SBCL feature) blocks here. . . Let me know how I can be of assistance in submitting or testing code that can remove this issue from future releases. Matt From marijnh at gmail.com Mon Feb 4 07:54:47 2008 From: marijnh at gmail.com (Marijn Haverbeke) Date: Mon, 4 Feb 2008 08:54:47 +0100 Subject: [postmodern-devel] Possible bug/Lispworks incompatibility on function type discriminator In-Reply-To: <000001c866f2$a21c94c0$3301a8c0@seaviewrange.com> References: <1201118759.6570.21.camel@localhost.localdomain> <000001c866f2$a21c94c0$3301a8c0@seaviewrange.com> Message-ID: Hey Matt, I'm not testing with LispWorks myself, and no one had reported this before, but it seems that just removing the 'the' form is an acceptable fix. A patch has been added to the repo, so this should no longer appear in the next version. Cheers, Marijn On Feb 4, 2008 6:56 AM, Matt.Lamari wrote: > > Found in 1.03, and it's still in 1.05: > > File protocol.lisp > > Look for the line: > > (funcall (the (function (stream (unsigned-byte 32)) t) (field-interpreter > field)) > > Lispworks (5.02 Win32 in my test; but nothing win32-specific here) complains > of inability to use a call signature function specifier. I.e. I think you > can say (the function f) but not (the (function integer) f). I believe > specifying a function to this degree is unsupported in lispworks. I could > be wrong; but this stops doquery from working, and when I change the code to > a "straight" function call (no "the") it works. > > IMHO this may warrant some #+Lispworks (If omission is inherent to LW) or > #+SBCL (if this is a SBCL feature) blocks here. . . > > Let me know how I can be of assistance in submitting or testing code that > can remove this issue from future releases. > > Matt > > > _______________________________________________ > postmodern-devel mailing list > postmodern-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel > From peter.eddy at gmail.com Sun Feb 10 18:28:09 2008 From: peter.eddy at gmail.com (Peter Eddy) Date: Sun, 10 Feb 2008 13:28:09 -0500 Subject: [postmodern-devel] Using postgresql's default option for column values Message-ID: <5aea26870802101028t61a9b221he5e470ad24a27a8f@mail.gmail.com> Hi, new postmodern user here. I'd like to be able to use postgresql's 'default' column value feature instead of an :initform in deftable. Is that possible? I haven't had any luck getting it to work. I have a couple of reasons for wanting to do this, first I have several tables that get their primary keys from a single postgresql sequence, e.g.: create table fooA ( id int8 default nextval( 'id_source' ) primary key, ... ) create table fooB ( id int8 default nextval( 'id_source' ) primary key, ... ) Additionally, other table columns use the 'default' option to create creation time stamps and so forth. I can't remove these options from the table definitions because that would break the other applications that use the database. So, what I'm really after is the ability to define fields with deftable so that those fields are not initialized by (make-instance) but read into the dao after creation, similarly to how auto-id appears to work. I looked through the archives but didn't see anything that looked related to this. thanks, Peter From marijnh at gmail.com Sun Feb 10 19:04:08 2008 From: marijnh at gmail.com (Marijn Haverbeke) Date: Sun, 10 Feb 2008 20:04:08 +0100 Subject: [postmodern-devel] Using postgresql's default option for column values In-Reply-To: <5aea26870802101028t61a9b221he5e470ad24a27a8f@mail.gmail.com> References: <5aea26870802101028t61a9b221he5e470ad24a27a8f@mail.gmail.com> Message-ID: Hello Peter, Your problem sounds entirely valid... however, I do not see a straightforward way to make the DAO classes support this in a particularly elegant way. In some cases, you can just give the fields an :initform like (query (:select (:nextval 'my-sequence))). This has the disadvantage of generating extra queries whenever you create a dao object. If you think it would be useful, I can add some exception to the save-dao code to make sure it does not try to save slots that are unbound -- that way you could just not initialise the fields that have default values, and wait until insert time for them to get a value. Of course, if you need access to these values before saving the record, this will not help. Let me know what you think. Marijn On Feb 10, 2008 7:28 PM, Peter Eddy wrote: > Hi, new postmodern user here. > > I'd like to be able to use postgresql's 'default' column value feature > instead of an :initform in deftable. Is that possible? I haven't had > any luck getting it to work. > > I have a couple of reasons for wanting to do this, first I have > several tables that get their primary keys from a single postgresql > sequence, e.g.: > > create table fooA ( id int8 default nextval( 'id_source' ) primary key, ... ) > > create table fooB ( id int8 default nextval( 'id_source' ) primary key, ... ) > > > Additionally, other table columns use the 'default' option to create > creation time stamps and so forth. > > I can't remove these options from the table definitions because that > would break the other applications that use the database. > > So, what I'm really after is the ability to define fields with > deftable so that those fields are not initialized by (make-instance) > but read into the dao after creation, similarly to how auto-id appears > to work. > > I looked through the archives but didn't see anything that looked > related to this. > > thanks, > Peter > _______________________________________________ > postmodern-devel mailing list > postmodern-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel > From peter.eddy at gmail.com Sun Feb 10 23:47:55 2008 From: peter.eddy at gmail.com (Peter Eddy) Date: Sun, 10 Feb 2008 18:47:55 -0500 Subject: [postmodern-devel] Using postgresql's default option for column values In-Reply-To: References: <5aea26870802101028t61a9b221he5e470ad24a27a8f@mail.gmail.com> Message-ID: <5aea26870802101547s5bec3205w802c681cc776caa0@mail.gmail.com> Hi Marijn, I think an option to not try to save unbound slots would solve my problem perfectly. In the mean time I'll use your :initform query suggestion. We have a very 'involved' DBA on this project and I'm not sure that this double-querying will be acceptable to her in the long run, but it'll certainly be fine for the development DB. So, no great urgency. Thanks very much! - Peter On Feb 10, 2008 2:04 PM, Marijn Haverbeke wrote: > particularly elegant way. In some cases, you can just give the fields > an :initform like (query (:select (:nextval 'my-sequence))). This has > the disadvantage of generating extra queries whenever you create a dao > object. If you think it would be useful, I can add some exception to > the save-dao code to make sure it does not try to save slots that are > unbound -- that way you could just not initialise the fields that > have default values, and wait until insert time for them to get a > value. Of course, if you need access to these values before saving the > record, this will not help. From drewc at tech.coop Mon Feb 11 20:38:43 2008 From: drewc at tech.coop (Drew Crampsie) Date: Mon, 11 Feb 2008 12:38:43 -0800 Subject: [postmodern-devel] Using postgresql's default option for column values In-Reply-To: <5aea26870802101028t61a9b221he5e470ad24a27a8f@mail.gmail.com> References: <5aea26870802101028t61a9b221he5e470ad24a27a8f@mail.gmail.com> Message-ID: On 10/02/2008, Peter Eddy wrote: > Hi, new postmodern user here. > > I'd like to be able to use postgresql's 'default' column value feature > instead of an :initform in deftable. Is that possible? I haven't had > any luck getting it to work. I use a trick to do this in some older software. It would be quite trivial to make in work in postmodern. Basically, the idea is to get the actual default value expression from the system tables and run a SELECT on it. This code is postrgresql, but it should be trivial to modify for postmodern. (defun set-default-values (model) (labels ((sym->sql (sym) (string-downcase (substitute #\_ #\- (string sym)))) (get-def (slot) (caar (query (format nil " SELECT DISTINCT adsrc FROM pg_attrdef join pg_attribute on attnum = adnum WHERE adrelid = (select oid from pg_class where relname = '~A') AND attname = '~A'" (sym->sql (class-name (class-of model))) (sym->sql slot))))) (get-default-value (slot) (let ((def (get-def slot))) (if def (caar (query (format nil "SELECT ~A" def))))))) (dolist (slot (list-slots model)) (when (and (primary-key-p model slot) (or (not (slot-boundp model slot)) (equal (slot-value model slot) nil))) (setf (slot-value model slot) (get-default-value slot)) (when (and (primary-key-p model slot) (not (slot-value model slot)) (error "No default value for primary key : ~A" slot)))))) model) have used this without problems for over 4 years. Cheers, drewc > > I have a couple of reasons for wanting to do this, first I have > several tables that get their primary keys from a single postgresql > sequence, e.g.: > > create table fooA ( id int8 default nextval( 'id_source' ) primary key, ... ) > > create table fooB ( id int8 default nextval( 'id_source' ) primary key, ... ) > > > Additionally, other table columns use the 'default' option to create > creation time stamps and so forth. > > I can't remove these options from the table definitions because that > would break the other applications that use the database. > > So, what I'm really after is the ability to define fields with > deftable so that those fields are not initialized by (make-instance) > but read into the dao after creation, similarly to how auto-id appears > to work. > > I looked through the archives but didn't see anything that looked > related to this. > > thanks, > Peter > _______________________________________________ > postmodern-devel mailing list > postmodern-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel > From marijnh at gmail.com Mon Feb 11 22:11:49 2008 From: marijnh at gmail.com (Marijn Haverbeke) Date: Mon, 11 Feb 2008 23:11:49 +0100 Subject: [postmodern-devel] Using postgresql's default option for column values In-Reply-To: <5aea26870802101547s5bec3205w802c681cc776caa0@mail.gmail.com> References: <5aea26870802101028t61a9b221he5e470ad24a27a8f@mail.gmail.com> <5aea26870802101547s5bec3205w802c681cc776caa0@mail.gmail.com> Message-ID: Hey Peter, Attached is a patch that will make it possible to pass a (:skip-unbound t) option to defclass, which will make the insert-dao method for that class check for unbound slots when it inserts a new record. You'll have to pull the repository and apply it with 'darcs apply' if you want to use it. I'm rather doubting whether I want to include it in the main repository -- defclass is already an extravaganza of crazy macroism as it is, and this change is just a piece of duct tape around the general issues that it has. I'm hoping to simplify and generalise some of its functionality with a metaclass and some MOP magic, but I haven't gotten around to that yet. So consider this patch a temporary solution. Drew's trick also looks nice, only it introduces even more queries at object-creation time. I will probably end up adding :sql-default slot options to defclass, which act like :initforms, but contain s-sql expressions instead. That way, table creation can add the proper defaults to the fields, and the object initializer can pull in all the default values in one go. Regards, Marijn On Feb 11, 2008 12:47 AM, Peter Eddy wrote: > Hi Marijn, > > I think an option to not try to save unbound slots would solve my > problem perfectly. In the mean time I'll use your :initform query > suggestion. We have a very 'involved' DBA on this project and I'm not > sure that this double-querying will be acceptable to her in the long > run, but it'll certainly be fine for the development DB. So, no great > urgency. > > Thanks very much! > > - Peter > > On Feb 10, 2008 2:04 PM, Marijn Haverbeke wrote: > > particularly elegant way. In some cases, you can just give the fields > > an :initform like (query (:select (:nextval 'my-sequence))). This has > > the disadvantage of generating extra queries whenever you create a dao > > object. If you think it would be useful, I can add some exception to > > the save-dao code to make sure it does not try to save slots that are > > unbound -- that way you could just not initialise the fields that > > have default values, and wait until insert time for them to get a > > value. Of course, if you need access to these values before saving the > > record, this will not help. > > _______________________________________________ > postmodern-devel mailing list > postmodern-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel > -------------- next part -------------- A non-text attachment was scrubbed... Name: skip-unbound.patch Type: text/x-diff Size: 8993 bytes Desc: not available URL: From peter.eddy at gmail.com Tue Feb 12 01:11:44 2008 From: peter.eddy at gmail.com (Peter Eddy) Date: Mon, 11 Feb 2008 20:11:44 -0500 Subject: [postmodern-devel] Using postgresql's default option for column values In-Reply-To: References: <5aea26870802101028t61a9b221he5e470ad24a27a8f@mail.gmail.com> <5aea26870802101547s5bec3205w802c681cc776caa0@mail.gmail.com> Message-ID: <5aea26870802111711q5b82e11fk63acf8d601eaa08c@mail.gmail.com> Thank you Marijn and Drew, very much appreciated! 2008/2/11 Marijn Haverbeke : > Hey Peter, > > Attached is a patch that will make it possible to pass a > (:skip-unbound t) option to defclass, which will make the insert-dao > method for that class check for unbound slots when it inserts a new > record. You'll have to pull the repository and apply it with 'darcs > apply' if you want to use it. I'm rather doubting whether I want to > include it in the main repository -- defclass is already an > extravaganza of crazy macroism as it is, and this change is just a > piece of duct tape around the general issues that it has. I'm hoping > to simplify and generalise some of its functionality with a metaclass > and some MOP magic, but I haven't gotten around to that yet. > > So consider this patch a temporary solution. Drew's trick also looks > nice, only it introduces even more queries at object-creation time. I > will probably end up adding :sql-default slot options to defclass, > which act like :initforms, but contain s-sql expressions instead. That > way, table creation can add the proper defaults to the fields, and the > object initializer can pull in all the default values in one go. > > Regards, > Marijn > > > > On Feb 11, 2008 12:47 AM, Peter Eddy wrote: > > Hi Marijn, > > > > I think an option to not try to save unbound slots would solve my > > problem perfectly. In the mean time I'll use your :initform query > > suggestion. We have a very 'involved' DBA on this project and I'm not > > sure that this double-querying will be acceptable to her in the long > > run, but it'll certainly be fine for the development DB. So, no great > > urgency. > > > > Thanks very much! > > > > - Peter > > > > On Feb 10, 2008 2:04 PM, Marijn Haverbeke wrote: > > > particularly elegant way. In some cases, you can just give the fields > > > an :initform like (query (:select (:nextval 'my-sequence))). This has > > > the disadvantage of generating extra queries whenever you create a dao > > > object. If you think it would be useful, I can add some exception to > > > the save-dao code to make sure it does not try to save slots that are > > > unbound -- that way you could just not initialise the fields that > > > have default values, and wait until insert time for them to get a > > > value. Of course, if you need access to these values before saving the > > > record, this will not help. > > > > > _______________________________________________ > > postmodern-devel mailing list > > postmodern-devel at common-lisp.net > > http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel > > > > _______________________________________________ > postmodern-devel mailing list > postmodern-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel > > From larsnostdal at gmail.com Tue Feb 26 10:19:56 2008 From: larsnostdal at gmail.com (=?UTF-8?Q?Lars_Rune_N=C3=B8stdal?=) Date: Tue, 26 Feb 2008 11:19:56 +0100 Subject: [postmodern-devel] problem with a patch `integer-reader' Message-ID: Hi, It seems the patch "Sun Nov 11 17:31:19 CET 2007 attila.lendvai at gmail.com" is causing some problems when compiling Postmodern on SBCL. As soon as I unpull the patch using darcs the problem goes away and Postmodern compiles. I tried both SBCL-1.0.12 and latest SBCL from CVS -- same problem: CL-USER> (require :postmodern) .. .. ; compiling file "/home/lars/programming/lisp/postmodern/cl-postgres/protocol.lisp" (written 26 FEB 2008 11:08:47 AM): ; compiling (IN-PACKAGE :CL-POSTGRES) ; compiling (DEFINE-CONDITION PROTOCOL-ERROR ...) ; compiling (DEFMACRO MESSAGE-CASE ...) ; compiling (DEFUN READ-BYTE-DELIMITED ...) ; compiling (DEFUN GET-ERROR ...) ; compiling (DEFINE-CONDITION POSTGRESQL-WARNING ...) ; compiling (DEFUN GET-WARNING ...) ; compiling (DEFUN AUTHENTICATE ...) Here is the backtrace: The value NIL is not of type SB-C::NODE. [Condition of type TYPE-ERROR] Restarts: 0: [RETRY] Retry performing # on #. 1: [ACCEPT] Continue, treating # on # as having been successful. 2: [ABORT] Return to SLIME's top level. 3: [TERMINATE-THREAD] Terminate this thread (#) Backtrace: 0: (SB-C::NODE-HOME-LAMBDA NIL)[:EXTERNAL] 1: ((LABELS SB-C::FLOOD) # :WHERE-FROM :DEFINED :VARS (#:G251 #:G252 #:G253 #:G254 #:G255) {B3DB279}> :CLOSURE (# {B38D641}>) {C484619}>) 2: ((LABELS SB-C::FLOOD) # :WHERE-FROM :DEFINED :VARS (CL-POSTGRES::SOCKET CL-POSTGRES::USER CL-POSTGRES::PASSWORD CL-POSTGRES::DATABASE) {B363571}> :CLOSURE (# {B38D641}>) {C484649}>) 3: ((LABELS SB-C::FLOOD) # :WHERE-FROM :DEFINED :VARS NIL {B3B5E79}> :CLOSURE (# {B38D641}> # {B3639F9}> #) {C484631}>) 4: (SB-C::CLOSE-OVER # {B38D641}> # :WHERE-FROM :DEFINED :VARS NIL {B3B5E79}> :CLOSURE (# {B38D641}> # {B3639F9}> #) {C484631}> # :WHERE-FROM :DEFINED :VARS NIL {B368459}> :CLOSURE (# {B367E51}> # # #) {C484661}>) 5: (SB-C::%ADD-LAMBDA-VARS-TO-CLOSURES # :WHERE-FROM :DEFINED :VARS (CL-POSTGRES::SOCKET) {B38D7E1}>) 6: (SB-C::ADD-LAMBDA-VARS-AND-LET-VARS-TO-CLOSURES # :WHERE-FROM :DEFINED :VARS NIL {B368459}>) 7: (SB-C::PHYSENV-ANALYZE #) 8: (SB-C::COMPILE-COMPONENT #) 9: (SB-C::%COMPILE (SB-INT:NAMED-LAMBDA CL-POSTGRES::AUTHENTICATE (CL-POSTGRES::SOCKET CL-POSTGRES::USER CL-POSTGRES::PASSWORD CL-POSTGRES::DATABASE) (BLOCK CL-POSTGRES::AUTHENTICATE (LET # # # # # ...))) #)[:EXTERNAL] 10: (SB-C::FOPCOMPILE-FUNCTION (SB-INT:NAMED-LAMBDA CL-POSTGRES::AUTHENTICATE (CL-POSTGRES::SOCKET CL-POSTGRES::USER CL-POSTGRES::PASSWORD CL-POSTGRES::DATABASE) (BLOCK CL-POSTGRES::AUTHENTICATE (LET # # # # # ...))) (#1=(SB-IMPL::%DEFUN (QUOTE CL-POSTGRES::AUTHENTICATE) (SB-INT:NAMED-LAMBDA CL-POSTGRES::AUTHENTICATE # #) "Try to initiate a connection. Caller should close the socket if this raises a condition." (QUOTE NIL) (SB-C:SOURCE-LOCATION)) #2=(EVAL-WHEN (:LOAD-TOPLEVEL :EXECUTE) #1#) (PROGN (EVAL-WHEN # #) #2#) SB-C::ORIGINAL-SOURCE-START 0 7) T) 11: (SB-C::FOPCOMPILE (SB-IMPL::%DEFUN (QUOTE CL-POSTGRES::AUTHENTICATE) (SB-INT:NAMED-LAMBDA CL-POSTGRES::AUTHENTICATE (CL-POSTGRES::SOCKET CL-POSTGRES::USER CL-POSTGRES::PASSWORD CL-POSTGRES::DATABASE) (BLOCK CL-POSTGRES::AUTHENTICATE #)) "Try to initiate a connection. Caller should close the socket if this raises a condition." (QUOTE NIL) (SB-C:SOURCE-LOCATION)) (#1=(SB-IMPL::%DEFUN (QUOTE CL-POSTGRES::AUTHENTICATE) (SB-INT:NAMED-LAMBDA CL-POSTGRES::AUTHENTICATE # #) "Try to initiate a connection. Caller should close the socket if this raises a condition." (QUOTE NIL) (SB-C:SOURCE-LOCATION)) #2=(EVAL-WHEN (:LOAD-TOPLEVEL :EXECUTE) #1#) (PROGN (EVAL-WHEN # #) #2#) SB-C::ORIGINAL-SOURCE-START 0 7) NIL) 12: (SB-C::CONVERT-AND-MAYBE-COMPILE (SB-IMPL::%DEFUN (QUOTE CL-POSTGRES::AUTHENTICATE) (SB-INT:NAMED-LAMBDA CL-POSTGRES::AUTHENTICATE (CL-POSTGRES::SOCKET CL-POSTGRES::USER CL-POSTGRES::PASSWORD CL-POSTGRES::DATABASE) (BLOCK CL-POSTGRES::AUTHENTICATE #)) "Try to initiate a connection. Caller should close the socket if this raises a condition." (QUOTE NIL) (SB-C:SOURCE-LOCATION)) (#1=(SB-IMPL::%DEFUN (QUOTE CL-POSTGRES::AUTHENTICATE) (SB-INT:NAMED-LAMBDA CL-POSTGRES::AUTHENTICATE # #) "Try to initiate a connection. Caller should close the socket if this raises a condition." (QUOTE NIL) (SB-C:SOURCE-LOCATION)) #2=(EVAL-WHEN (:LOAD-TOPLEVEL :EXECUTE) #1#) (PROGN (EVAL-WHEN # #) #2#) SB-C::ORIGINAL-SOURCE-START 0 7)) 13: ((FLET SB-C::DEFAULT-PROCESSOR) (SB-IMPL::%DEFUN (QUOTE CL-POSTGRES::AUTHENTICATE) (SB-INT:NAMED-LAMBDA CL-POSTGRES::AUTHENTICATE (CL-POSTGRES::SOCKET CL-POSTGRES::USER CL-POSTGRES::PASSWORD CL-POSTGRES::DATABASE) (BLOCK CL-POSTGRES::AUTHENTICATE #)) "Try to initiate a connection. Caller should close the socket if this raises a condition." (QUOTE NIL) (SB-C:SOURCE-LOCATION))) 14: (SB-C::PROCESS-TOPLEVEL-FORM (SB-IMPL::%DEFUN (QUOTE CL-POSTGRES::AUTHENTICATE) (SB-INT:NAMED-LAMBDA CL-POSTGRES::AUTHENTICATE (CL-POSTGRES::SOCKET CL-POSTGRES::USER CL-POSTGRES::PASSWORD CL-POSTGRES::DATABASE) (BLOCK CL-POSTGRES::AUTHENTICATE #)) "Try to initiate a connection. Caller should close the socket if this raises a condition." (QUOTE NIL) (SB-C:SOURCE-LOCATION)) (#1=(EVAL-WHEN (:LOAD-TOPLEVEL :EXECUTE) (SB-IMPL::%DEFUN # # "Try to initiate a connection. Caller should close the socket if this raises a condition." # #)) (PROGN (EVAL-WHEN # #) #1#) SB-C::ORIGINAL-SOURCE-START 0 7) NIL) 15: (SB-C::PROCESS-TOPLEVEL-PROGN ((SB-IMPL::%DEFUN (QUOTE CL-POSTGRES::AUTHENTICATE) (SB-INT:NAMED-LAMBDA CL-POSTGRES::AUTHENTICATE # #) "Try to initiate a connection. Caller should close the socket if this raises a condition." (QUOTE NIL) (SB-C:SOURCE-LOCATION))) (#1=(EVAL-WHEN (:LOAD-TOPLEVEL :EXECUTE) (SB-IMPL::%DEFUN # # "Try to initiate a connection. Caller should close the socket if this raises a condition." # #)) (PROGN (EVAL-WHEN # #) #1#) SB-C::ORIGINAL-SOURCE-START 0 7) NIL) 16: (SB-C::PROCESS-TOPLEVEL-FORM (EVAL-WHEN (:LOAD-TOPLEVEL :EXECUTE) (SB-IMPL::%DEFUN (QUOTE CL-POSTGRES::AUTHENTICATE) (SB-INT:NAMED-LAMBDA CL-POSTGRES::AUTHENTICATE # #) "Try to initiate a connection. Caller should close the socket if this raises a condition." (QUOTE NIL) (SB-C:SOURCE-LOCATION))) ((PROGN (EVAL-WHEN # #) (EVAL-WHEN # #)) SB-C::ORIGINAL-SOURCE-START 0 7) NIL) 17: (SB-C::PROCESS-TOPLEVEL-PROGN ((EVAL-WHEN (:COMPILE-TOPLEVEL) (SB-C:%COMPILER-DEFUN # # T)) (EVAL-WHEN (:LOAD-TOPLEVEL :EXECUTE) (SB-IMPL::%DEFUN # # "Try to initiate a connection. Caller should close the socket if this raises a condition." # #))) ((PROGN (EVAL-WHEN # #) (EVAL-WHEN # #)) SB-C::ORIGINAL-SOURCE-START 0 7) NIL) 18: (SB-C::PROCESS-TOPLEVEL-FORM (PROGN (EVAL-WHEN (:COMPILE-TOPLEVEL) (SB-C:%COMPILER-DEFUN # # T)) (EVAL-WHEN (:LOAD-TOPLEVEL :EXECUTE) (SB-IMPL::%DEFUN # # "Try to initiate a connection. Caller should close the socket if this raises a condition." # #))) (SB-C::ORIGINAL-SOURCE-START 0 7) NIL) 19: ((FLET SB-C::DEFAULT-PROCESSOR) (DEFUN CL-POSTGRES::AUTHENTICATE (CL-POSTGRES::SOCKET CL-POSTGRES::USER CL-POSTGRES::PASSWORD CL-POSTGRES::DATABASE) "Try to initiate a connection. Caller should close the socket if this raises a condition." (LET (#) (CL-POSTGRES::STARTUP-MESSAGE CL-POSTGRES::SOCKET CL-POSTGRES::USER CL-POSTGRES::DATABASE) (FORCE-OUTPUT CL-POSTGRES::SOCKET) (LOOP #) (LOOP #) ...))) 20: (SB-C::PROCESS-TOPLEVEL-FORM (DEFUN CL-POSTGRES::AUTHENTICATE (CL-POSTGRES::SOCKET CL-POSTGRES::USER CL-POSTGRES::PASSWORD CL-POSTGRES::DATABASE) "Try to initiate a connection. Caller should close the socket if this raises a condition." (LET (#) (CL-POSTGRES::STARTUP-MESSAGE CL-POSTGRES::SOCKET CL-POSTGRES::USER CL-POSTGRES::DATABASE) (FORCE-OUTPUT CL-POSTGRES::SOCKET) (LOOP #) (LOOP #) ...)) (SB-C::ORIGINAL-SOURCE-START 0 7) NIL) 21: (SB-C::SUB-SUB-COMPILE-FILE #) 22: ((LAMBDA NIL)) 23: (SB-C::%WITH-COMPILATION-UNIT #)[:EXTERNAL] 24: (SB-C::SUB-COMPILE-FILE #) 25: (COMPILE-FILE #P"/home/lars/programming/lisp/postmodern/cl-postgres/protocol.lisp")[:EXTERNAL] -- Lars Rune N?stdal http://nostdal.org/ From marijnh at gmail.com Tue Feb 26 10:50:56 2008 From: marijnh at gmail.com (Marijn Haverbeke) Date: Tue, 26 Feb 2008 11:50:56 +0100 Subject: [postmodern-devel] problem with a patch `integer-reader' In-Reply-To: References: Message-ID: Hello Lars, For now, I can not find or reproduce your problem on SBCL 1.0.14. I take it you have removed your fasl files before re-compiling? To my (untrained) eyes, the backtrace is pretty much useless, and the error message makes it sound like some kind of internal compiler error -- searching the web for it only yields a single hit discussing an old SBCL bug. Are you on an uncommon platform? (I think me and Attila both use Linux.) Regards, Marijn 2008/2/26 Lars Rune N?stdal : > Hi, > It seems the patch "Sun Nov 11 17:31:19 CET 2007 > attila.lendvai at gmail.com" is causing some problems when compiling > Postmodern on SBCL. As soon as I unpull the patch using darcs the > problem goes away and Postmodern compiles. I tried both SBCL-1.0.12 > and latest SBCL from CVS -- same problem: > > CL-USER> (require :postmodern) > .. > .. > ; compiling file > "/home/lars/programming/lisp/postmodern/cl-postgres/protocol.lisp" > (written 26 FEB 2008 11:08:47 AM): > ; compiling (IN-PACKAGE :CL-POSTGRES) > ; compiling (DEFINE-CONDITION PROTOCOL-ERROR ...) > ; compiling (DEFMACRO MESSAGE-CASE ...) > ; compiling (DEFUN READ-BYTE-DELIMITED ...) > ; compiling (DEFUN GET-ERROR ...) > ; compiling (DEFINE-CONDITION POSTGRESQL-WARNING ...) > ; compiling (DEFUN GET-WARNING ...) > ; compiling (DEFUN AUTHENTICATE ...) > > > Here is the backtrace: > > > The value NIL is not of type SB-C::NODE. > [Condition of type TYPE-ERROR] > > Restarts: > 0: [RETRY] Retry performing # on > #. > 1: [ACCEPT] Continue, treating # on > # as having been successful. > 2: [ABORT] Return to SLIME's top level. > 3: [TERMINATE-THREAD] Terminate this thread (#) > > Backtrace: > 0: (SB-C::NODE-HOME-LAMBDA NIL)[:EXTERNAL] > 1: ((LABELS SB-C::FLOOD) # :%SOURCE-NAME SB-C::.ANONYMOUS. :%DEBUG-NAME (SB-C::TL-XEP > CL-POSTGRES::AUTHENTICATE) :KIND :EXTERNAL :TYPE > # :WHERE-FROM > :DEFINED :VARS (#:G251 #:G252 #:G253 #:G254 #:G255) {B3DB279}> > :CLOSURE (# # {B38D641}>) > {C484619}>) > 2: ((LABELS SB-C::FLOOD) # :%SOURCE-NAME CL-POSTGRES::AUTHENTICATE :%DEBUG-NAME NIL :KIND NIL > :TYPE # :WHERE-FROM :DEFINED :VARS > (CL-POSTGRES::SOCKET CL-POSTGRES::USER CL-POSTGRES::PASSWORD > CL-POSTGRES::DATABASE) {B363571}> :CLOSURE (# :%SOURCE-NAME CL-POSTGRES::SOCKET :TYPE # STREAM (read-only)> {B38D641}>) {C484649}>) > 3: ((LABELS SB-C::FLOOD) # :%SOURCE-NAME #1=#:G245 :%DEBUG-NAME (LABELS #1#) :KIND NIL :TYPE > # :WHERE-FROM :DEFINED :VARS NIL > {B3B5E79}> :CLOSURE (# CL-POSTGRES::SOCKET :TYPE # (read-only)> {B38D641}> # CL-POSTGRES::PARAMETERS :TYPE # HASH-TABLE> {B3639F9}> # CL-POSTGRES::SOCKET {B363399}>) {C484631}>) > 4: (SB-C::CLOSE-OVER # CL-POSTGRES::SOCKET :TYPE # (read-only)> {B38D641}> # :%SOURCE-NAME #1=#:G245 :%DEBUG-NAME (LABELS #1#) :KIND NIL :TYPE > # :WHERE-FROM :DEFINED :VARS NIL > {B3B5E79}> :CLOSURE (# CL-POSTGRES::SOCKET :TYPE # (read-only)> {B38D641}> # CL-POSTGRES::PARAMETERS :TYPE # HASH-TABLE> {B3639F9}> # CL-POSTGRES::SOCKET {B363399}>) {C484631}> # # :KIND NIL :TYPE # :WHERE-FROM > :DEFINED :VARS NIL {B368459}> :CLOSURE (# :%SOURCE-NAME #:G206 :TYPE # (read-only)> {B367E51}> # CL-POSTGRES::PASSWORD {B363449}> # CL-POSTGRES::USER {B3633F1}> # CL-POSTGRES::SOCKET {B363399}>) {C484661}>) > 5: (SB-C::%ADD-LAMBDA-VARS-TO-CLOSURES # CL-POSTGRES::READ-UINT4 :%DEBUG-NAME NIL :KIND :LET :TYPE > # :WHERE-FROM > :DEFINED :VARS (CL-POSTGRES::SOCKET) {B38D7E1}>) > 6: (SB-C::ADD-LAMBDA-VARS-AND-LET-VARS-TO-CLOSURES # :%SOURCE-NAME #1=#:G209 :%DEBUG-NAME (LABELS #1#) :KIND NIL :TYPE > # > :WHERE-FROM :DEFINED :VARS NIL {B368459}>) > 7: (SB-C::PHYSENV-ANALYZE # SB-IMPL::ANSI-STREAM-P {B4FB671}>) > 8: (SB-C::COMPILE-COMPONENT # SB-IMPL::ANSI-STREAM-P {B4FB671}>) > 9: (SB-C::%COMPILE (SB-INT:NAMED-LAMBDA CL-POSTGRES::AUTHENTICATE > (CL-POSTGRES::SOCKET CL-POSTGRES::USER CL-POSTGRES::PASSWORD > CL-POSTGRES::DATABASE) (BLOCK CL-POSTGRES::AUTHENTICATE (LET # # # # # > ...))) # "/home/lars/programming/lisp/postmodern/cl-postgres/protocol.fasl">)[:EXTERNAL] > 10: (SB-C::FOPCOMPILE-FUNCTION (SB-INT:NAMED-LAMBDA > CL-POSTGRES::AUTHENTICATE (CL-POSTGRES::SOCKET CL-POSTGRES::USER > CL-POSTGRES::PASSWORD CL-POSTGRES::DATABASE) (BLOCK > CL-POSTGRES::AUTHENTICATE (LET # # # # # ...))) (#1=(SB-IMPL::%DEFUN > (QUOTE CL-POSTGRES::AUTHENTICATE) (SB-INT:NAMED-LAMBDA > CL-POSTGRES::AUTHENTICATE # #) "Try to initiate a connection. Caller > should close the socket if > this raises a condition." (QUOTE NIL) (SB-C:SOURCE-LOCATION)) > #2=(EVAL-WHEN (:LOAD-TOPLEVEL :EXECUTE) #1#) (PROGN (EVAL-WHEN # #) > #2#) SB-C::ORIGINAL-SOURCE-START 0 7) T) > 11: (SB-C::FOPCOMPILE (SB-IMPL::%DEFUN (QUOTE > CL-POSTGRES::AUTHENTICATE) (SB-INT:NAMED-LAMBDA > CL-POSTGRES::AUTHENTICATE (CL-POSTGRES::SOCKET CL-POSTGRES::USER > CL-POSTGRES::PASSWORD CL-POSTGRES::DATABASE) (BLOCK > CL-POSTGRES::AUTHENTICATE #)) "Try to initiate a connection. Caller > should close the socket if > this raises a condition." (QUOTE NIL) (SB-C:SOURCE-LOCATION)) > (#1=(SB-IMPL::%DEFUN (QUOTE CL-POSTGRES::AUTHENTICATE) > (SB-INT:NAMED-LAMBDA CL-POSTGRES::AUTHENTICATE # #) "Try to initiate a > connection. Caller should close the socket if > this raises a condition." (QUOTE NIL) (SB-C:SOURCE-LOCATION)) > #2=(EVAL-WHEN (:LOAD-TOPLEVEL :EXECUTE) #1#) (PROGN (EVAL-WHEN # #) > #2#) SB-C::ORIGINAL-SOURCE-START 0 7) NIL) > 12: (SB-C::CONVERT-AND-MAYBE-COMPILE (SB-IMPL::%DEFUN (QUOTE > CL-POSTGRES::AUTHENTICATE) (SB-INT:NAMED-LAMBDA > CL-POSTGRES::AUTHENTICATE (CL-POSTGRES::SOCKET CL-POSTGRES::USER > CL-POSTGRES::PASSWORD CL-POSTGRES::DATABASE) (BLOCK > CL-POSTGRES::AUTHENTICATE #)) "Try to initiate a connection. Caller > should close the socket if > this raises a condition." (QUOTE NIL) (SB-C:SOURCE-LOCATION)) > (#1=(SB-IMPL::%DEFUN (QUOTE CL-POSTGRES::AUTHENTICATE) > (SB-INT:NAMED-LAMBDA CL-POSTGRES::AUTHENTICATE # #) "Try to initiate a > connection. Caller should close the socket if > this raises a condition." (QUOTE NIL) (SB-C:SOURCE-LOCATION)) > #2=(EVAL-WHEN (:LOAD-TOPLEVEL :EXECUTE) #1#) (PROGN (EVAL-WHEN # #) > #2#) SB-C::ORIGINAL-SOURCE-START 0 7)) > 13: ((FLET SB-C::DEFAULT-PROCESSOR) (SB-IMPL::%DEFUN (QUOTE > CL-POSTGRES::AUTHENTICATE) (SB-INT:NAMED-LAMBDA > CL-POSTGRES::AUTHENTICATE (CL-POSTGRES::SOCKET CL-POSTGRES::USER > CL-POSTGRES::PASSWORD CL-POSTGRES::DATABASE) (BLOCK > CL-POSTGRES::AUTHENTICATE #)) "Try to initiate a connection. Caller > should close the socket if > this raises a condition." (QUOTE NIL) (SB-C:SOURCE-LOCATION))) > 14: (SB-C::PROCESS-TOPLEVEL-FORM (SB-IMPL::%DEFUN (QUOTE > CL-POSTGRES::AUTHENTICATE) (SB-INT:NAMED-LAMBDA > CL-POSTGRES::AUTHENTICATE (CL-POSTGRES::SOCKET CL-POSTGRES::USER > CL-POSTGRES::PASSWORD CL-POSTGRES::DATABASE) (BLOCK > CL-POSTGRES::AUTHENTICATE #)) "Try to initiate a connection. Caller > should close the socket if > this raises a condition." (QUOTE NIL) (SB-C:SOURCE-LOCATION)) > (#1=(EVAL-WHEN (:LOAD-TOPLEVEL :EXECUTE) (SB-IMPL::%DEFUN # # "Try to > initiate a connection. Caller should close the socket if > this raises a condition." # #)) (PROGN (EVAL-WHEN # #) #1#) > SB-C::ORIGINAL-SOURCE-START 0 7) NIL) > 15: (SB-C::PROCESS-TOPLEVEL-PROGN ((SB-IMPL::%DEFUN (QUOTE > CL-POSTGRES::AUTHENTICATE) (SB-INT:NAMED-LAMBDA > CL-POSTGRES::AUTHENTICATE # #) "Try to initiate a connection. Caller > should close the socket if > this raises a condition." (QUOTE NIL) (SB-C:SOURCE-LOCATION))) > (#1=(EVAL-WHEN (:LOAD-TOPLEVEL :EXECUTE) (SB-IMPL::%DEFUN # # "Try to > initiate a connection. Caller should close the socket if > this raises a condition." # #)) (PROGN (EVAL-WHEN # #) #1#) > SB-C::ORIGINAL-SOURCE-START 0 7) NIL) > 16: (SB-C::PROCESS-TOPLEVEL-FORM (EVAL-WHEN (:LOAD-TOPLEVEL :EXECUTE) > (SB-IMPL::%DEFUN (QUOTE CL-POSTGRES::AUTHENTICATE) > (SB-INT:NAMED-LAMBDA CL-POSTGRES::AUTHENTICATE # #) "Try to initiate a > connection. Caller should close the socket if > this raises a condition." (QUOTE NIL) (SB-C:SOURCE-LOCATION))) > ((PROGN (EVAL-WHEN # #) (EVAL-WHEN # #)) SB-C::ORIGINAL-SOURCE-START 0 > 7) NIL) > 17: (SB-C::PROCESS-TOPLEVEL-PROGN ((EVAL-WHEN (:COMPILE-TOPLEVEL) > (SB-C:%COMPILER-DEFUN # # T)) (EVAL-WHEN (:LOAD-TOPLEVEL :EXECUTE) > (SB-IMPL::%DEFUN # # "Try to initiate a connection. Caller should > close the socket if > this raises a condition." # #))) ((PROGN (EVAL-WHEN # #) > (EVAL-WHEN # #)) SB-C::ORIGINAL-SOURCE-START 0 7) NIL) > 18: (SB-C::PROCESS-TOPLEVEL-FORM (PROGN (EVAL-WHEN > (:COMPILE-TOPLEVEL) (SB-C:%COMPILER-DEFUN # # T)) (EVAL-WHEN > (:LOAD-TOPLEVEL :EXECUTE) (SB-IMPL::%DEFUN # # "Try to initiate a > connection. Caller should close the socket if > this raises a condition." # #))) (SB-C::ORIGINAL-SOURCE-START 0 7) NIL) > 19: ((FLET SB-C::DEFAULT-PROCESSOR) (DEFUN CL-POSTGRES::AUTHENTICATE > (CL-POSTGRES::SOCKET CL-POSTGRES::USER CL-POSTGRES::PASSWORD > CL-POSTGRES::DATABASE) "Try to initiate a connection. Caller should > close the socket if > this raises a condition." (LET (#) (CL-POSTGRES::STARTUP-MESSAGE > CL-POSTGRES::SOCKET CL-POSTGRES::USER CL-POSTGRES::DATABASE) > (FORCE-OUTPUT CL-POSTGRES::SOCKET) (LOOP #) (LOOP #) ...))) > 20: (SB-C::PROCESS-TOPLEVEL-FORM (DEFUN CL-POSTGRES::AUTHENTICATE > (CL-POSTGRES::SOCKET CL-POSTGRES::USER CL-POSTGRES::PASSWORD > CL-POSTGRES::DATABASE) "Try to initiate a connection. Caller should > close the socket if > this raises a condition." (LET (#) (CL-POSTGRES::STARTUP-MESSAGE > CL-POSTGRES::SOCKET CL-POSTGRES::USER CL-POSTGRES::DATABASE) > (FORCE-OUTPUT CL-POSTGRES::SOCKET) (LOOP #) (LOOP #) ...)) > (SB-C::ORIGINAL-SOURCE-START 0 7) NIL) > 21: (SB-C::SUB-SUB-COMPILE-FILE #) > 22: ((LAMBDA NIL)) > 23: (SB-C::%WITH-COMPILATION-UNIT #)[:EXTERNAL] > 24: (SB-C::SUB-COMPILE-FILE #) > 25: (COMPILE-FILE > #P"/home/lars/programming/lisp/postmodern/cl-postgres/protocol.lisp")[:EXTERNAL] > > -- > Lars Rune N?stdal > http://nostdal.org/ > > _______________________________________________ > postmodern-devel mailing list > postmodern-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel > > From attila.lendvai at gmail.com Tue Feb 26 11:08:05 2008 From: attila.lendvai at gmail.com (Attila Lendvai) Date: Tue, 26 Feb 2008 12:08:05 +0100 Subject: [postmodern-devel] problem with a patch `integer-reader' In-Reply-To: References: Message-ID: > For now, I can not find or reproduce your problem on SBCL 1.0.14. I > take it you have removed your fasl files before re-compiling? To my fyi, i've seen this myself, too with sbcl head on linux/x86 64. but it was coming and going, and i think it only happened when i changed some cl-postgres files which got recompiled in an image that already contained cl-postgres. but i can't reproduce it now, and i've not seen it for a while now. -- attila From attila.lendvai at gmail.com Tue Feb 26 12:49:05 2008 From: attila.lendvai at gmail.com (Attila Lendvai) Date: Tue, 26 Feb 2008 13:49:05 +0100 Subject: [postmodern-devel] Re: patches for Postmodern In-Reply-To: References: Message-ID: > Looking a bit deeper into the issue of passing values directly to > prepared statements -- one thing we'd have to do first is define some > kind of consistent interface. Right now the rules for what you may > pass in there and how they get treated are completely inconsistent. > I'm not sure how to clean this up without adding overhead or cruft, > though. the following is my mental model about the issue (which is obviously altered by the fact that i use cl-postgres as a backend for cl-rdbms): cl-postgres can send down 4 kind of values to the database: - byte vectors - strings - local-time timestamps (this one is sleazy, see below why) - numbers (this one is sleazy too, because postgresql doesn't know about rationals and converting them to double float under the hood loses precision. i'm not happy about this but it's much more practical then signaling an error and forcing the caller to deal with this all around by doing the same) if your value does not fit in any of these then you must convert it to string yourself before binding it, but it must be done in a higher abstraction layer where (sql) type information is available. an example to demonstrate it is local-time, where the lisp local-time value is used to represent three different db types (timestamp, date, time; where the latter two have constraints on various parts on the local-time value). if you don't care about asserts then you can just local-time:format-rfc3339-timestring the timestamp but it would silently drop information in case of programming errors (e.g. binding a local-time timestamp with non-utc timezone into an sql timestamp without timezone value. postgresql silently ignores the timezone info when doing this). the relevant part of cl-rdbms that deals with this is in execute-postmodern-prepared-statement here: http://common-lisp.net/cgi-bin/darcsweb/darcsweb.cgi?r=cl-rdbms-cl-rdbms;a=headblob;f=/postgresql/postmodern-backend.lisp some tests dealing with syntax and types: http://common-lisp.net/cgi-bin/darcsweb/darcsweb.cgi?r=cl-rdbms-cl-rdbms;a=headblob;f=/tests/syntax.lisp -- attila From marijnh at gmail.com Wed Feb 27 15:39:58 2008 From: marijnh at gmail.com (Marijn Haverbeke) Date: Wed, 27 Feb 2008 16:39:58 +0100 Subject: [postmodern-devel] problem with a patch `integer-reader' In-Reply-To: References: Message-ID: For now, I have removed the inline declaration for the integer readers from the repository, since they seem to be what causes this. Most likely, the problem is with SBCL, not our code, but since I am unable to reproduce the issue I can not say for sure. Marijn