question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for upsert

See original GitHub issue

It would be cool if SQLDelight would support the upsert command: https://www.sqlite.org/lang_UPSERT.html

Right now the following sql:

upsert:
INSERT INTO stop (id, address_id, name)
VALUES (?, ?, ?) ON CONFLICT(address_id) DO UPDATE SET name=excluded.name;

will produce this error:

',' expected, got 'ON'
62    INSERT INTO stop (id, address_id, name)
63    VALUES (?, ?, ?) ON CONFLICT(address_id) DO
                       ^^

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:7
  • Comments:18 (5 by maintainers)

github_iconTop GitHub Comments

9reactions
AlecStrongcommented, Aug 7, 2019

yea definitely, my hope is that we can allow specifying the minimum version of sqlite you’ll be using which would enable newer language features

1reaction
AlecStrongcommented, Jun 8, 2020

It goes inside your database block:

sqldelight { MyDatabase { dialect = “sqlite:3.24: } }

Read more comments on GitHub >

github_iconTop Results From Across the Web

Upsert in SQL: What is an upsert, and when should you use ...
The UPSERT command in CockroachDB performs an upsert based on the uniqueness of the primary key column or columns, and it will perform...
Read more >
UPSERT - PostgreSQL wiki
"UPSERT" is a DBMS feature that allows a DML statement's author to atomically either insert a row, or on the basis of the...
Read more >
PostgreSQL Upsert Using INSERT ON CONFLICT statement
This tutorial shows you how to use the PostgreSQL upsert feature to insert or update data if the row that is being inserted...
Read more >
How to UPSERT (MERGE, INSERT ... ON DUPLICATE ...
1. In the bulk upsert, is there possible value in deleting from newvals rather than filtering the INSERT? · 1. There are still...
Read more >
How to Add Upsert Support to Your API - Tyk.io
An upsert is an insert statement augmented with additional logic that ensures the new row will be updated if it already exists.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found