Open leichgardt opened 3 years ago
In aiopg, queries to update table fields doesn't work with self inversion. I tried to inverse one field like that:
cmd = 'UPDATE schema.table SET field1 = NOT field1 WHERE field2 = %s' await cur.execute(cmd, args)
It didn't work. instead of this way, I had to do this in two queries - select and update:
cmd = 'SELECT field1 FROM schema.table WHERE field2 = %s' res = await cur.execute(cmd, args) res = not res[0][0] cmd = 'UPDATE schema.table SET field1 = %s WHERE field2 = %s' await cur.execute(cmd, (res,) + args)
The syntax for SET field = NOT field is correct and it works in terminal, but I don't know why it doesn't work here.
SET field = NOT field
system: ubuntu 20.04 python: 3.8 aiogp: 1.2.1
In aiopg, queries to update table fields doesn't work with self inversion. I tried to inverse one field like that:
It didn't work. instead of this way, I had to do this in two queries - select and update:
The syntax for
SET field = NOT field
is correct and it works in terminal, but I don't know why it doesn't work here.System
system: ubuntu 20.04 python: 3.8 aiogp: 1.2.1