Re: SQL numeric -> CL rational?

Russ Tyndall <[email protected]> Tue, 15 Oct 2013 11:36:59 -0400
Newsgroups gmane.lisp.clsql.general
Message-ID <[email protected]>
One possible solution to get you running immediately is an (setf 
closer-mop:slot-value-using-class) :after method specialized on your 
view class type (or a new parent class)  method to convert the types of 
the values as they go into the slots.  Alternatively, you could add 
methods that convert after it is read from the database 
(clsql-sys::get-slot-values-from-view, 
clsql-sys::update-slot-from-db-value, 
clsql-sys:update-instance-from-records are probably the relevant methods).

As far as getting the previous behavior.  This could be related to using 
postgresql-socket-3 (if that is the backend you are using), and 
switching to postgresql-socket, or postgresql, could return you the old 
behavior).  The postgresql-socket-3 backend uses cl-postgres underneath 
and does type coercion in its own code before clsql sees it.  I don't 
use the other postgres backends much though so I am not sure.

To begin diagnosing this problem better, though I would need to know 
which backend you are using against what version of postgres.

Hope this helps, Cheers,
Russ Tyndall
Acceleration.net





On 10/15/2013 9:27 AM, Nicolas Neuss wrote:
> Hello,
>
> I just observe that numbers like 1.5 (of type 'numeric' in my Postgresql
> database) appear as rationals 3/2 in SELECT queries or VIEW-CLASS
> objects.
>
> Was this changed recently?  If yes, is there a way to revert to the old
> behavior?  I have an old application which I am reactivating and which
> breaks at this point, and I am just wondering how I should fix it in the
> most reasonable way.
>
> Thank you,
>
> Nicolas
> _______________________________________________
> CLSQL mailing list
> [email protected]
> http://lists.b9.com/cgi-bin/mailman/listinfo/clsql