Skip to content

Commit 3f7fa5c

Browse files
committed
Merge branch 'REL9_5_STABLE' into PGPRO9_5
2 parents 762f78d + 15c2992 commit 3f7fa5c

File tree

18 files changed

+2223
-1464
lines changed

18 files changed

+2223
-1464
lines changed

doc/src/sgml/plpgsql.sgml

Lines changed: 84 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,28 +1441,56 @@ EXECUTE format('UPDATE tbl SET %I = $1 WHERE key = $2', colname)
14411441
GET <optional> CURRENT </optional> DIAGNOSTICS <replaceable>variable</replaceable> { = | := } <replaceable>item</replaceable> <optional> , ... </optional>;
14421442
</synopsis>
14431443

1444-
This command allows retrieval of system status indicators. Each
1445-
<replaceable>item</replaceable> is a key word identifying a status
1446-
value to be assigned to the specified variable (which should be
1447-
of the right data type to receive it). The currently available
1448-
status items are <varname>ROW_COUNT</>, the number of rows
1449-
processed by the last <acronym>SQL</acronym> command sent to
1450-
the <acronym>SQL</acronym> engine, and <varname>RESULT_OID</>,
1451-
the OID of the last row inserted by the most recent
1452-
<acronym>SQL</acronym> command. Note that <varname>RESULT_OID</>
1453-
is only useful after an <command>INSERT</command> command into a
1454-
table containing OIDs.
1455-
Colon-equal (<literal>:=</>) can be used instead of SQL-standard
1456-
<literal>=</> for <command>GET DIAGNOSTICS</>.
1457-
</para>
1458-
1459-
<para>
1460-
An example:
1444+
This command allows retrieval of system status indicators.
1445+
<literal>CURRENT</> is a noise word (but see also <command>GET STACKED
1446+
DIAGNOSTICS</command> in <xref linkend="plpgsql-exception-diagnostics">).
1447+
Each <replaceable>item</replaceable> is a key word identifying a status
1448+
value to be assigned to the specified <replaceable>variable</replaceable>
1449+
(which should be of the right data type to receive it). The currently
1450+
available status items are shown
1451+
in <xref linkend="plpgsql-current-diagnostics-values">. Colon-equal
1452+
(<literal>:=</>) can be used instead of the SQL-standard <literal>=</>
1453+
token. An example:
14611454
<programlisting>
14621455
GET DIAGNOSTICS integer_var = ROW_COUNT;
14631456
</programlisting>
14641457
</para>
14651458

1459+
<table id="plpgsql-current-diagnostics-values">
1460+
<title>Available Diagnostics Items</title>
1461+
<tgroup cols="3">
1462+
<thead>
1463+
<row>
1464+
<entry>Name</entry>
1465+
<entry>Type</entry>
1466+
<entry>Description</entry>
1467+
</row>
1468+
</thead>
1469+
<tbody>
1470+
<row>
1471+
<entry><varname>ROW_COUNT</varname></entry>
1472+
<entry><type>integer</></entry>
1473+
<entry>the number of rows processed by the most
1474+
recent <acronym>SQL</acronym> command</entry>
1475+
</row>
1476+
<row>
1477+
<entry><varname>RESULT_OID</varname></entry>
1478+
<entry><type>oid</></entry>
1479+
<entry>the OID of the last row inserted by the most
1480+
recent <acronym>SQL</acronym> command (only useful after
1481+
an <command>INSERT</command> command into a table having
1482+
OIDs)</entry>
1483+
</row>
1484+
<row>
1485+
<entry><literal>PG_CONTEXT</literal></entry>
1486+
<entry><type>text</></entry>
1487+
<entry>line(s) of text describing the current call stack
1488+
(see <xref linkend="plpgsql-call-stack">)</entry>
1489+
</row>
1490+
</tbody>
1491+
</tgroup>
1492+
</table>
1493+
14661494
<para>
14671495
The second method to determine the effects of a command is to check the
14681496
special variable named <literal>FOUND</literal>, which is of
@@ -1828,13 +1856,13 @@ SELECT * FROM get_available_flightid(CURRENT_DATE);
18281856
<application>PL/pgSQL</> has three forms of <command>IF</>:
18291857
<itemizedlist>
18301858
<listitem>
1831-
<para><literal>IF ... THEN</></>
1859+
<para><literal>IF ... THEN ... END IF</></>
18321860
</listitem>
18331861
<listitem>
1834-
<para><literal>IF ... THEN ... ELSE</></>
1862+
<para><literal>IF ... THEN ... ELSE ... END IF</></>
18351863
</listitem>
18361864
<listitem>
1837-
<para><literal>IF ... THEN ... ELSIF ... THEN ... ELSE</></>
1865+
<para><literal>IF ... THEN ... ELSIF ... THEN ... ELSE ... END IF</></>
18381866
</listitem>
18391867
</itemizedlist>
18401868

