1

I am developing a mechanism that uploads records to CartoDB - first by importing the records to a new table, and then insert the records from the new table to an existing table.

The problem is that the existing table may already contain some of the records (each record has a unique record_id) - in this case I would like to override the existing values with the values of the new record.

This could be done in two steps, by deleting the existing records (whose record_id is in the new table) and then insert all the records from the new table.

The SQL MERGE command should allow to do that in a single command. Is this command supported by CartoDB? Can you give an example with the exact the syntax? (I am getting a 'Syntax error at or near "MERGE"').

nmtoken
13.6k5 gold badges39 silver badges91 bronze badges
asked Apr 20, 2015 at 12:27
1

1 Answer 1

1

According to this, MERGE is not implemented in PostgreSQL 9.3.4, the version that CartoDB runs on. You can check the version by running SELECT version() in the SQL editor in your account.

answered Apr 21, 2015 at 0:25
1
  • Atomicity is not so important in my case, so I solved it by doing two commands, following: stackoverflow.com/questions/17267417/… (even without the lock). Commented Apr 21, 2015 at 1:24

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.