a problem involving select/find-all and a view with two joins to the same (other) view
Aleksandar Bakic <a_bakic-/[email protected]> Sun, 18 Dec 2005 17:23:16 -0800 (PST)
| Newsgroups | gmane.lisp.clsql.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I have a view class like this:
(def-view-class/meta a-b ()
((abid :db-kind :key :db-constraints :not-null :type integer
:reader abid :initarg :abid)
(b1id :db-constraints :not-null :type integer :initarg :b1id)
(b1 :db-kind :join :initarg :b1
:db-info (:join-class b
:home-key b1id
:foreign-key bid
:retrieval :immediate))
(b2id :db-constraints :not-null :type integer :initarg :b2id)
(b2 :db-kind :join :initarg :b2
:db-info (:join-class b
:home-key b2id
:foreign-key bid
:retrieval :immediate))))
and when I type '(select 'a-b)', I get NIL. This is because the generated SQL
looks like:
select a_b.abid,a_b.b1id,a_b.b2id,b.col1,...,b.coln,b.col1,...,b.coln from
a_b,b where ((b.bid=a_b.b1id and b.bid=a_b.b2id))
I suppose aliases would help here, but that would require lots of changes in
find-all and friends. Can someone suggest a workaround? I am trying to use a
modified fault-join-target-slot (Drew's version did not work for me, probably
because of things like the above view class), so I need a generic solution (for
any join class).
Thanks,
Alex
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com