Skip to content

[Feature Request]: INSERT ... ON DUPLICATE KEY UPDATE Statement #6567

Closed

Description

@dengn

Is there an existing issue for the same feature request?

  • I have checked the existing issues.

Is your feature request related to a problem?

From customer demand and certification test.

Describe the feature you'd like

INSERT
[INTO] tbl_name
[PARTITION (partition_name [, partition_name] ...)]
[(col_name [, col_name] ...)]
{ {VALUES | VALUE} (value_list) [, (value_list)] ... }
[AS row_alias[(col_alias [, col_alias] ...)]]
[ON DUPLICATE KEY UPDATE assignment_list]

assignment:
col_name =
value
| [row_alias.]col_name
| [tbl_name.]col_name
| [row_alias.]col_alias

Follow MySQL 8.0 behavior. https://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html

If you specify an ON DUPLICATE KEY UPDATE clause and a row to be inserted would cause a duplicate value in a UNIQUE index or PRIMARY KEY, an UPDATE of the old row occurs. For example, if column a is declared as UNIQUE and contains the value 1, the following two statements have similar effect:

INSERT INTO t1 (a,b,c) VALUES (1,2,3)
ON DUPLICATE KEY UPDATE c=c+1;

UPDATE t1 SET c=c+1 WHERE a=1;

Describe implementation you've considered

No response

Documentation, Adoption, Use Case, Migration Strategy

No response

Additional information

No response

Activity

  1. added
    priority/p0
    source/on-demand
    on Nov 14, 2022
  2. added this to the V0.7.0-Backlog milestone on Nov 14, 2022
  3. domingozhang commented on Nov 21, 2022

    @domingozhang
    Contributor

    need to be discussed with yuanning

  4. 22 remaining items

  5. dengn commented on Jul 11, 2023

    @dengn
    ContributorAuthor

    doc needs to keep up @lacrimosaprinz .

  6. modified the milestones: 1.0.0, 1.1.0 on Aug 18, 2023
  7. Repository owner unassigned on Sep 7, 2023
  8. removed their assignment
    on Oct 10, 2023
  9. self-assigned this
    on Oct 10, 2023
  10. dengn commented on Jan 2, 2024

    @dengn
    ContributorAuthor

    feature implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/featurepriority/p0.5source/on-demandsource/partnerstriage/accepted

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions