2016-11-02 4:29 GMT+01:00 Samir Faci <[email protected]>:

>
> Yup.  That's what I was using.  The issue I was running into was that the
> PKey was not useful, so I needed to specify a unique constraint/index.  It
> looks like that will be supported in 3.9.
>

I'm curious about this to learn more about your use-case. Why was the
primary key not useful in your case?


> I don't think I need to use the where clause.  Though I imagine it would
> be a useful pattern.
>

Yes indeed. Sometimes, it's safe to ignore failed inserts rather than
performing some update. Especially when inserting a whole data set, this is
a useful pattern, which is also available from the SQL standard MERGE
statement.

I keep wondering why PostgreSQL didn't just implement MERGE, though.


> The two main Upsert + Jooq features I would love to see are:
>
> 1.  batch operation working with upserts (which is partially supported by
> generating a list of custom insert statements)
> 2.  the ability to specify the list of columns rather the .onKeyConflict
> which doesn't support all of my use cases.
>

Regarding 2), this is the jOOQ 3.9 API:

    /**
     * Add an <code>ON CONFLICT</code> clause to this insert query.
     */
    @Support({ POSTGRES_9_5 })
    InsertOnConflictDoUpdateStep<R> onConflict(Field<?>... keys);

    /**
     * Add an <code>ON CONFLICT</code> clause to this insert query.
     */
    @Support({ POSTGRES_9_5 })
    InsertOnConflictDoUpdateStep<R> onConflict(Collection<? extends
Field<?>> keys);

No, we don't generate indexes yet as that information hasn't been useful to
>> general jOOQ API usage (yet).
>>
>
> That's fine.  I suppose there's not much usability added by having java
> objects generated for them.
>

Well, there is now that we support DDL to create indexes or to restore a
schema from jOOQ classes :)
There, I've added a feature request so this won't be forgotten (in
particular: ON CONFLICT usage with index names):
https://github.com/jOOQ/jOOQ/issues/5638

Thanks,
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/d/optout.

Reply via email to