wriring a file to a database

From: Roger Mason <rmason(at)esd(dot)mun(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Subject: wriring a file to a database
Date: 2007-12-08 19:02:55
Message-ID: y65fxyd3t7k.fsf@minnie.esd.mun.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

I want to write a file into a database from python using psycopg. I
have tried several ways to insert the file, each gives a different
error.

File "write_images_to_db.py", line 43, in insert
curs.execute("INSERT INTO diamonds VALUES (%s, lo_import
%s)",(iname, image))
psycopg2.ProgrammingError: type "lo_import" does not exist

curs.execute("INSERT INTO diamonds VALUES (%s, \lo_import
%s)",(iname, image))
psycopg2.ProgrammingError: syntax error at or near "\" at character 50

curs.execute("INSERT INTO diamonds VALUES (%s, lo_import
(%s))",(iname, image))
psycopg2.ProgrammingError: must be superuser to use server-side
lo_import()
HINT: Anyone can use the client-side lo_import() provided by libpq.

curs.execute("INSERT INTO diamonds VALUES (%s,
\lo_import(%s))",(iname, image))
psycopg2.ProgrammingError: syntax error at or near "\" at character 50

Can someone please help out?

Thanks,
Roger

Postgresql 8.0.9 on Gentoo Linux

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Smith 2007-12-08 19:53:13 Re: wriring a file to a database
Previous Message Jan de Visser 2007-12-08 18:23:41 Re: postgresql startup