psycopg2

Andre' John joa at hrz.tu-chemnitz.de
Thu Jan 31 19:26:31 EST 2008


Hi

I am trying to do this for a Postgresql database:

conn = psycopg2.connect('host=localhost')
cur = conn.cursor()
cur.execute("SELECT * FROM names WHERE name=%s", ['S'])

, which doesn't work, and neither does

cur.execute("SELECT * FROM names WHERE name='%s'", ['S'])

or

cur.execute("SELECT * FROM names WHERE name='S'")

work. It always returns:

Traceback (most recent call last):

  File "<stdin>", line 1, in <module>

psycopg2.ProgrammingError:  array value must start with ?{½ or 
dimension information


Though, when doing

cur.execute("SELECT * FROM names")

it works.
I am totally helpless here. Does anyone have an idea?

Cheers

Andre


More information about the Python-list mailing list