Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
3b6ca54c
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3b6ca54c
编写于
1月 15, 2003
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
This patch includes some minor fixes and improvements to the SGML docs
for PL/PgSQL. Neil Conway
上级
ecbd8daa
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
32 addition
and
41 deletion
+32
-41
doc/src/sgml/plpgsql.sgml
doc/src/sgml/plpgsql.sgml
+32
-41
未找到文件。
doc/src/sgml/plpgsql.sgml
浏览文件 @
3b6ca54c
<
!--
$
Header
:
/
cvsroot
/
pgsql
/
doc
/
src
/
sgml
/
plpgsql
.
sgml
,
v
1.1
2
2002
/
11
/
23
03
:
59
:
05
momjian
Exp
$
$
Header
:
/
cvsroot
/
pgsql
/
doc
/
src
/
sgml
/
plpgsql
.
sgml
,
v
1.1
3
2003
/
01
/
15
16
:
40
:
24
momjian
Exp
$
-->
<
chapter
id
=
"plpgsql"
>
...
...
@@ -68,6 +68,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/plpgsql.sgml,v 1.12 2002/11/23 03:59:05 mom
<acronym>SQL</acronym> expressions and <acronym>SQL</acronym> queries
used in the function are not translated immediately.
</para>
<para>
As each expression and <acronym>SQL</acronym> query is first used
in the function, the <application>PL/pgSQL</> interpreter creates
...
...
@@ -84,12 +85,13 @@ $Header: /cvsroot/pgsql/doc/src/sgml/plpgsql.sgml,v 1.12 2002/11/23 03:59:05 mom
that
errors
in
a
specific
expression
or
query
may
not
be
detected
until
that
part
of
the
function
is
reached
in
execution
.
</
para
>
<
para
>
Once
<
application
>
PL
/
pgSQL
</>
has
made
a
query
plan
for
a
particular
query
in
a
function
,
it
will
re
-
use
that
plan
for
the
life
of
the
database
connection
.
This
is
usually
a
win
for
performance
,
but
it
can
cause
some
problems
if
you
dynamically
alter
your
database
schema
.
For
example
:
<
para
>
Once
<
application
>
PL
/
pgSQL
</>
has
made
a
query
plan
for
a
particular
query
in
a
function
,
it
will
re
-
use
that
plan
for
the
life
of
the
database
connection
.
This
is
usually
a
win
for
performance
,
but
it
can
cause
some
problems
if
you
dynamically
alter
your
database
schema
.
For
example
:
<
programlisting
>
CREATE
FUNCTION
populate
()
RETURNS
INTEGER
AS
'
...
...
@@ -100,6 +102,7 @@ BEGIN
END;
'
LANGUAGE
'plpgsql'
;
</
programlisting
>
If
you
execute
the
above
function
,
it
will
reference
the
OID
for
<
function
>
my_function
()</
function
>
in
the
query
plan
produced
for
the
<
command
>
PERFORM
</
command
>
statement
.
Later
,
if
you
...
...
@@ -107,7 +110,11 @@ END;
<
function
>
populate
()</
function
>
will
not
be
able
to
find
<
function
>
my_function
()</
function
>
anymore
.
You
would
then
have
to
re
-
create
<
function
>
populate
()</
function
>,
or
at
least
start
a
new
database
session
so
that
it
will
be
compiled
afresh
.
database
session
so
that
it
will
be
compiled
afresh
.
Another
way
to
avoid
this
problem
is
to
use
<
command
>
CREATE
OR
REPLACE
FUNCTION
</
command
>
when
updating
the
definition
of
<
function
>
my_function
</
function
>
(
when
a
function
is
<
quote
>
replaced
</
quote
>,
its
OID
is
not
changed
).
</
para
>
<
para
>
...
...
@@ -221,35 +228,17 @@ END;
<
title
>
Developing
in
<
application
>
PL
/
pgSQL
</
application
></
title
>
<
para
>
Developing
in
<
application
>
PL
/
pgSQL
</
application
>
is
pretty
straight
forward
,
especially
if
you
have
developed
in
other
database
procedural
languages
,
such
as
Oracle
's <application>PL/SQL</application>. Two good ways of developing in
<application>PL/pgSQL</application> are:
<itemizedlist>
<listitem>
<para>
Using a text editor and reloading the file with <command>psql</command>
</para>
</listitem>
<listitem>
<para>
Using <productname>PostgreSQL</>'
s
GUI
Tool
:
<
application
>
PgAccess
</>
</
para
>
</
listitem
>
</
itemizedlist
>
</
para
>
<
para
>
One
good
way
to
develop
in
<
application
>
PL
/
pgSQL
</>
is
to
simply
use
the
text
editor
of
your
choice
to
create
your
functions
,
and
in
another
window
,
use
<
command
>
psql
</
command
>
(<
productname
>
PostgreSQL
</>
's interactive monitor) to load those
functions. If you are doing it this way, it is a good idea to
write the function using <command>CREATE OR REPLACE
FUNCTION</>. That way you can reload the file to update the
function definition. For example:
Developing
in
<
application
>
PL
/
pgSQL
</
application
>
is
pretty
straight
forward
,
especially
if
you
have
developed
in
other
database
procedural
languages
,
such
as
Oracle
's
<application>PL/SQL</application>. One good way to develop in
<application>PL/pgSQL</> is to simply use the text editor of your
choice to create your functions, and in another window, use
<command>psql</command> (<productname>PostgreSQL</>'
s
interactive
monitor
)
to
load
those
functions
.
If
you
are
doing
it
this
way
,
it
is
a
good
idea
to
write
the
function
using
<
command
>
CREATE
OR
REPLACE
FUNCTION
</>.
That
way
you
can
reload
the
file
to
update
the
function
definition
.
For
example
:
<
programlisting
>
CREATE
OR
REPLACE
FUNCTION
testfunc
(
INTEGER
)
RETURNS
INTEGER
AS
'
....
...
...
@@ -268,10 +257,12 @@ end;
</
para
>
<
para
>
Another good way to develop in <application>PL/pgSQL</> is using
<productname>PostgreSQL</>'
s
GUI
tool
:
<
application
>
PgAccess
</>.
It
does
some
nice
things
for
you
,
like
escaping
single
-
quotes
,
and
making
it
easy
to
recreate
and
debug
functions
.
Another
good
way
to
develop
in
<
application
>
PL
/
pgSQL
</>
is
using
a
GUI
database
access
tool
that
facilitates
development
in
a
procedural
language
.
One
example
of
such
as
a
tool
is
<
application
>
PgAccess
</>,
although
others
exist
.
These
tools
often
provide
convenient
features
such
as
escaping
single
-
quotes
,
and
making
it
easier
to
recreate
and
debug
functions
.
</
para
>
</
sect2
>
</
sect1
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录