@@ -117,9 +117,9 @@ ________________________________________________________-->
117
117
118
118
<programlisting>
119
119
CREATE FUNCTION <replaceable>funcname</replaceable> (<replaceable>argument-list</replaceable>)
120
- 返回 <replaceable>return-type</replaceable>
120
+ RETURNS <replaceable>return-type</replaceable>
121
121
AS $$
122
- # PL/Python函数体
122
+ # PL/Python function body
123
123
$$ LANGUAGE plpython3u;
124
124
</programlisting>
125
125
</para>
@@ -929,7 +929,7 @@ AS $$
929
929
self.value = v
930
930
return named_value(name, value)
931
931
932
- # 或者简单地
932
+ # or simply
933
933
class nv: pass
934
934
nv.name = name
935
935
nv.value = value
@@ -1104,8 +1104,8 @@ CREATE TYPE greeting AS (
1104
1104
CREATE FUNCTION greet (how text)
1105
1105
RETURNS SETOF greeting
1106
1106
AS $$
1107
- # 返回包含列表的元组作为复合类型
1108
- # 所有其他组合也可以工作
1107
+ # return tuple containing lists as composite types
1108
+ # all other combinations work also
1109
1109
return ( [ how, "World" ], [ how, "PostgreSQL" ], [ how, "PL/Python" ] )
1110
1110
$$ LANGUAGE plpython3u;
1111
1111
</programlisting>
@@ -1257,7 +1257,7 @@ ________________________________________________________-->
1257
1257
1258
1258
<programlisting>
1259
1259
DO $$
1260
- # PL/Python 代码
1260
+ # PL/Python code
1261
1261
$$ LANGUAGE plpython3u;
1262
1262
</programlisting>
1263
1263
@@ -2078,13 +2078,13 @@ try:
2078
2078
plan = plpy.prepare("INSERT INTO fractions (frac) VALUES ($1 / $2)", ["int", "int"])
2079
2079
plpy.execute(plan, [numerator, denominator])
2080
2080
except spiexceptions.DivisionByZero:
2081
- return "分母不能为零 "
2081
+ return "denominator cannot equal zero "
2082
2082
except spiexceptions.UniqueViolation:
2083
- return "已经有该分数 "
2083
+ return "already have that fraction "
2084
2084
except plpy.SPIError as e:
2085
- return "其他错误, SQLSTATE %s" % e.sqlstate
2085
+ return "other error, SQLSTATE %s" % e.sqlstate
2086
2086
else:
2087
- return "插入分数 "
2087
+ return "fraction inserted "
2088
2088
$$ LANGUAGE plpython3u;
2089
2089
</programlisting>
2090
2090
请注意,由于<literal>plpy.spiexceptions</literal>模块中的所有异常都继承自<literal>SPIError</literal>,
0 commit comments