FAQ
Hello,

I tried to insert an image in my database with lo_import. The error I
get is "invalid large object descriptor: 0". If I try to create an oid I
get a valid one but with lo_import it seems not to work. The connection
is ok as well.
The folloing code produces the output after the code.

if (PQstatus(connDB) == CONNECTION_OK)
std::cout << "CONNECTION_OK" << std::endl;
Oid oid = lo_creat(connDB, INV_READ | INV_WRITE);
std::cout << oid << std::endl;
std::cout << PQerrorMessage(connDB) << std::endl;
std::cout << lo_import(connDB, "/tmp/image.vtk") << std::endl;
std::cout << PQerrorMessage(connDB) << std::endl;


Output:
CONNECTION_OK
25211


FEHLER: ungültiger Large-Object-Deskriptor: 0

Here is the version string of my db:
PostgreSQL 8.3.3 on x86_64-redhat-linux-gnu, compiled by GCC gcc (GCC)
4.3.0 20080428 (Red Hat 4.3.0-8)

Can anyone tell me please what is wrong?

Thank you,
Markus

Search Discussions

  • Tom Lane at Jul 14, 2008 at 4:47 pm

    Markus Mehrwald writes:
    I tried to insert an image in my database with lo_import. The error I
    get is "invalid large object descriptor: 0".
    lo_import has to be called within a transaction block (BEGIN/COMMIT).
    The documentation is not very clear about that :-(

    (Actually, rather than fix the documentation we probably ought to fix
    the code --- there's enough infrastructure in libpq now that it could
    tell whether it needs to start its own transaction or not.)

    regards, tom lane

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-general @
categoriespostgresql
postedJul 14, '08 at 4:24p
activeJul 14, '08 at 4:47p
posts2
users2
websitepostgresql.org
irc#postgresql

2 users in discussion

Tom Lane: 1 post Markus Mehrwald: 1 post

People

Translate

site design / logo © 2022 Grokbase