[Cl-perec-devel] Schema evolution problem

Levente Mészáros levente.meszaros at gmail.com
Tue Aug 26 11:19:51 UTC 2008


On Tue, Aug 26, 2008 at 12:25 PM, Leslie P. Polzer
<leslie.polzer at gmx.net> wrote:
>
> Consider the following, questions as comments in-line:
>
> PRC(7): *db1*
> #<POSTGRESQL-POSTMODERN {B026989}>
>
> PRC(8): (defpclass bar nil nil)
> #<PERSISTENT-CLASS BAR>
>
> PRC(9): (let ((*database* *db1*)) (with-transaction (defparameter bar (make-instance
BTW, there is a with-database macro...

> 'bar))))
> BAR
>
> PRC(10): (let ((*database* *db1*)) (with-transaction (describe bar)))
> #<BAR :persistent #t 30 {B68B411}>
> is an instance of class #<PERSISTENT-CLASS BAR>.
> The following slots have :INSTANCE allocation:
>  OID                  1986950
>  PERSISTENT           T
>  TRANSACTION          NIL
>  TRANSACTION-EVENT    :CREATED
>
> ;; I didn't use REVIVE-/LOAD-INSTANCE here, but no error is signaled.
> ;; Why?
This is because there were no persistent slot access, all of those
slots are standard slots. I guess the check should go in
slot-value.lisp where we are reading the persistent flag in svuc, but
even in that case oid, transaction and transaction-event could be read
without signalling an error. I don't know whether if we want to forbid
that. You can always explicityly check if an instance is in the
current transaction. This check supposed to catch errors early and
it's questionable whether if those slots accesses are errors.

> PRC(12): (defpclass* bar nil ((s :type (or unbound text))))
> #<PERSISTENT-CLASS BAR>
>
> PRC(13): (let ((*database* *db1*)) (with-transaction (describe bar)))
> #<BAR :persistent #t 30 {B68B411}>
> is an instance of class #<PERSISTENT-CLASS BAR>.
> The following slots have :INSTANCE allocation:
>  OID                  1986950
>  PERSISTENT           T
>  TRANSACTION          NIL
>  TRANSACTION-EVENT    :CREATED
> debugger invoked on a SIMPLE-ERROR in thread #<THREAD "initial thread" RUNNING {A698799}>:
>  Accessing a persistent #<BAR :persistent #t 30 {B68B411}> while it is not attached to
> the current transaction.
>
> ;; here an error *is* signaled...
> ;; continuing...
>
> PRC(14): (let ((*database* *db1*)) (with-transaction (describe (revive-instance bar))))
> debugger invoked on a CL-POSTGRES-ERROR:SYNTAX-ERROR-OR-ACCESS-VIOLATION in thread
> #<THREAD "initial thread" RUNNING {A698799}>:
>  Database error 42703: column "_s" does not exist
> Query: SELECT _s FROM _bar WHERE (_oid = $1::BIGINT)
>
> ;; now that's the real issue: why hasn't the column for slot S been created?
Because revive-instance does not call ensure-exported on the class.
Currently only make-instance and queries do that, we add it to
load-instance which would add some extra cost there, but I guess that
is neglectable compared to the cost of the RDBMS select.

levy

-- 
There's no perfectoin



More information about the cl-perec-devel mailing list