From 0c35c9e630348731e17a6322a935a00b22eb9c19 Mon Sep 17 00:00:00 2001 From: Mitar Date: Sun, 14 Jan 2024 00:46:00 +0100 Subject: [PATCH] Revert "Document max read and write sizes for large objects" This reverts commit b99e2bb7e0818428092e955cb0ee9cff45504bfd. --- large_objects.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/large_objects.go b/large_objects.go index 67666745..c238ab9c 100644 --- a/large_objects.go +++ b/large_objects.go @@ -67,10 +67,6 @@ type LargeObject struct { } // Write writes p to the large object and returns the number of bytes written and an error if not all of p was written. -// -// Write is implemented with a single call to lowrite. The PostgreSQL wire protocol has a limit of 1 GB - 1 per message. -// See definition of PQ_LARGE_MESSAGE_LIMIT in the PostgreSQL source code. To allow for the other data in the message, -// len(p) should be no larger than 1 GB - 1 KB. func (o *LargeObject) Write(p []byte) (int, error) { var n int err := o.tx.QueryRow(o.ctx, "select lowrite($1, $2)", o.fd, p).Scan(&n) @@ -86,10 +82,6 @@ func (o *LargeObject) Write(p []byte) (int, error) { } // Read reads up to len(p) bytes into p returning the number of bytes read. -// -// Read is implemented with a single call to loread. PostgreSQL internally allocates a single buffer for the response. -// The largest buffer PostgreSQL will allocate is 1 GB - 1. See definition of MaxAllocSize in the PostgreSQL source -// code. To allow for the other data in the message, len(p) should be no larger than 1 GB - 1 KB. func (o *LargeObject) Read(p []byte) (int, error) { var res []byte err := o.tx.QueryRow(o.ctx, "select loread($1, $2)", o.fd, len(p)).Scan(&res)