[postmodern-devel] Regression in handling integer dates and timestamps
Hi there, The following code sample used to work on postmodern-20110219-git (using quicklisp from that period). However it now breaks. I can no longer insert integers as dates or timestamps into tables. Updates don't work either, but the example below uses insert: (ql:quickload "postmodern") ;; quicklisp version released yesterday - postmodern-20111203-git (pomo:connect-toplevel "date_test" "snip" "snip" "localhost") (gethash "integer_datetimes" (pomo::connection-parameters pomo:*database*)) => "on" => T (pomo:execute "create table date ( value date );") (pomo:execute "insert into date ( value ) values ( $1 )" "2010-01-01") (setf date (pomo:query "select * from date limit 1" :single)) => 3471292800 (ignore-errors (pomo:execute "insert into date ( value ) values ( $1 )" date)) => NIL => #<CL-POSTGRES-ERROR:INVALID-DATETIME-FORMAT {1004A00391}> (pomo:execute "create table timestamp ( value timestamp );") (pomo:execute "insert into timestamp ( value ) values ( $1 )" "2010-01-01") 1 1 (setf timestamp (pomo:query "select * from timestamp limit 1" :single)) => 3471292800 (ignore-errors (pomo:execute "insert into timestamp ( value ) values ( $1 )" timestamp)) => NIL => #<CL-POSTGRES-ERROR:INVALID-DATETIME-FORMAT {100403F391}> -- --------------------------------------------------- Dr Lucas Hope - lucas.r.hope@skype Machine Learning and Software Engineering Consultant Melbourne, Australia
Additional: My notes say that it succeeded on ~/quicklisp/dists/quicklisp/software/postmodern-20110619-git and failed on ~/quicklisp/dists/quicklisp/software/postmodern-20110829-git . -Luke On Fri, Feb 10, 2012 at 2:36 PM, Lucas Hope <lucas.r.hope@gmail.com> wrote:
Hi there,
The following code sample used to work on postmodern-20110219-git (using quicklisp from that period). However it now breaks. I can no longer insert integers as dates or timestamps into tables. Updates don't work either, but the example below uses insert:
(ql:quickload "postmodern") ;; quicklisp version released yesterday - postmodern-20111203-git
(pomo:connect-toplevel "date_test" "snip" "snip" "localhost")
(gethash "integer_datetimes" (pomo::connection-parameters pomo:*database*)) => "on" => T
(pomo:execute "create table date ( value date );")
(pomo:execute "insert into date ( value ) values ( $1 )" "2010-01-01")
(setf date (pomo:query "select * from date limit 1" :single)) => 3471292800
(ignore-errors (pomo:execute "insert into date ( value ) values ( $1 )" date)) => NIL => #<CL-POSTGRES-ERROR:INVALID-DATETIME-FORMAT {1004A00391}>
(pomo:execute "create table timestamp ( value timestamp );")
(pomo:execute "insert into timestamp ( value ) values ( $1 )" "2010-01-01") 1 1
(setf timestamp (pomo:query "select * from timestamp limit 1" :single)) => 3471292800
(ignore-errors (pomo:execute "insert into timestamp ( value ) values ( $1 )" timestamp)) => NIL => #<CL-POSTGRES-ERROR:INVALID-DATETIME-FORMAT {100403F391}>
-- --------------------------------------------------- Dr Lucas Hope - lucas.r.hope@skype Machine Learning and Software Engineering Consultant Melbourne, Australia
-- --------------------------------------------------- Dr Lucas Hope - lucas.r.hope@skype Machine Learning and Software Engineering Consultant Melbourne, Australia
It could be that simple-date is being accidentally (or intentionally) loaded. Could you check whether the :simple-date package is present? That will register handlers for serializing date and time values, which might cause the behaviour you describe. These two patches might be to blame: https://github.com/marijnh/Postmodern/commit/f35a1124476d39d651baddbe1ba6791... https://github.com/marijnh/Postmodern/commit/ce1fd7a23b2e523dcc7b3f96fd60b48... Best, Marijn
Hi Marijn, (ql:quickload "postmodern") (find-package :simple-date) => nil Alas, not so simple. Previously I'd had problems with simple-date always loading, and I worked around it with: (setf cl-postgres:*sql-readtable* (cl-postgres:default-sql-readtable))) => #<HASH-TABLE :TEST EQL :COUNT 29 {1002EB6821}> But the erroneous behaviour I reported happens with or without that command. -Luke On Fri, Feb 10, 2012 at 6:47 PM, Marijn Haverbeke <marijnh@gmail.com> wrote:
It could be that simple-date is being accidentally (or intentionally) loaded. Could you check whether the :simple-date package is present? That will register handlers for serializing date and time values, which might cause the behaviour you describe. These two patches might be to blame:
https://github.com/marijnh/Postmodern/commit/f35a1124476d39d651baddbe1ba6791...
https://github.com/marijnh/Postmodern/commit/ce1fd7a23b2e523dcc7b3f96fd60b48...
Best, Marijn
_______________________________________________ postmodern-devel mailing list postmodern-devel@common-lisp.net http://lists.common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel
-- --------------------------------------------------- Dr Lucas Hope - lucas.r.hope@skype Machine Learning and Software Engineering Consultant Melbourne, Australia
Did you verify that those older version of cl-postgres work with your current set-up (schema, postgres server etc)? If I revert to the version from June last year, I get the exact same error.
participants (2)
-
Lucas Hope
-
Marijn Haverbeke