Postgres UPSERT native support
See original GitHub issueLooks like Postgres recently added UPSERT (9.5alpha is it?). Seems Sequelize handles psql upsert fine presently with its workaround, so obviously no rush.
Me personally (and maybe I need re-architecting), my current project’s most common SQL operation is UPSERT. That operation seems quite slow; this is the resultant SQL which looks like it would be slow:
CREATE OR REPLACE FUNCTION pg_temp.sequelize_upsert() RETURNS integer AS $func$ BEGIN INSERT INTO ... VALUES ...; RETURN 1; EXCEPTION WHEN unique_violation THEN UPDATE ... SET ... WHERE ...; RETURN 2; END; $func$ LANGUAGE plpgsql; SELECT * FROM pg_temp.sequelize_upsert();
So I’d personally upgrade to Postgres 9.5 if native upsert becomes supported in sequelize
Issue Analytics
- State:
- Created 8 years ago
- Reactions:15
- Comments:16 (5 by maintainers)
Top Results From Across the Web
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 >Upsert in SQL: What is an upsert, and when should you use ...
The UPSERT command doesn't exist in MySQL, but upserts can still be achieved. The best method for implementing an upsert in the current...
Read more >JPA(Hibernate) and postgres sql batch upsert using nativequery
So my question is in that case of native query insert , can we use manual flushing like em.flush() . Will it work...
Read more >PostgreSQL — How to UPSERT safely, easily and fast
When you UPSERT data into a table, you update or ignore records that already exist and insert new ones. After reading this article, ......
Read more >Use of the PostgreSQL Upsert (INSERT ON CONFLICT DO ...
PostgreSQL has supported Rule syntax for a long time. Create a rule with Rule syntax. If the rule exists, update it. Otherwise, insert...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is a really stale issue. Is there any update on this?
Well, PostgreSQL 9.5 is released.