Re: DELETE FROM statement not working

Поиск
Список
Период
Сортировка
Искать
От
Christophe Pettus
Тема
Re: DELETE FROM statement not working
Дата
Msg-id
AA091492-154E-4291-9FA8-A9F3CC6D3B38@thebuild.com
Ответ на
Список
Дерево обсуждения
DELETE FROM statement not working Shaan Repswal <shaun.reapswaal@gmail.com>
Re: DELETE FROM statement not working Adrian Klaver <adrian.klaver@aklaver.com>
Re: DELETE FROM statement not working Christophe Pettus <xof@thebuild.com>
Re: DELETE FROM statement not working Dorian Hoxha <dorian.hoxha@gmail.com>
Single quotes for a string.  Double quotes are used in SQL to indicate a table name with capitalization, spaces, etc.

On Mar 14, 2016, at 9:56 AM, Shaan Repswal  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 "", line 1, in 
>     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 "", line 1, in 
>     cur.execute(name)
> psycopg2.InternalError: current transaction is aborted, commands ignored until end of transaction block

--
-- Christophe Pettus
   xof@thebuild.com


В списке psycopg по дате отправления
От: Shaan Repswal
Дата:
От: Dorian Hoxha
Дата:
FAQ