Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit290f160

Browse files
committed
Some copy editing of pg_read_binary_file() patch.
1 parentafc8f47 commit290f160

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

‎doc/src/sgml/func.sgml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14489,19 +14489,21 @@ postgres=# SELECT * FROM pg_xlogfile_name_offset(pg_stop_backup());
1448914489
at the given <parameter>offset</>, returning at most <parameter>length</>
1449014490
bytes (less if the end of file is reached first). If <parameter>offset</>
1449114491
is negative, it is relative to the end of the file.
14492-
When <parameter>offset</> and <parameter>length</> parameters are omitted,
14493-
it returns the whole of the file.
14494-
The part of a file must be a valid text in the server encoding.
14492+
If <parameter>offset</> and <parameter>length</> are omitted, the entire
14493+
file is returned. The bytes read from the file are interpreted as a string
14494+
in the server encoding; an error is thrown if they are not valid in that
14495+
encoding.
1449514496
</para>
1449614497

1449714498
<indexterm>
1449814499
<primary>pg_read_binary_file</primary>
1449914500
</indexterm>
1450014501
<para>
14501-
<function>pg_read_binary_file</> returns part of a file as like as
14502-
<function>pg_read_file</>, but the result is a bytea value.
14503-
One of the usages is to read a file in the specified encoding combined with
14504-
<function>convert_from</> function:
14502+
<function>pg_read_binary_file</> is similar to
14503+
<function>pg_read_file</>, except that the result is a bytea value;
14504+
accordingly, no encoding checks are performed.
14505+
In combination with the <function>convert_from</> function, this function
14506+
can be used to read a file in a specified encoding:
1450514507
<programlisting>
1450614508
SELECT convert_from(pg_read_binary_file('file_in_utf8.txt'), 'UTF8');
1450714509
</programlisting>

‎src/backend/utils/adt/genfile.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ read_binary_file(text *filename_t, int64 seek_offset, int64 bytes_to_read)
152152
}
153153

154154
/*
155-
*In additionto read_binary_file, verifywhether the contents areencoded
155+
*Similarto read_binary_file,but weverifythat the contents arevalid
156156
* in the database encoding.
157157
*/
158158
statictext*
@@ -163,7 +163,7 @@ read_text_file(text *filename, int64 seek_offset, int64 bytes_to_read)
163163
/* Make sure the input is valid */
164164
pg_verifymbstr(VARDATA(buf),VARSIZE(buf)-VARHDRSZ, false);
165165

166-
/* OK, we can cast itas text safely */
166+
/* OK, we can cast itto text safely */
167167
return (text*)buf;
168168
}
169169

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp