Skip to content

Commit a648140

Browse files
committed
from ref/create_extension.sgml to ref/drop_collation.sgml except ref/create_index.sgml, ref/create_language.sgml, ref/create_table.sgml
1 parent 4fcfc32 commit a648140

27 files changed

+316
-232
lines changed

postgresql/doc/src/sgml/ref/create_extension.sgml

Lines changed: 86 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,13 @@ ____________________________________________________________________________-->
4343
CREATE EXTENSION [ IF NOT EXISTS ] <replaceable class="parameter">extension_name</replaceable>
4444
[ WITH ] [ SCHEMA <replaceable class="parameter">schema_name</replaceable> ]
4545
[ VERSION <replaceable class="parameter">version</replaceable> ]
46-
[ FROM <replaceable class="parameter">old_version</replaceable> ]
4746
[ CASCADE ]
4847
</synopsis>
4948
____________________________________________________________________________-->
5049
<synopsis>
5150
CREATE EXTENSION [ IF NOT EXISTS ] <replaceable class="parameter">extension_name</replaceable>
5251
[ WITH ] [ SCHEMA <replaceable class="parameter">schema_name</replaceable> ]
5352
[ VERSION <replaceable class="parameter">version</replaceable> ]
54-
[ FROM <replaceable class="parameter">old_version</replaceable> ]
5553
[ CASCADE ]
5654
</synopsis>
5755
</refsynopsisdiv>
@@ -93,19 +91,37 @@ ____________________________________________________________________________-->
9391

9492
<!--==========================orignal english content==========================
9593
<para>
96-
Loading an extension requires the same privileges that would be
97-
required to create its component objects. For most extensions this
98-
means superuser or database owner privileges are needed.
9994
The user who runs <command>CREATE EXTENSION</command> becomes the
100-
owner of the extension for purposes of later privilege checks, as well
101-
as the owner of any objects created by the extension's script.
95+
owner of the extension for purposes of later privilege checks, and
96+
normally also becomes the owner of any objects created by the
97+
extension's script.
10298
</para>
10399
____________________________________________________________________________-->
104100
<para>
105-
载入一个扩展要求创建其组件对象所要求的特权。对于大部分扩展这意味
106-
这需要超级用户或者数据库拥有者的特权。为了以后特权检察的目的,运行
107-
<command>CREATE EXTENSION</command>的用户会成为该扩展的
108-
拥有者以及由该扩展的脚本创建的任何对象的拥有者。
101+
运行<command>CREATE EXTENSION</command>的用户成为扩展的所有者,
102+
以进行以后的特权检查,并且通常也成为由扩展的脚本创建的任何对象的所有者。
103+
</para>
104+
<!--==========================orignal english content==========================
105+
<para>
106+
Loading an extension ordinarily requires the same privileges that would
107+
be required to create its component objects. For many extensions this
108+
means superuser privileges are needed.
109+
However, if the extension is marked <firstterm>trusted</firstterm> in
110+
its control file, then it can be installed by any user who has
111+
<literal>CREATE</literal> privilege on the current database.
112+
In this case the extension object itself will be owned by the calling
113+
user, but the contained objects will be owned by the bootstrap superuser
114+
(unless the extension's script explicitly assigns them to the calling
115+
user). This configuration gives the calling user the right to drop the
116+
extension, but not to modify individual objects within it.
117+
</para>
118+
____________________________________________________________________________-->
119+
<para>
120+
通常,加载扩展需要与创建扩展组件对象所需的特权相同的特权。 对于许多扩展,这意味着需要超级用户特权。
121+
但是,如果扩展名在其控制文件中标记为<firstterm>trusted</firstterm>,则该扩展名可以由对当前
122+
数据库具有<literal>CREATE</literal>特权的任何用户安装。
123+
在这种情况下,扩展对象本身将由主叫用户拥有,但是包含的对象将由引导超级用户拥有(除非扩展的脚本将其明确分配给主叫用户)。
124+
此配置使呼叫用户有权删除该扩展名,但不能修改其中的单个对象。
109125
</para>
110126

