[英]H2 Database Postgres Mode Upsert
當 H2 數據庫處於 Postgres 模式時,如何檢查它是否支持以下語句(upsert / on conflict)
INSERT INTO event_log_poller_state (aggregate_type, consumer_group_id, value)
VALUES (?, ?, ?)
on conflict (aggregate_type, consumer_group_id) " +
" do update SET VALUE = ?
WHERE
event_log_poller_state.aggregate_type = ? AND
event_log_poller_state.consumer_group_id = ?
我收到語法錯誤 42000
我寫了以下程序來演示
https://github.com/tonymurphy/h2-postgres
2019 年 10 月編輯:結帳https://github.com/whisklabs/docker-it-scala或 testcontainers.org
有合並應該做同樣的事情: https://www.tutorialspoint.com/h2_database/h2_database_merge.htm
MERGE INTO tableName [ ( columnName [,...] ) ]
[ KEY ( columnName [,...] ) ]
{ VALUES { ( { DEFAULT | expression } [,...] ) } [,...] | select }
另請參閱https://github.com/h2database/h2database/issues/2007#issuecomment-1152312049
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.