From 0763a5650147a5573a5a4b81de5dd819f010f8e8 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Sat, 3 Mar 2007 19:52:47 +0000 Subject: Add lo_truncate() to backend and libpq for large object truncation. Kris Jurka --- doc/src/sgml/lobj.sgml | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'doc/src') diff --git a/doc/src/sgml/lobj.sgml b/doc/src/sgml/lobj.sgml index 06137e4f270..3619b504f06 100644 --- a/doc/src/sgml/lobj.sgml +++ b/doc/src/sgml/lobj.sgml @@ -1,4 +1,4 @@ - + Large Objects @@ -301,6 +301,37 @@ int lo_tell(PGconn *conn, int fd); + +Truncating a Large Object + + + To truncate a large object to a given length, call + +int lo_truncate(PGcon *conn, int fd, size_t len); + + lo_truncate truncates the large object + descriptor fd to length len. The + fd argument must have been returned by a + previous lo_open. If len is + greater than the current large object length, the large object + is extended with null bytes ('\0'). + + + + The file offset is not changed. + + + + On success lo_truncate returns + zero. On error, the return value is negative. + + + + lo_truncate is new as of PostgreSQL + 8.3; if this function is run against an older server version, it will + fail and return a negative value. + + Closing a Large Object Descriptor -- cgit v1.2.3