Replacing duplicate primary keys is as of now done by creating a temporary table and exchanging the actual one later by it.
The syntax CREATE TEMPORARY TABLE ... LIKE is specific to certain databases like mariadb. It is not working for postgres and databases building on it, like Amazon Redshift. Thus, the full compatibility with those databases cannot be ensured.
There are different paths to resolving the issue:
- exchange the syntax by a long sql string making use of insert update duplicate keys.
- put parentheses around the table to accomodate the different syntax for at least postgres.