Re:What ORMs have taught me: just learn SQL
by terhechte on Monday August 04, 2014 @06:32PM
(#8134439)
Postgres indeed doesn't have Upsert yet, so I'm going the default way of locking the table, and implementing it via a slightly more complex query. I was just too lazy to explain that in my earlier comment. The problem is the same: The syntax below can't really be represented well in a ORM.
[ Parent
| on HN ]
Re:What ORMs have taught me: just learn SQL
by jimktrains2 on Monday August 04, 2014 @07:13PM
(#8134595)
You can use writable CTEs as an upsert in postgres. http://dba.stackexchange.com/questions/13468/most-idiomatic-...
Re:What ORMs have taught me: just learn SQL
by NicoJuicy on Tuesday August 05, 2014 @05:07AM
(#8136098)
But this aint that hard, i suppose it could also be done in Postgres (query using MS SQL Server)
Table1 SET (...) WHERE Column1='SomeValue'
IF @@ROWCOUNT=0
INSERT INTO Table1 VALUES (...)not atomic