logoalt Hacker News

faizshahtoday at 5:06 PM1 replyview on HN

Theres also spellfix1 which is an extension you can enable to get fuzzy search.

And ON CONFLICT which can help dedupe among other things in a simple and performant way.


Replies

somattoday at 6:20 PM

I was trying to port a small program I wrote from postgres to a sqlite backend(mainly to make it easier to install) and was pleased to find out sqlite supported "on conflict" I was less pleased to find out that apperently I abuse CTE's to insert foreign keys all the time and sqlite was not happy doing that.

    with thing_key as (
    insert into item(key, description) values('thing', 'a thing') on conflict do nothing )

    insert into user_note(uid, key, note) values (123, 'thing', 'I like this thing') on conflict (uid, thing) do update set note = 'I like this thing');