Update "table" with inverse (logic) doesn't work
- Lenguaje dominante
- Python
- Estrellas
- 1.4k
- Forks
- 170
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
In aiopg, queries to update table fields doesn't work with self inversion.
I tried to inverse one field like that:
```python
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_:
```python
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.
## System
system: ubuntu 20.04
python: 3.8
aiogp: 1.2.1
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.