111127
</refsect1>
@@ -245,59 +261,6 @@ ____________________________________________________________________________-->
245261
</listitem>
246262
</varlistentry>
247263

248-
<varlistentry>
249-
<!--==========================orignal english content==========================
250-
<term><replaceable class="parameter">old_version</replaceable></term>
251-
____________________________________________________________________________-->
252-
<term><replaceable class="parameter">old_version</replaceable></term>
253-
<listitem>
254-
<!--==========================orignal english content==========================
255-
<para>
256-
<literal>FROM</literal> <replaceable class="parameter">old_version</replaceable>
257-
must be specified when, and only when, you are attempting to install
258-
an extension that replaces an <quote>old style</quote> module that is just
259-
a collection of objects not packaged into an extension. This option
260-
causes <command>CREATE EXTENSION</command> to run an alternative installation
261-
script that absorbs the existing objects into the extension, instead
262-
of creating new objects. Be careful that <literal>SCHEMA</literal> specifies
263-
the schema containing these pre-existing objects.
264-
</para>
265-
____________________________________________________________________________-->
266-
<para>
267-
当且仅当尝试要安装一个扩展来替代一个<quote>老式</quote>
268-
的模块(它只是一组没有被打包成扩展的对象的集合)时,
269-
才必须指定
270-
<literal>FROM</literal> <replaceable class="parameter">old_version</replaceable>。
271-
这个选项导致<command>CREATE EXTENSION</command>运行
272-
另一个安装脚本把现有的对象吸收到该扩展中,而不是创建
273-
新对象。当心<literal>SCHEMA</literal>指定的是包含已经存在
274-
对象的模式。
275-
</para>
276-
277-
<!--==========================orignal english content==========================
278-
<para>
279-
The value to use for <replaceable
280-
class="parameter">old_version</replaceable> is determined by the
281-
extension's author, and might vary if there is more than one version
282-
of the old-style module that can be upgraded into an extension.
283-
For the standard additional modules supplied with pre-9.1
284-
<productname>PostgreSQL</productname>, use <literal>unpackaged</literal>
285-
for <replaceable class="parameter">old_version</replaceable> when
286-
updating a module to extension style.
287-
</para>
288-
____________________________________________________________________________-->
289-
<para>
290-
用于<replaceable
291-
class="parameter">old_version</replaceable>的值由扩展的作者决定,
292-
且如果有多于一种版本的老式模块可以被升级到扩展,该值还可能变化。
293-
对于 9.1 之前的<productname>PostgreSQL</productname>提供的
294-
标准附加模块,在升级模块到扩展风格时要为
295-
<replaceable class="parameter">old_version</replaceable>使用
296-
<literal>unpackaged</literal>。
297-
</para>
298-
</listitem>
299-
</varlistentry>
300-
301264
<varlistentry>
302265
<!--==========================orignal english content==========================
303266
<term><literal>CASCADE</literal></term>
@@ -365,6 +328,53 @@ ____________________________________________________________________________-->
365328
中看到。
366329
</para>
367330

