>1) Is the quoting behaviour a feature or a bug? (I suspect feature, but
>I thought I'd check)

Yep, it is. The reason are different handlings of reserved words. Your
column names might conflict with stuff defined by the SQL database and
by quoting the names this conflict doesn't arise.

>2) Is there room for a smarter quoting scheme? - e.g., don't quote a
>table name if the first character is a '('

I think that's the way to go. We already have some quoting-prevention
for other situations like 'select' kwargs (where you put a select in as
a field). So the 'table' kwarg should just be handled the same way. The
'select' kwarg is just run through quote_only_if_word (a l ocal
function) - the function would have to be propagated up one scope and
could be used in those places where quote_word would break stuff
because it's argument isn't allways a field name. This is all happening
in django/core/meta/__init__.py

>3) Is there room to add a distinct 'subselect' kwarg to queries? This
>kwarg would be identical to 'tables', but wouldn't quote its contents

I don't think that would be needed, as 'table' and 'select' both
provide subselects in the right places.

>4) Is there some other way to construct a subselect join that I am
>missing (including, ideally, a left outer join)?

It might - depending on your problem - work with the 'select' kwarg.

bye, Georg

Reply via email to