Starting with jOOQ 3.17, we've added support for the PostgreSQL EXCLUDED
pseudo table, which works just like MySQL's VALUES() clause and emulates
itself that way. Use DSL.excluded() for that purpose:
https://www.jooq.org/javadoc/latest/org.jooq/org/jooq/impl/DSL.html#excluded(org.jooq.Field)

Note that MySQL has deprecated VALUES() and will implement a different
syntax in the future, which we'll adopt soon via our EXCLUDED emulation.

I hope this helps,
Lukas

On Wed, Jun 22, 2022 at 7:51 PM 'Chen Wu' via jOOQ User Group <
[email protected]> wrote:

> Hi everyone,
>
> I'm wondering what is the correct syntax for generating a query that has
> SQL
>
> on duplicate key update `column_name`=VALUES(`column_name`)
>
> ? When I try to use onDuplicateKeyUpdate.set(column_name, column_name) it
> generates
>
> on duplicate key update `column_name`=`column_name`
>
> which does not update an existing row with new values when inserting into
> the table.
>
> Thank you
> Chen
>
> --
> 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].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jooq-user/9171bbfe-2872-4e39-860a-cd34d7632ed7n%40googlegroups.com
> <https://groups.google.com/d/msgid/jooq-user/9171bbfe-2872-4e39-860a-cd34d7632ed7n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jooq-user/CAB4ELO5PWicGrPXyFZy_n8mCvqfK%3DaQjV2ethfo1Tzbx%2BB4yBA%40mail.gmail.com.

Reply via email to