Hello all SA: 1.1.0b3 db: postgresql 9.5
I have a problem with method on_conflict_do_update for pg specific insert. Precisely with the where argument. It looks like wrong SQL statement is generated. example: class Foo(Base): ... bar = Column(Integer) insert_stmt = insert(Foo) on_update_stmt = insert_stmt.on_conflict_do_update( set_=dict( bar=insert_stmt.excluded.bar, ), where=(Foo.bar < insert_stmt.excluded.bar) ) session.execute(on_update_stmt, data) it gives error and rightly so: > column reference "bar" is ambiguous SQL looks like that: SQL: 'INSERT INTO foo (...) VALUES (...) ON CONFLICT (...) DO UPDATE SET bar = excluded.bar WHERE bar < bar' WHERE clause is not expanded properly, the alias EXCLUDED is omitted. Is this a bug or I'm doing sht wrong? the workaround I use is: ... where=(text('foo.bar < EXCLUDED.bar')) ... Cheers -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.