Some copy editing of pg_read_binary_file() patch.
authorRobert Haas
Thu, 16 Dec 2010 02:02:31 +0000 (21:02 -0500)
committerRobert Haas
Thu, 16 Dec 2010 02:02:31 +0000 (21:02 -0500)
doc/src/sgml/func.sgml
src/backend/utils/adt/genfile.c

index 7c1ba9d07f2fa7e523216e7382da8386602ad3c8..1485ac05511ed1ab30c4eadc62e4a5b5609e88bb 100644 (file)
@@ -14489,19 +14489,21 @@ postgres=# SELECT * FROM pg_xlogfile_name_offset(pg_stop_backup());
     at the given offset, returning at most length
     bytes (less if the end of file is reached first).  If offset
     is negative, it is relative to the end of the file.
-    When offset and length parameters are omitted,
-    it returns the whole of the file.
-    The part of a file must be a valid text in the server encoding.
+    If offset and length are omitted, the entire
+    file is returned.  The bytes read from the file are interpreted as a string
+    in the server encoding; an error is thrown if they are not valid in that
+    encoding.
    
 
    
     pg_read_binary_file
    
    
-    pg_read_binary_file returns part of a file as like as
-    pg_read_file, but the result is a bytea value.
-    One of the usages is to read a file in the specified encoding combined with
-    convert_from function:
+    pg_read_binary_file is similar to
+    pg_read_file, except that the result is a bytea value;
+    accordingly, no encoding checks are performed.
+    In combination with the convert_from function, this function
+    can be used to read a file in a specified encoding:
 
 SELECT convert_from(pg_read_binary_file('file_in_utf8.txt'), 'UTF8');
     
index e9212500c231c4839de40cf74913477b679a0710..8a9012e0546a92c1bb18c8e4d51ce56c16612d46 100644 (file)
@@ -152,7 +152,7 @@ read_binary_file(text *filename_t, int64 seek_offset, int64 bytes_to_read)
 }
 
 /*
- * In addition to read_binary_file, verify whether the contents are encoded
+ * Similar to read_binary_file, but we verify that the contents are valid
  * in the database encoding.
  */
 static text *
@@ -163,7 +163,7 @@ read_text_file(text *filename, int64 seek_offset, int64 bytes_to_read)
    /* Make sure the input is valid */
    pg_verifymbstr(VARDATA(buf), VARSIZE(buf) - VARHDRSZ, false);
 
-   /* OK, we can cast it as text safely */
+   /* OK, we can cast it to text safely */
    return (text *) buf;
 }