Hi Maxim,
Please direct support requests to the jOOQ User Group:
http://groups.google.com/group/jooq-user
> While trying to use jOOQ we encountered a problem. One our use case is using
> SQL tables like this:
>
> Table t = create.table("tablename");
> Table t1 = t.as("t1");
> While rendering the select query for t1 it adds parenthesis around the table
> name.
> select * from (tablename) as t1
> This is not valid syntax for PostgreSQL.
This adding of parentheses seems to be a very old "feature" where
early integration tests seemed to aim for automatic integration of
plain SQL nested selects as tables. Now I see that it is a bad idea to
be so intrusive on that level of SQL syntax. I will file this issue as
https://sourceforge.net/apps/trac/jooq/ticket/836
> A possible solution is to add a parameter to the SQLTable constructor and the
> Factory.table method.
I don't think the API should be "enhanced" with parameters to
circumvent bad internal design decisions. I think it's better to
actually solve this issue and existing issues related to plain SQL
tables:
https://sourceforge.net/apps/trac/jooq/ticket/271
https://sourceforge.net/apps/trac/jooq/ticket/667
https://sourceforge.net/apps/trac/jooq/ticket/761
> Do you see better ways to solve the issue?
That depends on how you want to use your tables t and t1. I'm guessing
that your example
> select * from (tablename) as t1
... does not reflect the real query for which you're trying to use the
create.table("...") construct? Can you give me the greater context of
your tables t and t1?
Cheers
Lukas