Support HQL's insertion conflict clause with an ON CONSTRAINT target

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Mutation
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      HQL's insertion conflict clause accepts a constraint name: insert ... on conflict on constraint uk_book_title do nothing (and do update set ...).

      The SQL AST delivers only the name: ConflictClause.getConstraintName() returns it and getConstraintColumnNames() is empty. Translating to MQL needs the columns behind the name, because the upsert filter is equality on the conflict-target columns.

      on constraint <name> is exactly equivalent to naming that constraint's columns (verified against PostgreSQL: the conflict-detection scope and do update support are identical), so resolving the name reduces these statements to the already-supported field-list forms with no new translation mechanism.

      The columns live in boot-time metadata only (org.hibernate.mapping.UniqueKey); the work is capturing them at bootstrap into something the translator can consult at runtime, keyed by constraint name.

            Assignee:
            Unassigned
            Reporter:
            Jeffrey Yemin
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: