@@ -3,7 +3,7 @@ doc/src/sgml/ref/prepare.sgml
3
3
PostgreSQL documentation
4
4
-->
5
5
6
- <refentry id="SQL-PREPARE ">
6
+ <refentry id="sql-prepare ">
7
7
<!--==========================orignal english content==========================
8
8
<indexterm zone="sql-prepare">
9
9
<primary>PREPARE</primary>
@@ -86,19 +86,19 @@ ____________________________________________________________________________-->
86
86
Prepared statements can take parameters: values that are
87
87
substituted into the statement when it is executed. When creating
88
88
the prepared statement, refer to parameters by position, using
89
- <literal>$1</>, <literal>$2</>, etc. A corresponding list of
89
+ <literal>$1</literal >, <literal>$2</literal >, etc. A corresponding list of
90
90
parameter data types can optionally be specified. When a
91
91
parameter's data type is not specified or is declared as
92
92
<literal>unknown</literal>, the type is inferred from the context
93
- in which the parameter is used (if possible). When executing the
93
+ in which the parameter is first referenced (if possible). When executing the
94
94
statement, specify the actual values for these parameters in the
95
95
<command>EXECUTE</command> statement. Refer to <xref
96
96
linkend="sql-execute"> for more
97
97
information about that.
98
98
</para>
99
99
____________________________________________________________________________-->
100
100
<para>
101
- 预备语句可以接受参数:在执行时会被替换到语句中的值。在创建预备语句时,可以用位置引用参数,如<literal>$1</literal>、<literal>$2</literal>等。也可以选择性地指定参数数据类型的一个列表。当一个参数的数据类型没有被指定或者被声明为<literal>unknown</literal>时,其类型会从该参数被使用的环境中推知 (如果可能)。在执行该语句时,在<command>EXECUTE</command>语句中为这些参数指定实际值。更多有关于此的信息可参考<xref linkend="sql-execute"/>。
101
+ 预备语句可以接受参数:在执行时会被替换到语句中的值。在创建预备语句时,可以用位置引用参数,如<literal>$1</literal>、<literal>$2</literal>等。也可以选择性地指定参数数据类型的一个列表。当一个参数的数据类型没有被指定或者被声明为<literal>unknown</literal>时,其类型会从该参数第一次被引用的环境中推知 (如果可能)。在执行该语句时,在<command>EXECUTE</command>语句中为这些参数指定实际值。更多有关于此的信息可参考<xref linkend="sql-execute"/>。
102
102
</para>
103
103
104
104
<!--==========================orignal english content==========================
@@ -171,13 +171,13 @@ ____________________________________________________________________________-->
171
171
The data type of a parameter to the prepared statement. If the
172
172
data type of a particular parameter is unspecified or is
173
173
specified as <literal>unknown</literal>, it will be inferred
174
- from the context in which the parameter is used . To refer to the
174
+ from the context in which the parameter is first referenced . To refer to the
175
175
parameters in the prepared statement itself, use
176
176
<literal>$1</literal>, <literal>$2</literal>, etc.
177
177
</para>
178
178
____________________________________________________________________________-->
179
179
<para>
180
- 预备语句一个参数的数据类型。如果一个特定参数的数据类型没有被指定或者被指定为<literal>unknown</literal>,将从该参数被使用的环境中推得 。要在预备语句本身中引用参数,可以使用
180
+ 预备语句一个参数的数据类型。如果一个特定参数的数据类型没有被指定或者被指定为<literal>unknown</literal>,将从该参数第一次被引用的环境中推得 。要在预备语句本身中引用参数,可以使用
181
181
<literal>$1</literal>、<literal>$2</literal>等。
182
182
</para>
183
183
</listitem>
@@ -191,8 +191,8 @@ ____________________________________________________________________________-->
191
191
<listitem>
192
192
<!--==========================orignal english content==========================
193
193
<para>
194
- Any <command>SELECT</>, <command>INSERT</>, <command>UPDATE</>,
195
- <command>DELETE</>, or <command>VALUES</> statement.
194
+ Any <command>SELECT</command >, <command>INSERT</command >, <command>UPDATE</command >,
195
+ <command>DELETE</command >, or <command>VALUES</command > statement.
196
196
</para>
197
197
____________________________________________________________________________-->
198
198
<para>
@@ -203,7 +203,7 @@ ____________________________________________________________________________-->
203
203
</variablelist>
204
204
</refsect1>
205
205
206
- <refsect1 id="SQL-PREPARE -notes">
206
+ <refsect1 id="sql-prepare -notes">
207
207
<!--==========================orignal english content==========================
208
208
<title>Notes</title>
209
209
____________________________________________________________________________-->
@@ -249,9 +249,9 @@ ____________________________________________________________________________-->
249
249
<para>
250
250
To examine the query plan <productname>PostgreSQL</productname> is using
251
251
for a prepared statement, use <xref linkend="sql-explain">, e.g.
252
- <command>EXPLAIN EXECUTE</>.
252
+ <command>EXPLAIN EXECUTE</command >.
253
253
If a generic plan is in use, it will contain parameter symbols
254
- <literal>$<replaceable>n</></literal>, while a custom plan will have the
254
+ <literal>$<replaceable>n</replaceable ></literal>, while a custom plan will have the
255
255
supplied parameter values substituted into it.
256
256
The row estimates in the generic plan reflect the selectivity
257
257
computed for the parameters.
@@ -276,21 +276,21 @@ ____________________________________________________________________________-->
276
276
<!--==========================orignal english content==========================
277
277
<para>
278
278
Although the main point of a prepared statement is to avoid repeated parse
279
- analysis and planning of the statement, <productname>PostgreSQL</> will
279
+ analysis and planning of the statement, <productname>PostgreSQL</productname > will
280
280
force re-analysis and re-planning of the statement before using it
281
281
whenever database objects used in the statement have undergone
282
282
definitional (DDL) changes since the previous use of the prepared
283
283
statement. Also, if the value of <xref linkend="guc-search-path"> changes
284
284
from one use to the next, the statement will be re-parsed using the new
285
- <varname>search_path</>. (This latter behavior is new as of
285
+ <varname>search_path</varname >. (This latter behavior is new as of
286
286
<productname>PostgreSQL</productname> 9.3.) These rules make use of a
287
287
prepared statement semantically almost equivalent to re-submitting the
288
288
same query text over and over, but with a performance benefit if no object
289
289
definitions are changed, especially if the best plan remains the same
290
290
across uses. An example of a case where the semantic equivalence is not
291
291
perfect is that if the statement refers to a table by an unqualified name,
292
292
and then a new table of the same name is created in a schema appearing
293
- earlier in the <varname>search_path</>, no automatic re-parse will occur
293
+ earlier in the <varname>search_path</varname >, no automatic re-parse will occur
294
294
since no object used in the statement changed. However, if some other
295
295
change forces a re-parse, the new table will be referenced in subsequent
296
296
uses.
@@ -349,7 +349,7 @@ EXECUTE usrrptplan(1, current_date);
349
349
</programlisting>
350
350
351
351
Note that the data type of the second parameter is not specified,
352
- so it is inferred from the context in which <literal>$2</> is used.
352
+ so it is inferred from the context in which <literal>$2</literal > is used.
353
353
</para>
354
354
____________________________________________________________________________-->
355
355
<para>
0 commit comments