From andy at chicagobikepolo.com Wed May 5 18:29:38 2010 From: andy at chicagobikepolo.com (Andrew Golding) Date: Wed, 05 May 2010 13:29:38 -0500 Subject: [postmodern-devel] cl-postgres/sbcl crashes with bogus stack frame In-Reply-To: b54b34af0905180414h397a134y574c3c4b2f3a6f4a@mail.gmail.com Message-ID: <1273084178.13285.9.camel@andy-laptop> Since SBCL 1.0.26 or so, there's been a sanity check in interrupt handling that ensures that all signals in a set are either blocked or unblocked. This check is dumping SBCL into LDB, and here's why: Postgresql's libpq will block sigpipe for its own reasons. When another interrupt is signaled during a query (PQexec or PQsendQuery), SBCL has to decide what to do about the interrupt, whether to handle it or not. What winds up happening though is that the sanity check runs and sees that signal 13 is blocked, while the rest of the set of "deferrable" signals are not. It does not expect this, freaks out, and you get dumped into LDB. To get around it, calls to PQexec need to get wrapped in sb-thread::block-deferrable-signals and sb-unix::unblock-deferrable-signals for now. It's a bummer, as potentially useful signals like sigint and sigalrm will get blocked. I'm also going to try a patched sbcl that allows sbcl to tell the sanity check to ignore checking certain blocked signals, which isn't the best solution, but it's the quick and dirty solution I thought up. Hopefully future SBCLs will play nice with shared object library functions, but only time will tell. Regards, Andrew Golding From patrick.may at mac.com Thu May 6 17:25:27 2010 From: patrick.may at mac.com (Patrick May) Date: Thu, 06 May 2010 13:25:27 -0400 Subject: [postmodern-devel] NIL interpreted as Boolean Message-ID: <8F9A76EB-9392-49E6-8F53-DB6E693AA742@mac.com> 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: From lispnik at gmail.com Thu May 6 17:27:23 2010 From: lispnik at gmail.com (Ivan Boldyrev) Date: Fri, 7 May 2010 00:27:23 +0700 Subject: [postmodern-devel] NIL interpreted as Boolean In-Reply-To: <8F9A76EB-9392-49E6-8F53-DB6E693AA742@mac.com> References: <8F9A76EB-9392-49E6-8F53-DB6E693AA742@mac.com> Message-ID: On Fri, May 7, 2010 at 12:25 AM, Patrick May wrote: > ? ? ? ?How do I make Postmodern interpret nil as db-null rather than boolean? Use :null, Luke. -- Ivan Boldyrev From patrick.may at mac.com Thu May 6 17:34:49 2010 From: patrick.may at mac.com (Patrick May) Date: Thu, 06 May 2010 13:34:49 -0400 Subject: [postmodern-devel] NIL interpreted as Boolean In-Reply-To: References: <8F9A76EB-9392-49E6-8F53-DB6E693AA742@mac.com> Message-ID: <8EE6D981-8E4A-4247-943F-137C317A47A5@mac.com> On May 6, 2010, at 1:27 PM, Ivan Boldyrev wrote: > On Fri, May 7, 2010 at 12:25 AM, Patrick May wrote: >> How do I make Postmodern interpret nil as db-null rather than boolean? > > Use :null, Luke. I tried :initform :null as well, but it gave the error: The value :NULL, derived from the initform :NULL, can not be used to set the value of the slot CALL-TIME in #, because it is not of type (OR NULL SIMPLE-DATE:TIMESTAMP). [Condition of type CCL::BAD-SLOT-TYPE-FROM-INITFORM] Thanks, Patrick -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2421 bytes Desc: not available URL: From patrick.may at mac.com Thu May 6 18:30:35 2010 From: patrick.may at mac.com (Patrick May) Date: Thu, 06 May 2010 14:30:35 -0400 Subject: [postmodern-devel] NIL interpreted as Boolean In-Reply-To: <8EE6D981-8E4A-4247-943F-137C317A47A5@mac.com> References: <8F9A76EB-9392-49E6-8F53-DB6E693AA742@mac.com> <8EE6D981-8E4A-4247-943F-137C317A47A5@mac.com> Message-ID: <9F4B007D-CE00-46EF-AAE4-1FDCC496C230@mac.com> On May 6, 2010, at 1:34 PM, Patrick May wrote: > On May 6, 2010, at 1:27 PM, Ivan Boldyrev wrote: >> On Fri, May 7, 2010 at 12:25 AM, Patrick May wrote: >>> How do I make Postmodern interpret nil as db-null rather than boolean? >> >> Use :null, Luke. > > I tried :initform :null as well, but it gave the error: > > The value :NULL, derived from the initform :NULL, can not be used to set the value of the slot CALL-TIME in #, because it is not of type (OR > NULL > SIMPLE-DATE:TIMESTAMP). > [Condition of type CCL::BAD-SLOT-TYPE-FROM-INITFORM] Removing the :type specifiers from the class definitions eliminates the problem. It would be nice if Postmodern allowed both :type and :col-type to be used, though. Regards, Patrick -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2421 bytes Desc: not available URL: From daniel at whitehouse.id.au Thu May 6 18:28:13 2010 From: daniel at whitehouse.id.au (Daniel White) Date: Fri, 7 May 2010 04:28:13 +1000 Subject: [postmodern-devel] NIL interpreted as Boolean In-Reply-To: <8EE6D981-8E4A-4247-943F-137C317A47A5@mac.com> References: <8F9A76EB-9392-49E6-8F53-DB6E693AA742@mac.com> <8EE6D981-8E4A-4247-943F-137C317A47A5@mac.com> Message-ID: On Fri, May 7, 2010 at 3:34 AM, Patrick May wrote: > On May 6, 2010, at 1:27 PM, Ivan Boldyrev wrote: >> On Fri, May 7, 2010 at 12:25 AM, Patrick May wrote: >>> ? ? ? ?How do I make Postmodern interpret nil as db-null rather than boolean? >> >> Use :null, Luke. > > ? ? ? ?I tried :initform :null as well, but it gave the error: > > because it is not of type (OR NULL SIMPLE-DATE:TIMESTAMP). There is your problem right there. In your class declaration, you probably should have: > :type (or db-null simple-date:timestamp Cheers, -- Daniel White From lispnik at gmail.com Thu May 6 17:47:48 2010 From: lispnik at gmail.com (Ivan Boldyrev) Date: Fri, 7 May 2010 00:47:48 +0700 Subject: [postmodern-devel] NIL interpreted as Boolean In-Reply-To: <8EE6D981-8E4A-4247-943F-137C317A47A5@mac.com> References: <8F9A76EB-9392-49E6-8F53-DB6E693AA742@mac.com> <8EE6D981-8E4A-4247-943F-137C317A47A5@mac.com> Message-ID: On Fri, May 7, 2010 at 12:34 AM, Patrick May wrote: > ? ? ? ?I tried :initform :null as well, but it gave the error: > > The value :NULL, derived from the initform :NULL, can not be used to set the value of the slot CALL-TIME in #, because it is not of type (OR > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? NULL > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? SIMPLE-DATE:TIMESTAMP). Change type of the field to (or (eql :null) simple-date:timestamp) -- Ivan Boldyrev From patrick.may at mac.com Thu May 6 18:43:33 2010 From: patrick.may at mac.com (Patrick May) Date: Thu, 06 May 2010 14:43:33 -0400 Subject: [postmodern-devel] NIL interpreted as Boolean In-Reply-To: References: <8F9A76EB-9392-49E6-8F53-DB6E693AA742@mac.com> <8EE6D981-8E4A-4247-943F-137C317A47A5@mac.com> Message-ID: <4C05E034-3443-4F93-9713-E6C9A55242B5@mac.com> On May 6, 2010, at 1:47 PM, Ivan Boldyrev wrote: > On Fri, May 7, 2010 at 12:34 AM, Patrick May wrote: >> I tried :initform :null as well, but it gave the error: >> >> The value :NULL, derived from the initform :NULL, can not be used to set the value of the slot CALL-TIME in #, because it is not of type (OR >> NULL >> SIMPLE-DATE:TIMESTAMP). > > Change type of the field to > (or (eql :null) simple-date:timestamp) Perfect, thanks! Regards, Patrick -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2421 bytes Desc: not available URL: From marijnh at gmail.com Thu May 6 19:05:12 2010 From: marijnh at gmail.com (Marijn Haverbeke) Date: Thu, 6 May 2010 21:05:12 +0200 Subject: [postmodern-devel] cl-postgres/sbcl crashes with bogus stack frame In-Reply-To: <1273084178.13285.9.camel@andy-laptop> References: <1273084178.13285.9.camel@andy-laptop> Message-ID: Hey Andrew, Thanks for the information. However, Postmodern does not use libpq. It only uses foreign code when creating SSL sockets. Was this mail just a general heads-up, or did you have a problem with Postmodern corrupting stack frames? (It uses (safety 0) all over the place, so potentially it could do bad things.) Best, Marijn From andy at chicagobikepolo.com Fri May 7 16:36:25 2010 From: andy at chicagobikepolo.com (Andrew Golding) Date: Fri, 7 May 2010 11:36:25 -0500 Subject: [postmodern-devel] cl-postgres/sbcl crashes with bogus stack frame Message-ID: <2359C94F-FA77-4A36-8AD9-0AA40365C2BA@chicagobikepolo.com> Kind of a general heads-up. I have actually been using CLSQL and saw the bit in one of the older messages about getting a similar result in CLSQL. Anyways, if the foreign code messes with signal handling, even signals SBCL isn't currently using, it has the potential to crash the program. I'll try to have a look at postmodern this weekend and see if I can reproduce and solve the problem. From frgo at me.com Thu May 13 12:45:56 2010 From: frgo at me.com (Frank Goenninger) Date: Thu, 13 May 2010 14:45:56 +0200 Subject: [postmodern-devel] Compile error: about to bind S-SQL::CH to NIL, which is not of type CHARACTER. Message-ID: Hi there, being totally new to postmodern I have encountered the following problem: (Environment: AllegroCL Express Edition on Mac OS X, newest postmodern bits from github) ;;; Compiling file ;;; /opt/common-lisp/packages/postmodern/postmodern/util.lisp ; While compiling LIST-TABLES: about to bind S-SQL::CH to NIL, which is not of type CHARACTER. [Condition of type TYPE-ERROR] ... not digging into it yet, I wonder if anybody has seen this, too ... Thanks!! Regards Frank From sebyte at smolny.plus.com Fri May 14 17:53:08 2010 From: sebyte at smolny.plus.com (Sebastian Tennant) Date: Fri, 14 May 2010 17:53:08 +0000 Subject: [postmodern-devel] Passing a list to a prepared query Message-ID: Hi, I'd like to do this: (defprepared addresses-by-ids "SELECT address FROM users WHERE id IN $1" :column) and then call it like so: CLUSER> (addresses-by-ids "(1,2,3)") Is this possible? I've tried a few different approaches but keep getting errors. Many thanks for great software by the way. Seb -- Emacs' AlsaPlayer - Music Without Jolts Lightweight, full-featured and mindful of your idyllic happiness. http://home.gna.org/eap From marijnh at gmail.com Sat May 15 06:44:20 2010 From: marijnh at gmail.com (Marijn Haverbeke) Date: Sat, 15 May 2010 08:44:20 +0200 Subject: [postmodern-devel] Passing a list to a prepared query In-Reply-To: References: Message-ID: Hey Sebastian, > ?(defprepared addresses-by-ids > ? "SELECT address FROM users WHERE id IN $1" :column) > > Is this possible? ?I've tried a few different approaches but keep getting > errors. I think that Postgres doesn't allow the right-hand side of IN to be an $-parameter. Try something like this: > (defprepared addresses-by-ids > "SELECT address FROM users WHERE id = ANY($1)" :column) I think you'll still have to convert your list to a vector for cl-postgres to be able to put it in a parameter. Best, Marijn From marijnh at gmail.com Sat May 15 06:47:37 2010 From: marijnh at gmail.com (Marijn Haverbeke) Date: Sat, 15 May 2010 08:47:37 +0200 Subject: [postmodern-devel] Compile error: about to bind S-SQL::CH to NIL, which is not of type CHARACTER. In-Reply-To: References: Message-ID: Hi Frank, > about to bind S-SQL::CH to NIL, which is not of type CHARACTER. > ? [Condition of type TYPE-ERROR] This seems related to the (loop :for ch :of-type character :across str :do ...) in to-sql-name. Could it be that your ACL is a little old? I've been developing on ACL 8.0 and 8.1 lately, and never had a similar problem. Best, Marijn From frgo at me.com Sat May 15 08:21:50 2010 From: frgo at me.com (Frank Goenninger) Date: Sat, 15 May 2010 10:21:50 +0200 Subject: [postmodern-devel] Compile error: about to bind S-SQL::CH to NIL, which is not of type CHARACTER. In-Reply-To: References: Message-ID: <3C832075-18D1-40A7-BCAF-BF4091194933@me.com> Hi Marijn, Am 15.05.2010 um 08:47 schrieb Marijn Haverbeke: > Hi Frank, > >> about to bind S-SQL::CH to NIL, which is not of type CHARACTER. >> [Condition of type TYPE-ERROR] > > This seems related to the (loop :for ch :of-type character :across str > :do ...) in to-sql-name. Could it be that your ACL is a little old? Funny that you asked, because: ;-) > I've been developing on ACL 8.0 and 8.1 lately, and never had a > similar problem. It's a brand new install of ACL 8.2 Express Edition fully patched running on OS X 10.6.3. > > Best, > Marijn Thanks for helping me there. Frank From endian.sign at gmail.com Sat May 15 08:41:55 2010 From: endian.sign at gmail.com (rrl) Date: Sat, 15 May 2010 11:41:55 +0300 Subject: [postmodern-devel] Local connection to Postgresql under FreeBSD Message-ID: <20100515083929.GA8070@minerva.freedsl.mg> Hi, I can connect to Postgresql using a Unix socket with sbcl by passing :unix as a host. The problem is that under FreeBSD, the default directory for the socket is ``/tmp'' and not ``/var/run/postgresql''. Here's a quick fix that solves the problem: --- public.lisp.orig 2010-04-14 21:41:39.000000000 +0300 +++ public.lisp 2010-05-15 11:21:56.000000000 +0300 @@ -47,7 +47,9 @@ #+(and sbcl unix) (defun sb-unix-socket-connect (port) (let ((sock (make-instance 'sb-bsd-sockets:local-socket :type :stream)) - (addr (format nil "/var/run/postgresql/.s.PGSQL.~a" port))) + (addr (format nil "~a/.s.PGSQL.~a" + #-freebsd "/var/run/postgresql" #+freebsd "/tmp" + port))) (sb-bsd-sockets:socket-connect sock addr) (sb-bsd-sockets:socket-make-stream sock :input t :output t :element-type '(unsigned-byte 8)))) Maybe a better fix would be to define a variable for the socket directory and let the user set it himself. From sebyte at smolny.plus.com Sun May 16 12:34:35 2010 From: sebyte at smolny.plus.com (Sebastian Tennant) Date: Sun, 16 May 2010 12:34:35 +0000 Subject: [postmodern-devel] Passing a list to a prepared query References: Message-ID: Quoth Marijn Haverbeke : > I think that Postgres doesn't allow the right-hand side of IN to be an > $-parameter. Try something like > this: > > (defprepared addresses-by-ids > "SELECT address FROM users WHERE id = ANY($1)" :column) > > I think you'll still have to convert your list to a vector for > cl-postgres to be able to put it in a parameter. Many thanks. Seb -- Emacs' AlsaPlayer - Music Without Jolts Lightweight, full-featured and mindful of your idyllic happiness. http://home.gna.org/eap From marijnh at gmail.com Sun May 16 19:28:08 2010 From: marijnh at gmail.com (Marijn Haverbeke) Date: Sun, 16 May 2010 22:28:08 +0300 Subject: [postmodern-devel] Compile error: about to bind S-SQL::CH to NIL, which is not of type CHARACTER. In-Reply-To: <3C832075-18D1-40A7-BCAF-BF4091194933@me.com> References: <3C832075-18D1-40A7-BCAF-BF4091194933@me.com> Message-ID: > It's a brand new install of ACL 8.2 Express Edition fully patched running on OS X 10.6.3. Ah, that would also explain this. Does everything work if you just comment out the offending :of-type? Will you report the bug to Franz, or shall I do it? (Because this is definitely a bug in their implementation of loop.) Best, Marijn From marijnh at gmail.com Tue May 18 10:56:49 2010 From: marijnh at gmail.com (Marijn Haverbeke) Date: Tue, 18 May 2010 12:56:49 +0200 Subject: [postmodern-devel] Local connection to Postgresql under FreeBSD In-Reply-To: <20100515083929.GA8070@minerva.freedsl.mg> References: <20100515083929.GA8070@minerva.freedsl.mg> Message-ID: Hey, > Maybe a better fix would be to define a variable for the socket > directory and let the user set it himself. I've created an alternative patch implementing this suggestion -- the variable defaults to /tmp/ or /var/run/postgresql/ depending on #+freebsd, but user code could change it if they need another path. (see cl-postgres::*unix-socket-dir*). Best, Marijn