Reputation: 1446
I am getting an error with Postgres 10 when trying to delete a large object ERROR: large object 16709 does not exist
even though I can show 16709
does exist. I don't know if it is relevant, but the large object was created using pyscopg2
on Python 3.
EDIT: I confirmed that I can still fetch the data from the database, and that it is correct. I just can't delete it.
tagger1=# select l.oid from pg_largeobject_metadata l where l.oid = 16709;
oid
-------
16709
(1 row)
tagger1=# select count(1) from pg_largeobject where loid = 16709;
count
-------
747
(1 row)
tagger1=# select lo_unlink(16709) from pg_largeobject;
ERROR: large object 16709 does not exist
Upvotes: 2
Views: 9682
Reputation: 246103
Simply omit the FROM
clause:
SELECT lo_unlink(16709);
The problem is that your statement tries to run this for every row in pg_largeobject
, but after the first execution the large object is already gone.
Upvotes: 4