db icon indicating copy to clipboard operation
db copied to clipboard

Support PostgreSQL ON CONFLICT

Open kipply opened this issue 5 years ago • 1 comments

https://www.postgresql.org/docs/current/sql-insert.html

I'm looking to write a query like;

	INSERT INTO table ("col", "col2", "col3") 
       VALUES ($1, $2, $3), 
              ($2, $1, NULL) 
ON CONFLICT("col") DO NOTHING RETURNING col;
image It seems `InsertReturning` seems close but is conflict handling supported anywhere? Alternatively, are there any viable workarounds to achieve the same effect or effectively write a raw insert query?

kipply avatar Jul 03 '20 20:07 kipply

See https://github.com/upper/db/pull/298 and https://github.com/upper/db/pull/318.

VojtechVitek avatar Jul 06 '20 11:07 VojtechVitek