Re: DELETE FROM statement not working

Поиск
Список
Период
Сортировка
От Dorian Hoxha
Тема Re: DELETE FROM statement not working
Дата
Msg-id CANsFX06+jrOdiz2qO_BCWBKWs3p5DEbssVq1gg7RemASb7JJmw@mail.gmail.com
обсуждение исходный текст
Ответ на DELETE FROM statement not working  (Shaan Repswal <shaun.reapswaal@gmail.com>)
Список psycopg
Try doing a rollback before issuing the other query.

On Mon, Mar 14, 2016 at 5:56 PM, Shaan Repswal <shaun.reapswaal@gmail.com> wrote:
I was trying to delete a record I got inside my database and so I first typed all of this inside the interpreter... It was followed by the error mentioned at the bottom. I can't figure this out. Can anyone help me out?

>>> conn = psycopg2.connect("dbname=prototypedb user=postgres password=superman123")
>>> cur = conn.cursor()
>>> cur.execute("DELETE FROM inventory WHERE name = \"Polyester Direct High Gloss\";")
Traceback (most recent call last):
  File "<pyshell#84>", line 1, in <module>
    cur.execute("DELETE FROM inventory WHERE name = \"Polyester Direct High Gloss\";")
psycopg2.ProgrammingError: column "Polyester Direct High Gloss" does not exist
LINE 1: DELETE FROM inventory WHERE name = "Polyester Direct High Gl...
                                           ^

>>> name = "DELETE FROM inventory WHERE name = \"Polyester Direct High Gloss\";"
>>> cur.execute(name)
Traceback (most recent call last):
  File "<pyshell#86>", line 1, in <module>
    cur.execute(name)
psycopg2.InternalError: current transaction is aborted, commands ignored until end of transaction block

В списке psycopg по дате отправления:

Предыдущее
От: Christophe Pettus
Дата:
Сообщение: Re: DELETE FROM statement not working
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: DELETE FROM statement not working