Hello Jason,

2013/10/10 Jason Dusek <[email protected]>

> When a Postgres table has other tables that inherit from, a SELECT against
> the parent will show rows in all the children, as well. The antidote to
> this is the ONLY keyword:
>
>   SELECT * FROM ONLY <name-of-parent-table>
>
> Is inheritance recognized by jOOQ?
>

Inheritance is an interesting PostgreSQL (and CUBRID) feature. But it is
currently not recognised by jOOQ, although it was discussed a couple of
times:

- https://groups.google.com/d/msg/jooq-user/YuTp9-5K9fs/_d5siyYQn3EJ
- https://groups.google.com/d/msg/jooq-user/9dfbLtnR77c/_0GL1H7f2ZYJ
- https://groups.google.com/d/msg/jooq-user/K_tTB4-prDQ/WrDZuqwcRfIJ


> Are there options for making ONLY the default for different models/tables?
>

Right now, you will have to resort to tricks similar to what was discussed
recently on this user group, with respect to Oracle's "partition extension
clause":
https://groups.google.com/forum/#!topic/jooq-user/hLojif16pXM

In other words, you'll have to wrap your tables in order for them to
generate the ONLY keyword. Another option, is to use plain SQL for that
particular table, such as:

DSL.using(configuration)
   .select(...)
   .from("ONLY {0}", PARENT_TABLE);

See: 
http://www.jooq.org/javadoc/latest/org/jooq/SelectFromStep.html#from(java.lang.String,
org.jooq.QueryPart...)

For jOOQ 3.3, I have registered #2776:
https://github.com/jOOQ/jOOQ/issues/2776

I'll also review how PostgreSQL table inheritance can play into the code
generator. I would imagine that it could map quite well to Java inheritance
for generated tables, records, pojos, and daos:
https://github.com/jOOQ/jOOQ/issues/2777

Cheers
Lukas

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to