Possible bug in "select"

asbjxrn-ltuHofWucvRH4x6Dk/[email protected] (Asbjørn Bjørnstad) 11 Dec 2005 09:06:56 +0100
Newsgroups gmane.lisp.clsql.devel
Message-ID <[email protected]>
Hi,
I get this behaviour on view classes with dashes in the name (clsql-3.5.0):

CL-USER 38 > (clsql:select 'foo-bar :where [= [foo-bar id] 1])

Error: While accessing database #<CLSQL-POSTGRESQL-SOCKET:POSTGRESQL-SOCKET-DATABASE localhost/testdb/phub OPEN 2070BF04>
  with expression "SELECT foo_bar.id FROM foo_bar,foo_bar WHERE ((foo_bar.id = 1))":
  Error POSTGRESQL-ERROR / ERROR:  table name "foo_bar" specified more than once

  has occurred.
  1 (abort) Return to level 0.
  2 Return to top loop level 0.

Type :b for backtrace, :c <option number> to proceed,  or :? for other options

I've tracked it down to the way duplicates is removed in #'find-all:
'foo-bar "becomes":
 (slot-value (clsql:sql-expression :table (clsql:view-table (clsql::find-class 'foo-bar))) 'clsql-sys:name)
which equals FOO_BAR

[foo-bar] "becomes":
 (slot-value [foo-bar] 'clsql-sys:name)
which equals FOO-BAR

I know far too little about the internals of clsql to suggest a fix, though.
-- 
  -asbjxrn