How to use on_duplicate_ignore with subselect?
See original GitHub issueIn PostgreSQL, when attempting to do something like the following:
customers, customers_backup = Tables('customers', 'customers_backup')
q = Query.into(customers_backup).columns('id', 'fname', 'lname')
.from_(customers).select(customers.id, customers.fname, customers.lname).on_duplicate_ignore()
I get the error TypeError: 'Field' object is not callable
. Am I doing something wrong or is this not yet supported?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Mysql on duplicate key update + sub query - Stack Overflow
INSERT INTO new_table (date,record_id,data_field,value) SELECT date, record_id, data_field, SUM(other_table.value) as value FROM old_table JOIN ...
Read more >Deduplicate Data Using Having with Subquery
I'm now trying to remove the duplicate records, then add a constraint to block this going forward. I have this query: SELECT count(*)...
Read more >13.2.7.2 INSERT ... ON DUPLICATE KEY UPDATE Statement
INSERT INTO t1 SELECT c, c+d FROM t2 ON DUPLICATE KEY UPDATE b = VALUES(b);. You can eliminate such warnings by using a...
Read more >Subqueries (SQL Server) - Microsoft Learn
A subquery is a query that is nested inside a SELECT , INSERT , UPDATE , or DELETE statement, or inside another subquery....
Read more >MySQL Subquery - MySQL Tutorial
In this example, both outer query and correlated subquery reference the same products table. Therefore, we need to use a table alias p1...
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 FreeTop 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
Top GitHub Comments
Great! I will try it out and get back to you.
Indeed, on MySQL it works:
output:
This is not implemented for PostgreSQL dialect. What would be the right output for PostgreSQL? With the right output I can take a look and implement that for PostgreSQL as well.