From marijnh at gmail.com Fri Apr 2 11:54:16 2010 From: marijnh at gmail.com (Marijn Haverbeke) Date: Fri, 2 Apr 2010 13:54:16 +0200 Subject: [postmodern-devel] Release 1.16 (and new project page url, and new version control system) Message-ID: Changes in this version: * Introduces a save-dao/transaction, because the old semantics were broken (originally inside of transactions, after fixing that outside of them). * Add support for passing vectors as argument to prepared queries, and reading them from query results. * Add :on-update and :on-delete arguments to !foreign. * Add :plist and :plists query result formats. * Guarantee that deftable definitions are executed in the order they were defined in. * Moves the ieee-floats and trivial-utf-8 dependencies into the repository, so they don't have to separately fetched. The project page is now no longer at common-lisp.net, but can instead be found at http://marijn.haverbeke.nl/postmodern . We will continue to use the common-lisp.net mailing lists. And finally, the darcs repository will no longer be updated. The new git repository lives at http://marijn.haverbeke.nl/postmodern/postmodern , and http://github.com/marijnh/Postmodern will be kept in sync with that. Best, Marijn From marijnh at gmail.com Fri Apr 2 12:15:30 2010 From: marijnh at gmail.com (Marijn Haverbeke) Date: Fri, 2 Apr 2010 14:15:30 +0200 Subject: [postmodern-devel] simple-date:day-of-week doc mismatch? In-Reply-To: <1269971783.3422.1.camel@news.danieljanus.pl> References: <1269971783.3422.1.camel@news.danieljanus.pl> Message-ID: Hey Daniel, > DB> (make-date nil nil nil) > # > DB> (day-of-week *) > 1 I was puzzled for a bit because make-date isn't in the simple-date library. But it did indeed contain that bug -- it always returned the correct answer minus one. That goes to show that in all these years, no one has actually used that function. I've pushed a fix to the (new, git) repository, but if you want a more well-designed and well-tested date library, I'd suggest local-time [1], the latest release even has cl-postgres glue included (src/integration/cl-postgres.lisp). Best, Marijn [1]: http://common-lisp.net/project/local-time/ From jpl at thoughtcrime.us Tue Apr 6 14:40:34 2010 From: jpl at thoughtcrime.us (J.P. Larocque) Date: Tue, 6 Apr 2010 07:40:34 -0700 Subject: [postmodern-devel] [patch] Erratic behavior when NIL password is given Message-ID: <20100406144032.GA7455@planetarium.thoughtcrime.us> Hi, I usually use host-based authentication with ident to connect to PostgreSQL from trusted machines, so I've been specifying a password of NIL for a long time. However, when passwordless authentication fails and NIL is given as a password, POSTMODERN:CONNECT will behave erratically. In my case, the symptoms are: * SBCL (Debian 1:1.0.18.0-2) RAM usage balloons to hundreds of megabytes. * I get this condition printed, along with a tag-along (obscure and what I assume to be) object, for the heck of it: ---8<---8<--- * (postmodern:connect "piranha" "piranha" nil "localhost") debugger invoked on a TYPE-ERROR in thread #: The value NIL is not of type (MOD 1152921504606846975). Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL. restarts (invokable by number or by possibly-abbreviated name): 0: [ABORT] Exit debugger, returning to top level. (SB-KERNEL:UB32-BASH-COPY "piranha" 0 "" NIL 7)[:EXTERNAL] --->8--->8--- That's invoking SBCL on the command-line. When I use SLIME: * SBCL, like a gas, expands to fill all available space (e.g. ~1.8GiB before I ran out of RAM+swap and rebooted the virtual machine). * During this time, nothing ever comes back to emacs. * If I do a SLIME interrupt before the system completely dies, emacs takes a while to do anything, then enters the emacs (not SLIME!) debugger, and informs me that the "variable binding depth exceeds max-specpdl-size" at every available opportunity until I restart emacs. It turns out bad things happen when you optimize for safety 0. Making this change: diff -x'*~' -urN postmodern-1.16/cl-postgres/package.lisp postmodern-1.16-no_opt/cl-postgres/package.lisp --- postmodern-1.16/cl-postgres/package.lisp 2010-04-02 04:23:24.000000000 -0700 +++ postmodern-1.16-no_opt/cl-postgres/package.lisp 2010-04-06 06:00:47.000000000 -0700 @@ -83,5 +83,5 @@ (eval-when (:compile-toplevel :load-toplevel :execute) ;; Optimization settings (only used by functions that need it). (defparameter *optimize* - '(optimize (speed 3) (safety 0) (space 1) (debug 1) + '(optimize (speed 3) (space 1) (debug 1) (compilation-speed 0)))) yields a much more sensible, instantaneous, and non-ballooning: The value NIL is not of type STRING. [Condition of type TYPE-ERROR] Of course, bad things also happen when you pass objects of the wrong type to a function. (It just never sat well with me to pass a string password when no password was needed; NIL seemed to make much more sense, and it worked...) I've attached a patch to: * Check the types of arguments given to CL-POSTGRES:OPEN-DATABASE. * Update the HTML documentation to describe the expected types of arguments to CL-POSTGRES:OPEN-DATABASE and POSTMODERN:CONNECT. * Update the documentation strings for the above two functions to contain the same content as their descriptions in the HTML documentation. I also humbly suggest not optimizing for safety 0. One of the big reasons I use CL, and not something like C, is because I value safety: when one thing breaks, that breakage is self-contained and can be tracked down due to conditions. I don't want my Lisp process to go down like the Hindenburg when one little thing goes wrong. Thanks for your time, -- J.P. Larocque -------------- next part -------------- A non-text attachment was scrubbed... Name: postmodern-1.16-stricter.diff Type: text/x-diff Size: 6150 bytes Desc: not available URL: From marijnh at gmail.com Tue Apr 6 17:39:38 2010 From: marijnh at gmail.com (Marijn Haverbeke) Date: Tue, 6 Apr 2010 19:39:38 +0200 Subject: [postmodern-devel] [patch] Erratic behavior when NIL password is given In-Reply-To: <20100406144032.GA7455@planetarium.thoughtcrime.us> References: <20100406144032.GA7455@planetarium.thoughtcrime.us> Message-ID: Hello J.P., > I usually use host-based authentication with ident to connect to > PostgreSQL from trusted machines, so I've been specifying a password > of NIL for a long time. ?However, when passwordless authentication > fails and NIL is given as a password, POSTMODERN:CONNECT will behave > erratically. Hm, yes, I really shouldn't be passing un-type-checked parameters to functions compiled at (safety 0). I've applied a patch that adds your check-type forms, and made a change to allow NIL as password (the authentication code will raise an error when the server demands a password and none was given). I did not apply the full doc changes you submitted. I can see the value of thoroughness, but I think telling people that a usename should be a string etc. seems a superfluous (especially when it has to be done four times -- two docstrings and two html documents) > I also humbly suggest not optimizing for safety 0. I see your point, yet when I profiled postmodern (back in 2007, on SBCL, not sure if this still holds) the speed difference between (safety 1) and (safety 0) was very significant (25% range, if I remember correctly). Memory safety in a chaotically-typed language like CL means a *lot* of checks. Feel free to run some benchmarks again, and see what you get (my benchmark consisted of inserting a lot of data, and making queries that returned huge result sets). Best, Marijn From jpl at thoughtcrime.us Wed Apr 7 05:57:04 2010 From: jpl at thoughtcrime.us (J.P. Larocque) Date: Tue, 6 Apr 2010 22:57:04 -0700 Subject: [postmodern-devel] [patch] Erratic behavior when NIL password is given In-Reply-To: References: <20100406144032.GA7455@planetarium.thoughtcrime.us> Message-ID: <20100407055704.GA17202@synthetic-forms.thoughtcrime.us> On Tue, Apr 06, 2010 at 07:39:38PM +0200, Marijn Haverbeke wrote: > > I usually use host-based authentication with ident to connect to > > PostgreSQL from trusted machines, so I've been specifying a password > > of NIL for a long time. However, when passwordless authentication > > fails and NIL is given as a password, POSTMODERN:CONNECT will behave > > erratically. > > Hm, yes, I really shouldn't be passing un-type-checked parameters to > functions compiled at (safety 0). > > I've applied a patch that adds your check-type forms, and made a > change to allow NIL as password (the authentication code will raise > an error when the server demands a password and none was given). Thanks! The pedantic doc changes I attached don't really fit in with the level of detail in the Postmodern HTML documentation (and especially the docstrings), so I understand why you'd want to leave those out. > > I also humbly suggest not optimizing for safety 0. > > I see your point, yet when I profiled postmodern (back in 2007, on > SBCL, not sure if this still holds) the speed difference between > (safety 1) and (safety 0) was very significant (25% range, if I > remember correctly). Memory safety in a chaotically-typed language > like CL means a *lot* of checks. Feel free to run some benchmarks > again, and see what you get (my benchmark consisted of inserting a > lot of data, and making queries that returned huge result sets). Fair enough. Thanks, -- J.P. Larocque From xach at xach.com Thu Apr 8 19:09:19 2010 From: xach at xach.com (Zach Beane) Date: Thu, 08 Apr 2010 15:09:19 -0400 Subject: [postmodern-devel] PATCH: Add support for asynchronous notifications Message-ID: <87tyrlpxr4.fsf@hangup.portland.xach.com> Attached is a patch that adds Postmodern support for asynchronous notifications, as documented here: http://www.postgresql.org/docs/current/static/sql-listen.html http://www.postgresql.org/docs/current/static/sql-notify.html http://www.postgresql.org/docs/current/static/sql-unlisten.html and http://www.postgresql.org/docs/current/interactive/protocol-message-formats.html (under "NotificationResponse") It updates MESSAGE-CASE to watch for async notifications and, by default, issue a warning that looks very similar to what the psql client displays for async notifications: WARNING: Asynchornous notification "lisp" received from server process with PID 22063. It also adds a blocking function, WAIT-FOR-NOTIFICATION, that adds a handler-bind around the warning and returns the notification data when a notification is received. The patch isn't complete, though -- I wasn't sure how best to integrate the new public function, condition, and condition accessors into the documentation. How should I proceed? Zach -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: postmodern-notify.patch URL: From marijnh at gmail.com Thu Apr 8 19:58:57 2010 From: marijnh at gmail.com (Marijn Haverbeke) Date: Thu, 8 Apr 2010 21:58:57 +0200 Subject: [postmodern-devel] Sorry about the git repository confusion! Message-ID: Initially, I published a 'git clone' example that didn't even work. Then, it worked, but was dog-slow because I hadn't enabled git's HTTP cgi script. Now finally, things are ducky, but the URL changed again: git clone http://marijn.haverbeke.nl/git/postmodern GitHub also continues to work, of course. Cheers, Marijn From marijnh at gmail.com Thu Apr 8 20:05:16 2010 From: marijnh at gmail.com (Marijn Haverbeke) Date: Thu, 8 Apr 2010 22:05:16 +0200 Subject: [postmodern-devel] PATCH: Add support for asynchronous notifications In-Reply-To: <87tyrlpxr4.fsf@hangup.portland.xach.com> References: <87tyrlpxr4.fsf@hangup.portland.xach.com> Message-ID: Hi Zach, The patch looks great. Do I understand correctly that one uses the SQL commands to actually enable listening or send something? As for where the docs go, I'd say somewhere near the bottom of cl-postgresl.html, with a short mention and a link somewhere in postmodern.html. If you write out a rough draft and submit a patch containing that, I'll be happy to polish up the HTML and such. Cheers, Marijn From archimag at gmail.com Wed Apr 14 14:59:48 2010 From: archimag at gmail.com (Andrey Moskvitin) Date: Wed, 14 Apr 2010 18:59:48 +0400 Subject: [postmodern-devel] PATCH: New query formats - plists and plist In-Reply-To: References: Message-ID: > Fair enough. Applied and pushed. Oh, probably after this patch was another that made it invalid. I upgraded to version 1.16 and noticed the problem. Correction: diff --git a/postmodern/query.lisp b/postmodern/query.lisp index 3832fca..bca6e71 100644 --- a/postmodern/query.lisp +++ b/postmodern/query.lisp @@ -34,8 +34,8 @@ (:alist symbol-alist-row-reader single-row) (:str-alists alist-row-reader all-rows) (:str-alist alist-row-reader single-row) - (:plists symbol-plist-row-reader nil) - (:plist symbol-plist-row-reader t) + (:plists symbol-plist-row-reader all-rows) + (:plist symbol-plist-row-reader single-row) (:column column-row-reader all-rows) (:single column-row-reader single-row) (:single! column-row-reader single-row!)) Andrey -------------- next part -------------- An HTML attachment was scrubbed... URL: From marijnh at gmail.com Wed Apr 14 18:42:22 2010 From: marijnh at gmail.com (Marijn Haverbeke) Date: Wed, 14 Apr 2010 20:42:22 +0200 Subject: [postmodern-devel] PATCH: New query formats - plists and plist In-Reply-To: References: Message-ID: Argh. This looked so simple that I didn't even test it. You must have been working against an *ancient* version. Fix applied. From drewc at tech.coop Wed Apr 14 23:12:39 2010 From: drewc at tech.coop (Drew Crampsie) Date: Wed, 14 Apr 2010 16:12:39 -0700 Subject: [postmodern-devel] PATCH: New query formats - plists and plist In-Reply-To: References: Message-ID: On 26 March 2010 23:51, Marijn Haverbeke wrote: > Hi Andrey, > > Thanks for submitting a patch. But -- why plists? Do you have some > library for which you need results like this? FWIW, i've had a plist row reader in RELATIONAL-OBJECTS-FOR-LISP since pretty much day 1. I'm not sure why i didn't send a patch... probably because i didn't think of it as more generally useful as i have a lot of different, more specific row readers. Anyway, thought i'd chime in. Cheers, drewc > Best, > Marijn > > On Fri, Mar 26, 2010 at 10:56 PM, Andrey Moskvitin wrote: >> Hi, >> I propose to add new query formats: >> diff --git a/doc/postmodern.html b/doc/postmodern.html >> index 3691ae8..9ac466f 100644 >> --- a/doc/postmodern.html >> +++ b/doc/postmodern.html >> @@ -202,6 +202,10 @@ >> ?? ? ? row. >> ?? ? ? :list, :rowReturn a >> ?? ? ? single row as a list. >> + ? ? ?:plistsReturn a list of plists which >> map column >> + ? ? ?names to values,with the names represented as >> + ? ? ?keywords. >> + ? ? ?:plistReturn a single row as an >> plist. >> ?? ? ? :alistsReturn a list of alists which >> map column >> ?? ? ? names to values,with the names represented as >> ?? ? ? keywords. >> diff --git a/postmodern/query.lisp b/postmodern/query.lisp >> index 3e5bfa5..921d03d 100644 >> --- a/postmodern/query.lisp >> +++ b/postmodern/query.lisp >> @@ -9,6 +9,15 @@ >> ?? ? ? ? ? ? ? ? ? ? ? ? ?:for symbol :in symbols >> ?? ? ? ? ? ? ? ? ? ? ? ? ?:collect (cons symbol (next-field field)))))) >> >> +;; Like symbol-alist-row-reader, but return plist >> +(def-row-reader symbol-plist-row-reader (fields) >> + ?(let ((symbols (map 'list (lambda (desc) (from-sql-name (field-name >> desc))) fields))) >> + ? ?(loop :while (next-row) >> + ? ? ? ? ?:collect (loop :for field :across fields >> + ? ? ? ? ? ? ? ? ? ? ? ? :for symbol :in symbols >> + ? ? ? ? ? ? ? ? ? ? ? ? :collect symbol >> + ? ? ? ? ? ? ? ? ? ? ? ? :collect (next-field field))))) >> + >> ?;; A row-reader for reading only a single column, and returning a list >> ?;; of single values. >> ?(def-row-reader column-row-reader (fields) >> @@ -22,6 +31,8 @@ >> ?? ? (:list list-row-reader t) >> ?? ? (:rows list-row-reader nil) >> ?? ? (:row list-row-reader t) >> + ? ?(:plists symbol-plist-row-reader nil) >> + ? ?(:plist symbol-plist-row-reader t) >> ?? ? (:alists symbol-alist-row-reader nil) >> ?? ? (:alist symbol-alist-row-reader t) >> ?? ? (:str-alists alist-row-reader nil) >> >> Moskvitin Andrey >> _______________________________________________ >> 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 patrick.may at mac.com Thu Apr 15 14:59:28 2010 From: patrick.may at mac.com (Patrick May) Date: Thu, 15 Apr 2010 10:59:28 -0400 Subject: [postmodern-devel] Examples of using CLOS interface Message-ID: <945AA20A-6117-4038-AE87-A1DD18508843@mac.com> I've recently found Postmodern and it looks like a nice, lighter weight alternative to CL-SQL. Is there any detailed documentation for using Postmodern with CLOS? How about a richer example than that in the Database access objects section of the manual? Thanks, Patrick -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2421 bytes Desc: not available URL: