Thread: Simple C++ program using libpq that failes very quickly using the lo interface

For me, using the postgres snap, I got yesterday from (march 11)
ftp.postgresql.org,
the following test program cut from test/examples/lotest.c
failes on the 16th file.

The dummy files are named after their size/512 bytes.
The log file message I get is, included in the tar file.

Note: I don't seem to have any problems if I use lo_import and lo_export
The problem of course is that I don't want my data to have to go through tmp files
on it's way in or out of postgres.

the program only requires libpq and the postgres include directory.
Usage:
lotest [-u dbuser (null)] [-p password(null)] [-P port (null)] [-d dbname(prod)] [-h host(null)] dummy/*
I use it
createdb tmp
lotest -u jason -d tmp dummy/*
lotest -u jason -d tmp dummy/*
can't create large objectimport of dummy/01 failed
can't create large objectimport of dummy/02 failed
imported dummy/03 to 88837
imported dummy/04 to 88852
imported dummy/05 to 88867
imported dummy/06 to 88883
imported dummy/07 to 88899
imported dummy/08 to 88915
imported dummy/09 to 88931
imported dummy/10 to 88948
imported dummy/11 to 88965
imported dummy/12 to 88982
imported dummy/13 to 89000
imported dummy/14 to 89018
imported dummy/15 to 89036
error while writing lo for "dummy/16", got back -1, wanted 2048 : No such file or directory
import of dummy/16 failed
can't create large objectimport of dummy/17 failed
can't create large objectimport of dummy/18 failed
can't create large objectimport of dummy/19 failed
can't create large objectimport of dummy/20 failed
END command failed



begin 600 testfile.tar.gz
M'XL("&M\Z38``W1E<W1F:6QE+G1A<@#MW?U3VT8:!_#\:OT53YQ)D8G!\CLU
MI3,I(3WF6B`DZ<T=81A96F,ULN1*,I"V^=_OV=5*MK$<DS;J3*??S]T0O-IW
MK=:KE9KX82+B9-=Q'I6G:5F]3H<>$5&WTU9_$EGZ3VI:O6Z;J-?KMUK];K/7
MYZ!FN]M\1%:)=<K-XL2.B![];,=A\(EXMV,A_+^B0G^M)U[@^#-7T#=QXOK>
M<'?\K;$4YH7W@R(ON%X.&SE!XB\'S0*/$R^%53G[Z2\[([$[KMX/;>AC<7IL
M1(]=,?("X9K?O7WY^OA_1S7C21I".H!:5F?/>"("UQL91F/;H&WR)M,P2EYZ
MOJ`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2X-SMN5Z5[+0X=J8]1\
M+SX<=%NBU^G62>ZN'^RU]WI?]VKE/%O[.W!GD\F'1KEE4,?J=[OKGO^E'[+W
M_SO-COQ/`KKMSB/JEENMU#_\^5]Z_JUFF65\^K__X+-M+9[_M@SI]UIX_@M0
M-GW]M\HL8\/UWRJ\_CNX_@$`RJ3G_W:996R8_]N%\W\/\S\``$!9]/=_I\PR
M-GS_=XJ^__MX_Q\```"@%'K]5^JCU@WKOV[A^@_/_P``````OCB]_N^56<:&
M]7^O</V/]W\```````"^*'W_UR^SC`WW?_W"^S^\_PL```````#PQ>C[_[TR
MR]CT[_^NWO_+O^<*]_\``````````%^"WO_YNLPR-NS_%/S]OTVKV<;^#P``
M````````P)^5[O\U2]UJV[#_5_#O_W`*_/T?`````````````'^*WO]MEEG&
MAOW?@G__5Z;`_B\`````````````P!^E]_];99:Q8?^_L[S_W\'?_PD`````
M`````````/`GZ.<_[3++V/#\IUOX_`=__S<```````````````#`9]//_SIE
MEK'A^5^O\/E?%\__```````````````````^AW[^VRVSC`W/?_N%SW_[>/X+
M``````````````````#P4/KY?Z_,,C[]_+]E%3[_;^'Y/P``````````````
M`````,!#Z/<_^F66L>']CV;A^Q\=O/\!`````````````````````+")?O]G
MK\PR-KS_TRI\_Z>']W\````````````````````````^1;__]76996QX_ZM=
M]/Y7R\+[7P````````````````````````#KI.__M4I]U6[#^W^=PK__K8GW
D_P````````````````````````````````#^#U%&F=X`"`(`
`
end