Hi there,
I'd really like to use the NATURAL <x> JOIN facility in postgresql as
outlined in http://www.postgresql.org/docs/8.3/interactive/queries-table-expressions.ht…,
so my first instinct was to patch s-sql (-:
This patch also fixes the syntax emitted for :cross-join (it really
doesn't require an :ON) and adds a :USING keyword to specify the
same-named columns to use for joining.
The result can be used like so:
(:select 'x 'y :from 'foo :cross-join 'bar)
(:select 'x 'y :from 'foo :natural-left-join 'bar :where (:= 'a 2))
(:select 'x 'y :from 'foo :natural-inner-join 'bar :where (:= 'a 1))
(:select 'x 'y :from 'foo :outer-join 'bar :using ('a 'b 'c))
;;; which is mostly equivalent to:
(:select 'x 'y :from 'foo :inner-join 'bar :on (:and (:= 'foo.a
'bar.a) (:= 'foo.b 'bar.b) (:= 'foo.c 'bar.c)))
I hope you find the attached patch useful, and will consider committing it.
Cheers,
--
Andreas Fuchs, (http://|im:asf@|mailto:asf@)boinkor.net, antifuchs