> OK, good to know. It would be nice to be able to control the alias rendering
> by itself.

How would you generally distinguish an alias from an actual table
name? E.g. when rendering Factory.fieldByName("a", "b"). Is "a" a
table or a table alias? Hence, should it be quoted (made
case-sensitive) or not (left case-insensitive)?
I don't think it's a good idea to separately handle aliases from other
SQL identifiers.

> FWIW I looked into the alias rendering works and it appears to
> assume that for HSQL, aliases are rendered with double quotes.

This isn't about aliases. This is about SQL identifiers in general,
which are quoted with double quotes in most databases ([brackets] in
T-SQL databases, `backticks` in MySQL).

As most users are not used to quoting their identifiers in everyday
SQL usage, it might be a good idea to review the default behaviour for
RenderNameStyle in jOOQ 3.0. Probably, AS_IS is a better default than
QUOTED. I'll have to think about this again, as such a change might be
backwards-incompatible

> This appears
> to be fine for normal queries but presents a problem with subqueries since a
> quoted alias is not available to the outer query.

I doubt that there is a subquery-related problem here. Probably the
problem you're facing is a problem related to case-sensitivity. Note
that jOOQ's "plain SQL" is what it is called. Plain SQL. jOOQ does not
modify / introspect that. So when you write:

Factory.field("day"), you're getting a case-insensitive, unquoted
reference to a DAY identifier. By default (in many databases),
case-insensitive identifiers are in fact all uppercase. When you're
writing someField.as("day"), you're getting a case-sensitive, quoted
reference / declaration of a "day" identifier with lower-case letters.
i.e. your DAY and "day" identifiers just aren't the same...

Cheers
Lukas

Reply via email to