@@ -2699,13 +2727,14 @@ GET STACKED DIAGNOSTICS <replaceable>variable</replaceable> { = | := } <replacea
26992727
</synopsis>
27002728

27012729
Each <replaceable>item</replaceable> is a key word identifying a status
2702-
value to be assigned to the specified variable (which should be
2703-
of the right data type to receive it). The currently available
2704-
status items are shown in <xref linkend="plpgsql-exception-diagnostics-values">.
2730+
value to be assigned to the specified <replaceable>variable</replaceable>
2731+
(which should be of the right data type to receive it). The currently
2732+
available status items are shown
2733+
in <xref linkend="plpgsql-exception-diagnostics-values">.
27052734
</para>
27062735

27072736
<table id="plpgsql-exception-diagnostics-values">
2708-
<title>Error Diagnostics Values</title>
2737+
<title>Error Diagnostics Items</title>
27092738
<tgroup cols="3">
27102739
<thead>
27112740
<row>
@@ -2717,53 +2746,54 @@ GET STACKED DIAGNOSTICS <replaceable>variable</replaceable> { = | := } <replacea
27172746
<tbody>
27182747
<row>
27192748
<entry><literal>RETURNED_SQLSTATE</literal></entry>
2720-
<entry>text</entry>
2749+
<entry><type>text</></entry>
27212750
<entry>the SQLSTATE error code of the exception</entry>
27222751
</row>
27232752
<row>
27242753
<entry><literal>COLUMN_NAME</literal></entry>
2725-
<entry>text</entry>
2754+
<entry><type>text</></entry>
27262755
<entry>the name of the column related to exception</entry>
27272756
</row>
27282757
<row>
27292758
<entry><literal>CONSTRAINT_NAME</literal></entry>
2730-
<entry>text</entry>
2759+
<entry><type>text</></entry>
27312760
<entry>the name of the constraint related to exception</entry>
27322761
</row>
27332762
<row>
27342763
<entry><literal>PG_DATATYPE_NAME</literal></entry>
2735-
<entry>text</entry>
2764+
<entry><type>text</></entry>
27362765
<entry>the name of the data type related to exception</entry>
27372766
</row>
27382767
<row>
27392768
<entry><literal>MESSAGE_TEXT</literal></entry>
2740-
<entry>text</entry>
2769+
<entry><type>text</></entry>
27412770
<entry>the text of the exception's primary message</entry>
27422771
</row>
27432772
<row>
27442773
<entry><literal>TABLE_NAME</literal></entry>
2745-
<entry>text</entry>
2774+
<entry><type>text</></entry>
27462775
<entry>the name of the table related to exception</entry>
27472776
</row>
27482777
<row>
27492778
<entry><literal>SCHEMA_NAME</literal></entry>
2750-
<entry>text</entry>
2779+
<entry><type>text</></entry>
27512780
<entry>the name of the schema related to exception</entry>
27522781
</row>
27532782
<row>
27542783
<entry><literal>PG_EXCEPTION_DETAIL</literal></entry>
2755-
<entry>text</entry>
2784+
<entry><type>text</></entry>
27562785
<entry>the text of the exception's detail message, if any</entry>
27572786
</row>
27582787
<row>
27592788
<entry><literal>PG_EXCEPTION_HINT</literal></entry>
2760-
<entry>text</entry>
2789+
<entry><type>text</></entry>
27612790
<entry>the text of the exception's hint message, if any</entry>
27622791
</row>
27632792
<row>
27642793
<entry><literal>PG_EXCEPTION_CONTEXT</literal></entry>
2765-
<entry>text</entry>
2766-
<entry>line(s) of text describing the call stack</entry>
2794+
<entry><type>text</></entry>
2795+
<entry>line(s) of text describing the call stack at the time of the
2796+
exception (see <xref linkend="plpgsql-call-stack">)</entry>
27672797
</row>
27682798
</tbody>
27692799
</tgroup>
@@ -2794,26 +2824,19 @@ END;
27942824
</sect3>
27952825
</sect2>
27962826

2797-
<sect2 id="plpgsql-get-diagnostics-context">
2798-
<title>Obtaining Current Execution Information</title>
2827+
<sect2 id="plpgsql-call-stack">
2828+
<title>Obtaining Execution Location Information</title>
27992829

28002830
<para>
2801-
The <command>GET <optional> CURRENT </optional> DIAGNOSTICS</command>
2802-
command retrieves information about current execution state (whereas
2803-
the <command>GET STACKED DIAGNOSTICS</command> command discussed above
2804-
reports information about the execution state as of a previous error).
2805-
This command has the form:
2806-
</para>
2807-
2808-
<synopsis>
2809-
GET <optional> CURRENT </optional> DIAGNOSTICS <replaceable>variable</replaceable> { = | := } <replaceable>item</replaceable> <optional> , ... </optional>;
2810-
</synopsis>
2811-
2812-
<para>
2813-
Currently only one information item is supported. Status
2814-
item <literal>PG_CONTEXT</> will return a text string with line(s) of
2815-
text describing the call stack. The first line refers to the
2816-
current function and currently executing <command>GET DIAGNOSTICS</command>
2831+
The <command>GET DIAGNOSTICS</command> command, previously described
2832+
in <xref linkend="plpgsql-statements-diagnostics">, retrieves information
2833+
about current execution state (whereas the <command>GET STACKED
2834+
DIAGNOSTICS</command> command discussed above reports information about
2835+
the execution state as of a previous error). Its <literal>PG_CONTEXT</>
2836+
status item is useful for identifying the current execution
2837+
location. <literal>PG_CONTEXT</> returns a text string with line(s)
2838+
of text describing the call stack. The first line refers to the current
2839+
function and currently executing <command>GET DIAGNOSTICS</command>
28172840
command. The second and any subsequent lines refer to calling functions
28182841
further up the call stack. For example:
28192842

@@ -2847,6 +2870,12 @@ CONTEXT: PL/pgSQL function outer_func() line 3 at RETURN
28472870
</programlisting>
28482871

28492872
</para>
2873+
2874+
<para>
2875+
<literal>GET STACKED DIAGNOSTICS ... PG_EXCEPTION_CONTEXT</literal>
2876+
returns the same sort of stack trace, but describing the location
2877+
at which an error was detected, rather than the current location.
2878+
</para>
28502879
</sect2>
28512880
</sect1>
28522881

@@ -4225,7 +4254,7 @@ SELECT * FROM sales_summary_bytime;
42254254
</para>
42264255

42274256
<para>
4228-
When a <application>PL/pgSQL</application> function is called as a
4257+
When a <application>PL/pgSQL</application> function is called as an
42294258
event trigger, several special variables are created automatically
42304259
in the top-level block. They are:
42314260

@@ -4253,7 +4282,7 @@ SELECT * FROM sales_summary_bytime;
42534282
</para>
42544283

42554284
<para>
4256-
<xref linkend="plpgsql-event-trigger-example"> shows an example of a
4285+
<xref linkend="plpgsql-event-trigger-example"> shows an example of an
42574286
event trigger procedure in <application>PL/pgSQL</application>.
42584287
</para>
42594288

doc/src/sgml/ref/pg_receivexlog.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ doc/src/sgml/ref/pg_receivexlog.sgml
9696
<term><option>--if-not-exists</option></term>
9797
<listitem>
9898
<para>
99-
Do not not error out when <option>--create-slot</option> is specified
99+
Do not error out when <option>--create-slot</option> is specified
100100
and a slot with the specified name already exists.
101101
</para>
102102
</listitem>