331+
<caution>
332+
<!--==========================orignal english content==========================
333+
<para>
334+
Installing an extension as superuser requires trusting that the
335+
extension's author wrote the extension installation script in a secure
336+
fashion. It is not terribly difficult for a malicious user to create
337+
trojan-horse objects that will compromise later execution of a
338+
carelessly-written extension script, allowing that user to acquire
339+
superuser privileges. However, trojan-horse objects are only hazardous
340+
if they are in the <varname>search_path</varname> during script
341+
execution, meaning that they are in the extension's installation target
342+
schema or in the schema of some extension it depends on. Therefore, a
343+
good rule of thumb when dealing with extensions whose scripts have not
344+
been carefully vetted is to install them only into schemas for which
345+
CREATE privilege has not been and will not be granted to any untrusted
346+
users. Likewise for any extensions they depend on.
347+
</para>
348+
____________________________________________________________________________-->
349+
<para>
350+
以超级用户身份安装扩展程序需要相信扩展程序的作者以安全的方式编写了扩展程序安装脚本。
351+
对于恶意用户而言,创建特洛伊木马对象并不困难,而这些特洛伊木马对象会损害以后粗心编写
352+
的扩展脚本的执行,从而使该用户获得超级用户特权。但是,仅当木马对象在脚本执行期间位于
353+
<varname>search_path</varname>中时,它们才是危险的,这意味着它们位于扩展的安装
354+
目标模式或它依赖的某些扩展的模式中。因此,在处理未经仔细审查其脚本的扩展时,一个好的
355+
经验法则是仅将其安装到尚未具有CREATE特权且不会授予任何不可信用户的模式中。
356+
对它们依赖的任何扩展也是一样。
357+
</para>
358+
359+
<!--==========================orignal english content==========================
360+
<para>
361+
The extensions supplied with <productname>PostgreSQL</productname> are
362+
believed to be secure against installation-time attacks of this sort,
363+
except for a few that depend on other extensions. As stated in the
364+
documentation for those extensions, they should be installed into secure
365+
schemas, or installed into the same schemas as the extensions they
366+
depend on, or both.
367+
</para>
368+
____________________________________________________________________________-->
369+
<para>
370+
针对此类安装时攻击,<productname>PostgreSQL</productname>提供的插件可以认为是
371+
针对这种安装时攻击的安全,除了少数插件依赖于其它的扩展。如这些扩展的文档中所述,应将
372+
它们安装到安全模式中,或与它们所依赖的扩展安装在相同的模式中,或拓展和其依赖都安装到
373+
安全模式。
374+
</para>
375+
376+
</caution>
377+
368378
<!--==========================orignal english content==========================
369379
<para>
370380
For information about writing new extensions, see
@@ -385,37 +395,30 @@ ____________________________________________________________________________-->
385395
<!--==========================orignal english content==========================
386396
<para>
387397
Install the <link linkend="hstore">hstore</link> extension into the
388-
current database:
398+
current database, placing its objects in schema <literal>addons</literal>:
389399
<programlisting>
390-
CREATE EXTENSION hstore;
400+
CREATE EXTENSION hstore SCHEMA addons;
391401
</programlisting>
392-
</para>
393-
____________________________________________________________________________-->
394-
<para>
395-
安装<link linkend="hstore">hstore</link>扩展到当前数据库中:
402+
Another way to accomplish the same thing:
396403
<programlisting>
404+
SET search_path = addons;
397405
CREATE EXTENSION hstore;
398406
</programlisting>
399407
</para>
400-
401-
<!--==========================orignal english content==========================
408+
____________________________________________________________________________-->
402409
<para>
403-
Update a pre-9.1 installation of <literal>hstore</literal> into
404-
extension style:
410+
安装<link linkend="hstore">hstore</link>扩展到当前数据库中,将其对象放置在
411+
<literal>addons</literal>模式中:
405412
<programlisting>
406-
CREATE EXTENSION hstore SCHEMA public FROM unpackaged;
413+
CREATE EXTENSION hstore SCHEMA addons;
407414
</programlisting>
408-
Be careful to specify the schema in which you installed the existing
409-
<literal>hstore</literal> objects.
410-
</para>
411-
____________________________________________________________________________-->
412-
<para>
413-
升级一个 9.1 之前的<literal>hstore</literal>安装成为扩展:
415+
另一种方法:
414416
<programlisting>
415-
CREATE EXTENSION hstore SCHEMA public FROM unpackaged;
417+
SET search_path = addons;
418+
CREATE EXTENSION hstore;
416419
</programlisting>
417-
要小心地指定安装现有<literal>hstore</literal>对象的模式。
418420
</para>
421+
419422
</refsect1>
420423

421424
<refsect1>

postgresql/doc/src/sgml/ref/create_foreign_table.sgml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
<!-- doc/src/sgml/ref/create_foreign_table.sgml -->
1+
<!--
2+
doc/src/sgml/ref/create_foreign_table.sgml
3+
PostgreSQL documentation
4+
-->
25

36
<refentry id="sql-createforeigntable">
47
<!--==========================orignal english content==========================
@@ -750,9 +753,9 @@ CREATE FOREIGN TABLE measurement_y2016m07
750753

751754
<refsect1 id="sql-createforeigntable-compatibility">
752755
<!--==========================orignal english content==========================
753-
<title id="sql-createforeigntable-compatibility-title">Compatibility</title>
756+
<title>Compatibility</title>
754757
____________________________________________________________________________-->
755-
<title id="sql-createforeigntable-compatibility-title">兼容性</title>
758+
<title>兼容性</title>
756759

757760
<!--==========================orignal english content==========================
758761
<para>

postgresql/doc/src/sgml/ref/create_function.sgml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<!--
22
doc/src/sgml/ref/create_function.sgml
3+
PostgreSQL documentation
34
-->
45

56
<refentry id="sql-createfunction">
@@ -430,7 +431,7 @@ ____________________________________________________________________________-->
430431
The name of the language that the function is implemented in.
431432
It can be <literal>sql</literal>, <literal>c</literal>,
432433
<literal>internal</literal>, or the name of a user-defined
433-
procedural language, e.g. <literal>plpgsql</literal>. Enclosing the
434+
procedural language, e.g., <literal>plpgsql</literal>. Enclosing the
434435
name in single quotes is deprecated and requires matching case.
435436
</para>
436437
____________________________________________________________________________-->
@@ -702,11 +703,11 @@ ____________________________________________________________________________-->
702703
Functions should be labeled parallel unsafe if they modify any database
703704
state, or if they make changes to the transaction such as using
704705
sub-transactions, or if they access sequences or attempt to make
705-
persistent changes to settings (e.g. <literal>setval</literal>). They should
706+
persistent changes to settings (e.g., <literal>setval</literal>). They should
706707
be labeled as parallel restricted if they access temporary tables,
707708
client connection state, cursors, prepared statements, or miscellaneous
708709
backend-local state which the system cannot synchronize in parallel mode
709-
(e.g. <literal>setseed</literal> cannot be executed other than by the group
710+
(e.g., <literal>setseed</literal> cannot be executed other than by the group
710711
leader because a change made by another process would not be reflected
711712
in the leader). In general, if a function is labeled as being safe when
712713
it is restricted or unsafe, or if it is labeled as being restricted when

postgresql/doc/src/sgml/ref/create_group.sgml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ CREATE GROUP <replaceable class="parameter">name</replaceable> [ [ WITH ] <repla
4949
| CREATEROLE | NOCREATEROLE
5050
| INHERIT | NOINHERIT
5151
| LOGIN | NOLOGIN
52-
| [ ENCRYPTED ] PASSWORD '<replaceable class="parameter">password</replaceable>'
52+
| REPLICATION | NOREPLICATION
53+
| BYPASSRLS | NOBYPASSRLS
54+
| CONNECTION LIMIT <replaceable class="parameter">connlimit</replaceable>
55+
| [ ENCRYPTED ] PASSWORD '<replaceable class="parameter">password</replaceable>' | PASSWORD NULL
5356
| VALID UNTIL '<replaceable class="parameter">timestamp</replaceable>'
5457
| IN ROLE <replaceable class="parameter">role_name</replaceable> [, ...]
5558
| IN GROUP <replaceable class="parameter">role_name</replaceable> [, ...]
@@ -69,7 +72,10 @@ CREATE GROUP <replaceable class="parameter">name</replaceable> [ [ WITH ] <repla
6972
| CREATEROLE | NOCREATEROLE
7073
| INHERIT | NOINHERIT
7174
| LOGIN | NOLOGIN
72-
| [ ENCRYPTED ] PASSWORD '<replaceable class="parameter">password</replaceable>'
75+
| REPLICATION | NOREPLICATION
76+
| BYPASSRLS | NOBYPASSRLS
77+
| CONNECTION LIMIT <replaceable class="parameter">connlimit</replaceable>
78+
| [ ENCRYPTED ] PASSWORD '<replaceable class="parameter">password</replaceable>' | PASSWORD NULL
7379
| VALID UNTIL '<replaceable class="parameter">timestamp</replaceable>'
7480
| IN ROLE <replaceable class="parameter">role_name</replaceable> [, ...]
7581
| IN GROUP <replaceable class="parameter">role_name</replaceable> [, ...]

postgresql/doc/src/sgml/ref/create_materialized_view.sgml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,18 +196,18 @@ ____________________________________________________________________________-->
196196
<!--==========================orignal english content==========================
197197
<para>
198198
This clause specifies optional storage parameters for the new
199-
materialized view; see <xref linkend="sql-createtable-storage-parameters"
200-
endterm="sql-createtable-storage-parameters-title"/> for more
199+
materialized view; see
200+
<xref linkend="sql-createtable-storage-parameters"/> in the
201+
<xref linkend="sql-createtable"/> documentation for more
201202
information. All parameters supported for <literal>CREATE
202203
TABLE</literal> are also supported for <literal>CREATE MATERIALIZED
203204
VIEW</literal>.
204205
See <xref linkend="sql-createtable"/> for more information.
205206
</para>
206207
____________________________________________________________________________-->
207208
<para>
208-
这个子句为新的物化视图指定可选的存储参数,详见
209-
<xref linkend="sql-createtable-storage-parameters"
210-
endterm="sql-createtable-storage-parameters-title"/>。所有<literal>CREATE
209+
这个子句为新的物化视图指定可选的存储参数,详见<xref linkend="sql-createtable"/>的
210+
<xref linkend="sql-createtable-storage-parameters"/>。所有<literal>CREATE
211211
TABLE</literal>支持的参数<literal>CREATE MATERIALIZED
212212
VIEW</literal>也支持。
213213
详见<xref linkend="sql-createtable"/>。

postgresql/doc/src/sgml/ref/create_opclass.sgml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -317,18 +317,20 @@ ____________________________________________________________________________-->
317317
function is intended to support, if different from
318318
the input data type(s) of the function (for B-tree comparison functions
319319
and hash functions)
320-
or the class's data type (for B-tree sort support functions and all
321-
functions in GiST, SP-GiST, GIN and BRIN operator classes). These defaults
322-
are correct, and so <replaceable
323-
class="parameter">op_type</replaceable> need not be specified in
324-
<literal>FUNCTION</literal> clauses, except for the case of a B-tree sort
325-
support function that is meant to support cross-data-type comparisons.
320+
or the class's data type (for B-tree sort support functions,
321+
B-tree equal image functions, and all functions in GiST,
322+
SP-GiST, GIN and BRIN operator classes). These defaults are
323+
correct, and so <replaceable
324+
class="parameter">op_type</replaceable> need not be specified
325+
in <literal>FUNCTION</literal> clauses, except for the case of a
326+
B-tree sort support function that is meant to support
327+
cross-data-type comparisons.
326328
</para>
327329
____________________________________________________________________________-->
328330
<para>
329331
在一个<literal>FUNCTION</literal>子句中,这表示该函数要支持的操作数
330332
数据类型,如果它与该函数的输入数据类型(对于 B-树比较函数和哈希
331-
函数)或者操作符类的数据类型(对于 B-树排序支持函数和所有GiST
333+
函数)或者操作符类的数据类型(对于 B-树排序支持函数和与B-树相同的的图像函数以及所有GiST
332334
SP-GiST、GIN 和 BRIN 操作符类中的函数)不同。这些默认值是正确的,并且
333335
<replaceable class="parameter">op_type</replaceable>因此不必
334336
在<literal>FUNCTION</literal>子句中被指定,对于 B-树排序支持函数的情

0 commit comments

Comments
 (0)