132 (
errcode(ERRCODE_UNDEFINED_OBJECT),
133 errmsg(
"invalid large-object descriptor: %d",
fd)));
161 (
errcode(ERRCODE_UNDEFINED_OBJECT),
162 errmsg(
"invalid large-object descriptor: %d",
fd)));
172 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
173 errmsg(
"large object descriptor %d was not opened for reading",
189 (
errcode(ERRCODE_UNDEFINED_OBJECT),
190 errmsg(
"invalid large-object descriptor: %d",
fd)));
196 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
197 errmsg(
"large object descriptor %d was not opened for writing",
215 (
errcode(ERRCODE_UNDEFINED_OBJECT),
216 errmsg(
"invalid large-object descriptor: %d",
fd)));
221 if (status != (
int32) status)
223 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
224 errmsg(
"lo_lseek result out of range for large-object descriptor %d",
240 (
errcode(ERRCODE_UNDEFINED_OBJECT),
241 errmsg(
"invalid large-object descriptor: %d",
fd)));
282 (
errcode(ERRCODE_UNDEFINED_OBJECT),
283 errmsg(
"invalid large-object descriptor: %d",
fd)));
288 if (offset != (
int32) offset)
290 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
291 errmsg(
"lo_tell result out of range for large-object descriptor %d",
305 (
errcode(ERRCODE_UNDEFINED_OBJECT),
306 errmsg(
"invalid large-object descriptor: %d",
fd)));
328 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
329 errmsg(
"must be owner of large object %u", lobjId)));
439 errmsg(
"could not open server file \"%s\": %m",
462 errmsg(
"could not read server file \"%s\": %m",
470 errmsg(
"could not close file \"%s\": %m",
521 errmsg(
"could not create server file \"%s\": %m",
533 errmsg(
"could not write server file \"%s\": %m",
540 errmsg(
"could not close file \"%s\": %m",
559 (
errcode(ERRCODE_UNDEFINED_OBJECT),
560 errmsg(
"invalid large-object descriptor: %d",
fd)));
566 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
567 errmsg(
"large object descriptor %d was not opened for writing",
660 if (lo != NULL && lo->
subid == mySubid)
663 lo->
subid = parentSubid;
747 bytea *result = NULL;
756 loSize =
inv_seek(loDesc, 0, SEEK_END);
759 if (nbytes >= 0 && nbytes <= loSize - offset)
760 result_length = nbytes;
762 result_length = loSize - offset;
773 (
errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
774 errmsg(
"large object read request is too large")));
780 Assert(total_read == result_length);
815 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
816 errmsg(
"requested length cannot be negative")));
bool object_ownercheck(Oid classid, Oid objectid, Oid roleid)
Datum be_lo_lseek(PG_FUNCTION_ARGS)
Datum be_loread(PG_FUNCTION_ARGS)
static MemoryContext fscxt
Datum be_lo_get(PG_FUNCTION_ARGS)
static void closeLOfd(int fd)
Datum be_lo_export(PG_FUNCTION_ARGS)
void AtEOXact_LargeObject(bool isCommit)
Datum be_lo_unlink(PG_FUNCTION_ARGS)
Datum be_lo_import_with_oid(PG_FUNCTION_ARGS)
Datum be_lo_truncate64(PG_FUNCTION_ARGS)
Datum be_lo_lseek64(PG_FUNCTION_ARGS)
Datum be_lo_tell64(PG_FUNCTION_ARGS)
int lo_write(int fd, const char *buf, int len)
Datum be_lo_from_bytea(PG_FUNCTION_ARGS)
int lo_read(int fd, char *buf, int len)
static Oid lo_import_internal(text *filename, Oid lobjOid)
Datum be_lowrite(PG_FUNCTION_ARGS)
Datum be_lo_creat(PG_FUNCTION_ARGS)
Datum be_lo_put(PG_FUNCTION_ARGS)
Datum be_lo_truncate(PG_FUNCTION_ARGS)
Datum be_lo_create(PG_FUNCTION_ARGS)
static bool lo_cleanup_needed
static bytea * lo_get_fragment_internal(Oid loOid, int64 offset, int32 nbytes)
Datum be_lo_tell(PG_FUNCTION_ARGS)
Datum be_lo_import(PG_FUNCTION_ARGS)
Datum be_lo_get_fragment(PG_FUNCTION_ARGS)
static LargeObjectDesc ** cookies
Datum be_lo_close(PG_FUNCTION_ARGS)
static void lo_truncate_internal(int32 fd, int64 len)
void AtEOSubXact_LargeObject(bool isCommit, SubTransactionId mySubid, SubTransactionId parentSubid)
Datum be_lo_open(PG_FUNCTION_ARGS)
#define PG_USED_FOR_ASSERTS_ONLY
#define Assert(condition)
int errcode_for_file_access(void)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
int CloseTransientFile(int fd)
int OpenTransientFile(const char *fileName, int fileFlags)
int OpenTransientFilePerm(const char *fileName, int fileFlags, mode_t fileMode)
#define PG_GETARG_BYTEA_PP(n)
#define PG_GETARG_TEXT_PP(n)
#define PG_RETURN_BYTEA_P(x)
#define PG_RETURN_INT64(x)
#define PG_GETARG_INT64(n)
#define PG_RETURN_INT32(x)
#define PG_GETARG_INT32(n)
void inv_truncate(LargeObjectDesc *obj_desc, int64 len)
LargeObjectDesc * inv_open(Oid lobjId, int flags, MemoryContext mcxt)
int inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes)
Oid inv_create(Oid lobjId)
int64 inv_seek(LargeObjectDesc *obj_desc, int64 offset, int whence)
void close_lo_relation(bool isCommit)
int inv_write(LargeObjectDesc *obj_desc, const char *buf, int nbytes)
int64 inv_tell(LargeObjectDesc *obj_desc)
bool lo_compat_privileges
void inv_close(LargeObjectDesc *obj_desc)
MemoryContext TopMemoryContext
void * MemoryContextAllocZero(MemoryContext context, Size size)
MemoryContext CurrentMemoryContext
void MemoryContextDelete(MemoryContext context)
#define AllocSetContextCreate
#define ALLOCSET_DEFAULT_SIZES
#define repalloc0_array(pointer, type, oldcount, count)
static PgChecksumMode mode
static int fd(const char *x, int i)
ResourceOwner TopTransactionResourceOwner
void UnregisterSnapshotFromOwner(Snapshot snapshot, ResourceOwner owner)
Snapshot RegisterSnapshotOnOwner(Snapshot snapshot, ResourceOwner owner)
void PreventCommandIfReadOnly(const char *cmdname)
#define SET_VARSIZE(PTR, len)
#define VARSIZE_ANY_EXHDR(PTR)
void text_to_cstring_buffer(const text *src, char *dst, size_t dst_len)
SubTransactionId GetCurrentSubTransactionId(void)