doc/src/sgml/ref/pg_recvlogical.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ doc/src/sgml/ref/pg_recvlogical.sgml
158158
<term><option>--if-not-exists</option></term>
159159
<listitem>
160160
<para>
161-
Do not not error out when <option>--create-slot</option> is specified
161+
Do not error out when <option>--create-slot</option> is specified
162162
and a slot with the specified name already exists.
163163
</para>
164164
</listitem>

doc/src/sgml/release-9.4.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7308,7 +7308,7 @@ Branch: REL9_4_STABLE [c2b06ab17] 2015-01-30 22:45:58 -0500
73087308
<listitem>
73097309
<para>
73107310
Add ability to retrieve the current PL/PgSQL call stack
7311-
using <link linkend="plpgsql-get-diagnostics-context"><command>GET
7311+
using <link linkend="plpgsql-call-stack"><command>GET
73127312
DIAGNOSTICS</></link>
73137313
(Pavel Stehule, Stephen Frost)
73147314
</para>

src/backend/utils/misc/postgresql.conf.sample

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@
6262
# (change requires restart)
6363
#port = 5432 # (change requires restart)
6464
#max_connections = 100 # (change requires restart)
65-
# Note: Increasing max_connections costs ~400 bytes of shared memory per
66-
# connection slot, plus lock space (see max_locks_per_transaction).
6765
#superuser_reserved_connections = 3 # (change requires restart)
6866
#unix_socket_directories = '/tmp' # comma-separated list of directories
6967
# (change requires restart)
@@ -119,10 +117,8 @@
119117
#temp_buffers = 8MB # min 800kB
120118
#max_prepared_transactions = 0 # zero disables the feature
121119
# (change requires restart)
122-
# Note: Increasing max_prepared_transactions costs ~600 bytes of shared memory
123-
# per transaction slot, plus lock space (see max_locks_per_transaction).
124-
# It is not advisable to set max_prepared_transactions nonzero unless you
125-
# actively intend to use prepared transactions.
120+
# Caution: it is not advisable to set max_prepared_transactions nonzero unless
121+
# you actively intend to use prepared transactions.
126122
#work_mem = 4MB # min 64kB
127123
#maintenance_work_mem = 64MB # min 1MB
128124
#autovacuum_work_mem = -1 # min 1MB, or -1 to use maintenance_work_mem
@@ -573,9 +569,6 @@
573569
#deadlock_timeout = 1s
574570
#max_locks_per_transaction = 64 # min 10
575571
# (change requires restart)
576-
# Note: Each lock table slot uses ~270 bytes of shared memory, and there are
577-
# max_locks_per_transaction * (max_connections + max_prepared_transactions)
578-
# lock table slots.
579572
#max_pred_locks_per_transaction = 64 # min 10
580573
# (change requires restart)
581574

src/bin/initdb/findtimezone.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ pg_load_tz(const char *name)
9999
*/
100100
if (strcmp(name, "GMT") == 0)
101101
{
102-
if (tzparse(name, &tz.state, TRUE) != 0)
102+
if (!tzparse(name, &tz.state, true))
103103
{
104104
/* This really, really should not happen ... */
105105
return NULL;
106106
}
107107
}
108-
else if (tzload(name, NULL, &tz.state, TRUE) != 0)
108+
else if (tzload(name, NULL, &tz.state, true) != 0)
109109
{
110-
if (name[0] == ':' || tzparse(name, &tz.state, FALSE) != 0)
110+
if (name[0] == ':' || !tzparse(name, &tz.state, false))
111111
{
112112
return NULL; /* unknown timezone */
113113
}

src/timezone/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ include $(top_builddir)/src/Makefile.global
1919
OBJS= localtime.o strftime.o pgtz.o
2020

2121
# files needed to build zic utility program
22-
ZICOBJS= zic.o ialloc.o scheck.o localtime.o $(WIN32RES)
22+
ZICOBJS= zic.o $(WIN32RES)
2323

2424
# timezone data files
2525
TZDATA = africa antarctica asia australasia europe northamerica southamerica \

0 commit comments

Comments
 (0)