💾 Archived View for alex.corcoles.net › 2011 › 12 › upserts captured on 2022-03-01 at 15:19:49. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-11-30)
-=-=-=-=-=-=-
2011-12-17
Trabajando en un pequeño experimento[1], se me ha ocurrido un insert idempotente:
insert into foo (bar) (select 'bar_value' as bar where not exists (select 1 from foo where bar = 'bar_value'));
(la sintaxis es de PostgreSQL, pero supongo que es adaptable a otras bases de datos). Igual intento adaptarlo a hacer upserts.
1: https://github.com/alexpdp7/tvguide