Commit 5dbf4898 authored by Tom Lane's avatar Tom Lane

Add compatibility note warning that plpgsql is now stricter about the column

datatypes of composite results, per gripe from Marcel Asio.  Some desultory
copy-editing of plpgsql-related sections of the release notes.
parent b57ddccf
<!-- $PostgreSQL: pgsql/doc/src/sgml/release-9.0.sgml,v 2.35 2010/06/24 18:33:05 rhaas Exp $ --> <!-- $PostgreSQL: pgsql/doc/src/sgml/release-9.0.sgml,v 2.36 2010/06/29 21:20:19 tgl Exp $ -->
<sect1 id="release-9-0"> <sect1 id="release-9-0">
<title>Release 9.0</title> <title>Release 9.0</title>
...@@ -30,10 +30,11 @@ ...@@ -30,10 +30,11 @@
<listitem> <listitem>
<para> <para>
Built-in, binary, log-based replication. This advance consists of two features: Built-in, binary, log-based replication. This advance consists of two
Hot Standby allows continuous archive standby database servers to accept read-only features: Hot Standby allows continuous archive standby database servers
queries, and Streaming Replication allows continuous archive (<acronym>WAL</>) files to accept read-only queries, and Streaming Replication allows continuous
to be streamed over a network port to a standby database server. archive (<acronym>WAL</>) files to be streamed over a network port to a
standby database server.
</para> </para>
</listitem> </listitem>
...@@ -54,8 +55,9 @@ ...@@ -54,8 +55,9 @@
Broadly enhanced stored procedure support. Broadly enhanced stored procedure support.
The <link linkend="SQL-DO"><command>DO</></link> statement permits The <link linkend="SQL-DO"><command>DO</></link> statement permits
ad-hoc or anonymous code blocks. Functions can now be called using named ad-hoc or anonymous code blocks. Functions can now be called using named
parameters. PL/pgSQL is now installed by default, and PL/Perl and PL/Python parameters. PL/pgSQL is now installed by default, and PL/Perl and
have been enhanced in several ways, including support for Python3. PL/Python have been enhanced in several ways, including support for
Python3.
</para> </para>
</listitem> </listitem>
...@@ -63,7 +65,7 @@ ...@@ -63,7 +65,7 @@
<para> <para>
Triggers now support two new features, Triggers now support two new features,
SQL-compliant <link SQL-compliant <link
linkend="SQL-CREATETRIGGER">per-column triggers</link>, and linkend="SQL-CREATETRIGGER">per-column triggers</link>, and
conditional trigger execution. conditional trigger execution.
</para> </para>
</listitem> </listitem>
...@@ -86,7 +88,7 @@ ...@@ -86,7 +88,7 @@
<listitem> <listitem>
<para> <para>
The <link linkend="SQL-LISTEN"><command>LISTEN</></link>/<link The <link linkend="SQL-LISTEN"><command>LISTEN</></link>/<link
linkend="SQL-NOTIFY"><command>NOTIFY</></link> linkend="SQL-NOTIFY"><command>NOTIFY</></link>
feature has been overhauled to make it into feature has been overhauled to make it into
a high-performance event queuing system. It now stores a high-performance event queuing system. It now stores
events in a memory-based queue, and it now allows delivery events in a memory-based queue, and it now allows delivery
...@@ -134,16 +136,17 @@ ...@@ -134,16 +136,17 @@
<para> <para>
A dump/restore using <application>pg_dump</application> A dump/restore using <application>pg_dump</application>
or use of <application>pg_upgrade</application> is required or use of <application>pg_upgrade</application> is required
for those wishing to migrate data from any previous for those wishing to migrate data from any previous
release. release.
</para> </para>
<para> <para>
Version 9.0 contains a number of changes which selectively break backwards compatibility Version 9.0 contains a number of changes which selectively break backwards
in order to support new features and code quality improvements. Particularly, users compatibility in order to support new features and code quality
who make extensive use of PL/pgSQL and/or PITR and Warm Standby should test their improvements. Particularly, users who make extensive use of PL/pgSQL
solutions for breakage. Observe the following incompatibilities: and/or PITR and Warm Standby should test their solutions for breakage.
Observe the following incompatibilities:
</para> </para>
<sect3> <sect3>
...@@ -270,15 +273,15 @@ ...@@ -270,15 +273,15 @@
<listitem> <listitem>
<para> <para>
No longer change function input variable names via <command>CREATE OR REPLACE FUNCTION</command> can no longer change
<command>REPLACE FUNCTION</command>(Pavel Stehule). the declared names of function parameters (Pavel Stehule)
</para> </para>
<para> <para>
In order to support names parameter calls, it is In order to support named-parameter calls, it is
no longer possible to change the aliases for input variables no longer allowed to change the aliases for input variables
in the function declaration in place. You now have to <command>DROP in the declaration of an existing function. You now have to
</command> and recreate the function. <command>DROP</command> and recreate the function.
</para> </para>
</listitem> </listitem>
...@@ -287,46 +290,65 @@ ...@@ -287,46 +290,65 @@
</sect3> </sect3>
<sect3> <sect3>
<title>PL/pgSQL Variables</title> <title>PL/pgSQL</title>
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<para> <para>
Have PL/pgSQL throw an error if a variable name conflicts with a PL/pgSQL now throws an error if a variable name conflicts with a
column name used in a query (Tom Lane) column name used in a query (Tom Lane)
</para> </para>
<para> <para>
This behavior can be changed via the server variable <link The former behavior was to bind to variable names in preference to
query column names, which often resulted in surprising misbehavior.
Throwing an error allows easy detection of ambiguous situations.
Although it's recommended that functions encountering this type of
error be modified to remove the conflict, the old behavior can be
restored if necessary via the configuration parameter <link
linkend="plpgsql-var-subst"><varname>plpgsql.variable_conflict</></link>, linkend="plpgsql-var-subst"><varname>plpgsql.variable_conflict</></link>,
or by the per-function option <literal>#variable_conflict</>. or via the per-function option <literal>#variable_conflict</>.
The former behavior was to bind to variable names over
column names, but not consistently. Stored procedures
with naming conflicts will probably need to be refactored.
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
Remove PL/pgSQL's <literal>RENAME</> declaration option (Tom Lane) PL/pgSQL no longer allows variable names that match SQL
reserved words (Tom Lane)
</para> </para>
<para> <para>
Instead, use <link This is a consequence of aligning the PL/pgSQL parser to match the
linkend="plpgsql-declaration-parameters"><literal>ALIAS</></link>, core SQL parser more closely. If necessary,
which can now alias any variable, not just dollar sign variable names can be double-quoted to avoid this restriction.
variables, e.g. <literal>$1</>.
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
PL/pgSQL no longer allows unquoted variables names that match SQL PL/pgSQL now requires columns of composite results to match the
reserved words (Tom Lane) expected type modifier as well as base type (Pavel Stehule, Tom Lane)
</para>
<para>
For example, if a column of the result type is declared as
<literal>NUMERIC(30,2)</>, it is no longer acceptable to return a
<literal>NUMERIC</> of some other precision in that column. Previous
versions neglected to check the type modifier and would thus allow
result rows that didn't actually conform to the declared restrictions.
</para>
</listitem>
<listitem>
<para>
Remove PL/pgSQL's <literal>RENAME</> declaration option (Tom Lane)
</para> </para>
<para> <para>
Variables can be double-quoted to avoid this restriction. Instead of <literal>RENAME</>, use <link
linkend="plpgsql-declaration-alias"><literal>ALIAS</></link>,
which can now alias any variable, not just dollar sign
parameter names (such as <literal>$1</>).
</para> </para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
...@@ -339,12 +361,12 @@ ...@@ -339,12 +361,12 @@
<listitem> <listitem>
<para> <para>
Remove support for platforms that don't have a working 64-bit Remove support for platforms that don't have a working 64-bit
integer data types (Tom Lane) integer data type (Tom Lane)
</para> </para>
<para> <para>
It is believed all supported platforms have working 64-bit integer It is believed all still-supported platforms have working 64-bit
data types. integer data types.
</para> </para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
...@@ -354,7 +376,7 @@ ...@@ -354,7 +376,7 @@
<sect2> <sect2>
<title>Changes</title> <title>Changes</title>
<para> <para>
Version 9.0 has an unprecedented number of new major features, Version 9.0 has an unprecedented number of new major features,
and over 200 enhancements, improvements, new commands, and over 200 enhancements, improvements, new commands,
new functions, and other changes. new functions, and other changes.
</para> </para>
...@@ -423,8 +445,9 @@ ...@@ -423,8 +445,9 @@
<title>Performance</title> <title>Performance</title>
<para> <para>
Version 9.0 also contains several performance and optimizer enhancements to Version 9.0 also contains several performance and optimizer enhancements
improve specific uses of PostgreSQL and remedy certain poor-performing cases. to improve specific uses of PostgreSQL and remedy certain poor-performing
cases.
</para> </para>
<itemizedlist> <itemizedlist>
...@@ -469,7 +492,7 @@ ...@@ -469,7 +492,7 @@
<para> <para>
Outer joins where the inner side is unique and not referenced in Outer joins where the inner side is unique and not referenced in
the query are unnecessary and are therefore now removed. This will the query are unnecessary and are therefore now removed. This will
accelerate many automatically generated queries, such as those created accelerate many automatically generated queries, such as those created
by object-relational mappers. by object-relational mappers.
</para> </para>
...@@ -651,7 +674,7 @@ ...@@ -651,7 +674,7 @@
<sect4> <sect4>
<title>Monitoring</title> <title>Monitoring</title>
<para> <para>
With increased use of PostgreSQL in high-end production systems, With increased use of PostgreSQL in high-end production systems,
users need increased monitoring. PostgresSQL 9.0 continues to add users need increased monitoring. PostgresSQL 9.0 continues to add
more ways to monitor PostgreSQL applications. more ways to monitor PostgreSQL applications.
</para> </para>
...@@ -667,7 +690,7 @@ ...@@ -667,7 +690,7 @@
</para> </para>
<para> <para>
This allows DBAs to characterize database traffic This allows DBAs to characterize database traffic
and troubleshoot problems by source application. and troubleshoot problems by source application.
</para> </para>
</listitem> </listitem>
...@@ -746,7 +769,7 @@ ...@@ -746,7 +769,7 @@
in the new <structname>pg_db_role_setting</> system table. A new in the new <structname>pg_db_role_setting</> system table. A new
<application>psql</> <literal>\drds</> command shows these settings. <application>psql</> <literal>\drds</> command shows these settings.
Backwards-compatible system views do not show this information. Backwards-compatible system views do not show this information.
The primary use of this feature is setting schema The primary use of this feature is setting schema
<link linkend="guc-search-path"><varname>search_path</varname></link>. <link linkend="guc-search-path"><varname>search_path</varname></link>.
</para> </para>
...@@ -863,7 +886,7 @@ ...@@ -863,7 +886,7 @@
</para> </para>
<para> <para>
For drivers which support this feature, this saves an entire For drivers that support this feature, this saves an entire
round-trip to the client, allowing result counts and pagination round-trip to the client, allowing result counts and pagination
to be calculated without a second <command>COUNT</command> query. to be calculated without a second <command>COUNT</command> query.
</para> </para>
...@@ -1057,13 +1080,13 @@ ...@@ -1057,13 +1080,13 @@
TABLE CONSTRAINT ... EXCLUDE</></link> clause. While TABLE CONSTRAINT ... EXCLUDE</></link> clause. While
uniqueness checks could be specified using this syntax, uniqueness checks could be specified using this syntax,
the real value of this feature is in using complex the real value of this feature is in using complex
operators that do not have built-in constraints. operators that do not have built-in constraints.
</para> </para>
<para> <para>
The primary use of exclusion constraints is to allow defining The primary use of exclusion constraints is to allow defining
non-overlapping uniqueness, such as for time periods, arrays non-overlapping uniqueness, such as for time periods, arrays
or ranges of values. This supports data integrity at the or ranges of values. This supports data integrity at the
table level for calendaring, time-management, and scientific table level for calendaring, time-management, and scientific
applications. applications.
</para> </para>
...@@ -1134,7 +1157,7 @@ ...@@ -1134,7 +1157,7 @@
<para> <para>
LISTEN/NOTIFY may now be used as a full-featured, high-performance LISTEN/NOTIFY may now be used as a full-featured, high-performance
event queue system for PostgreSQL, with transactional support event queue system for PostgreSQL, with transactional support
and guaranteed delivery. and guaranteed delivery.
</para> </para>
</listitem> </listitem>
...@@ -1201,7 +1224,7 @@ ...@@ -1201,7 +1224,7 @@
</para> </para>
<para> <para>
The new output formats will support the development of new tools The new output formats will support the development of new tools
for analysis of EXPLAIN output. for analysis of EXPLAIN output.
</para> </para>
</listitem> </listitem>
...@@ -1255,7 +1278,7 @@ ...@@ -1255,7 +1278,7 @@
</para> </para>
<para> <para>
The previous method was usually slower and caused index bloat. The previous method was usually slower and caused index bloat.
Note that the new method may use more disk space during VACUUM Note that the new method may use more disk space during VACUUM
FULL. FULL.
</para> </para>
...@@ -1306,9 +1329,9 @@ ...@@ -1306,9 +1329,9 @@
</para> </para>
<para> <para>
This feature supports GiST indexing of point operations on polygons, This feature supports GiST indexing of point operations on polygons,
circles, and other points, such as "point is in polygon". Previously circles, and other points, such as "point is in polygon". Previously
indexing only worked for bounding boxes. This should make many indexing only worked for bounding boxes. This should make many
PostGIS queries faster. PostGIS queries faster.
</para> </para>
</listitem> </listitem>
...@@ -1688,21 +1711,30 @@ ...@@ -1688,21 +1711,30 @@
<listitem> <listitem>
<para> <para>
Install server-side language PL/pgSQL by default (Bruce Momjian) Install PL/pgSQL by default (Bruce Momjian)
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
Allow PL/pgSQL to handle row types with dropped columns (Pavel Stehule) Improve PL/pgSQL's ability to handle row types with dropped columns
(Pavel Stehule)
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
Allow <literal>IN</> parameters to be assigned values within Allow input parameters to be assigned values within
PL/pgSQL functions (Steve Prentice) PL/pgSQL functions (Steve Prentice)
</para> </para>
<para>
Formerly, input parameters were treated as being declared
<literal>CONST</>. This restriction has been removed to simplify
porting of functions from other DBMSes that do not impose the
equivalent restriction. An input parameter now acts like a local
variable initialized to the passed-in value.
</para>
</listitem> </listitem>
<listitem> <listitem>
...@@ -1713,21 +1745,19 @@ ...@@ -1713,21 +1745,19 @@
<listitem> <listitem>
<para> <para>
Have PL/pgSQL use the main lexer, rather than a custom version (Tom Lane) Make PL/pgSQL use the main lexer, rather than its own version
(Tom Lane)
</para> </para>
</listitem>
</itemizedlist>
</sect4> <para>
This ensures accurate tracking of the main system's behavior for details
<sect4> such as string escaping.
<title><link linkend="plpgsql-cursors">PL/pgSQL Cursors</link></title> </para>
<itemizedlist> </listitem>
<listitem> <listitem>
<para> <para>
Add count and <literal>ALL</> options to <command>MOVE Add <replaceable>count</> and <literal>ALL</> options to <command>MOVE
FORWARD</>/<literal>BACKWARD</> in PL/pgSQL (Pavel Stehule) FORWARD</>/<literal>BACKWARD</> in PL/pgSQL (Pavel Stehule)
</para> </para>
</listitem> </listitem>
...@@ -1741,8 +1771,8 @@ ...@@ -1741,8 +1771,8 @@
<listitem> <listitem>
<para> <para>
Add PL/pgSQL's <command>OPEN cursor FOR EXECUTE</> to use parameters Allow PL/pgSQL's <command>OPEN <replaceable>cursor</> FOR EXECUTE</> to
(Pavel Stehule, Itagaki Takahiro) use parameters (Pavel Stehule, Itagaki Takahiro)
</para> </para>
<para> <para>
...@@ -2482,7 +2512,7 @@ ...@@ -2482,7 +2512,7 @@
<listitem> <listitem>
<para> <para>
Enable the server lexer to be reentrant (Tom Lane) Enable the server's lexer to be reentrant (Tom Lane)
</para> </para>
<para> <para>
...@@ -2796,9 +2826,8 @@ ...@@ -2796,9 +2826,8 @@
</para> </para>
<para> <para>
This filter dictionary removes accents from tokens, and This filter dictionary removes accents from letters, which
makes full-text searches over multiple languages much makes full-text searches over multiple languages much easier.
easier.
</para> </para>
</listitem> </listitem>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment