This release shows PostgreSQL moving beyond the
traditional relational-database feature set with new, ground-breaking
functionality that is unique to PostgreSQL.
The streaming replication feature introduced in release 9.0 is
significantly enhanced by adding a synchronous-replication option,
streaming backups, and monitoring improvements.
Major enhancements include:
By default, backslashes are now ordinary characters in string literals,
not escape characters. This change removes a long-standing
incompatibility with the SQL standard. escape_string_warning
has produced warnings about this usage for years. E''
strings are the proper way to embed backslash escapes in strings and are
unaffected by this change.
Warning
This change can break applications that are not expecting it and
do their own string escaping according to the old rules. The
consequences could be as severe as introducing SQL-injection security
holes. Be sure to test applications that are exposed to untrusted
input, to ensure that they correctly handle single quotes and
backslashes in text strings.
Disallow function-style and attribute-style data type casts for
composite types (Tom Lane)
For example, disallow
composite_value.text and
text(composite_value).
Unintentional uses of this syntax have frequently resulted in bug
reports; although it was not a bug, it seems better to go back to
rejecting such expressions.
The CAST and :: syntaxes are still available
for use when a cast of an entire composite value is actually intended.
Tighten casting checks for domains based on arrays (Tom Lane)
When a domain is based on an array type, it is allowed to "look
through" the domain type to access the array elements, including
subscripting the domain value to fetch or assign an element.
Assignment to an element of such a domain value, for instance via
UPDATE ... SET domaincol[5] = ..., will now result in
rechecking the domain type's constraints, whereas before the checks
were skipped.
Fix improper checks for before/after triggers (Tom Lane)
Triggers can now be fired in three cases: BEFORE,
AFTER, or INSTEAD OF some action.
Trigger function authors should verify that their logic behaves
sanely in all three cases.
Require superuser or CREATEROLE permissions in order to
set comments on roles (Tom Lane)
Change PL/pgSQL's RAISE command without parameters
to be catchable by the attached exception block (Piyush Newe)
Previously RAISE in a code block was always scoped to
an attached exception block, so it was uncatchable at the same
scope.
Adjust PL/pgSQL's error line numbering code to be consistent
with other PLs (Pavel Stehule)
Previously, PL/pgSQL would ignore (not count) an empty line at the
start of the function body. Since this was inconsistent with all
other languages, the special case was removed.
Make PL/pgSQL complain about conflicting IN and OUT parameter names
(Tom Lane)
Formerly, the collision was not detected, and the name would just
silently refer to only the OUT parameter.
Type modifiers of PL/pgSQL variables are now visible to the SQL parser
(Tom Lane)
A type modifier (such as a varchar length limit) attached to a PL/pgSQL
variable was formerly enforced during assignments, but was ignored for
all other purposes. Such variables will now behave more like table
columns declared with the same modifier. This is not expected to make
any visible difference in most cases, but it could result in subtle
changes for some SQL commands issued by PL/pgSQL functions.
All contrib modules are now installed with CREATE EXTENSION
rather than by manually invoking their SQL scripts
(Dimitri Fontaine, Tom Lane)
To update an existing database containing the 9.0 version of a contrib
module, use CREATE EXTENSION ... FROM unpackaged
to wrap the existing contrib module's objects into an extension. When
updating from a pre-9.0 version, drop the contrib module's objects
using its old uninstall script, then use CREATE EXTENSION.
Support unlogged tables using the UNLOGGED
option in CREATE
TABLE (Robert Haas)
Such tables provide better update performance than regular tables,
but are not crash-safe: their contents are automatically cleared in
case of a server crash. Their contents do not propagate to
replication slaves, either.
Allow FULL OUTER JOIN to be implemented as a
hash join, and allow either side of a LEFT OUTER JOIN
or RIGHT OUTER JOIN to be hashed (Tom Lane)
Previously FULL OUTER JOIN could only be
implemented as a merge join, and LEFT OUTER JOIN
and RIGHT OUTER JOIN could hash only the nullable
side of the join. These changes provide additional query optimization
possibilities.
Support host names and host suffixes
(e.g. .example.com) in pg_hba.conf
(Peter Eisentraut)
Previously only host IP addresses and CIDR
values were supported.
Support the key word all in the host column of pg_hba.conf
(Peter Eisentraut)
Previously people used 0.0.0.0/0 or ::/0
for this.
Reject local lines in pg_hba.conf
on platforms that don't support Unix-socket connections
(Magnus Hagander)
Formerly, such lines were silently ignored, which could be surprising.
This makes the behavior more like other unsupported cases.
Allow GSSAPI
to be used to authenticate to servers via SSPI (Christian Ullrich)
Specifically this allows Unix-based GSSAPI clients
to do SSPI authentication with Windows servers.
ident
authentication over local sockets is now known as
peer
(Magnus Hagander)
The old term is still accepted for backward compatibility, but since
the two methods are fundamentally different, it seemed better to adopt
different names for them.
Rewrite peer
authentication to avoid use of credential control messages (Tom Lane)
This change makes the peer authentication code simpler and
better-performing. However, it requires the platform to provide the
getpeereid function or an equivalent socket operation.
So far as is known, the only platform for which peer authentication
worked before and now will not is pre-5.0 NetBSD.
This allows the primary server to wait for a standby to write a
transaction's information to disk before acknowledging the commit.
One standby at a time can take the role of the synchronous standby,
as controlled by the
synchronous_standby_names
setting. Synchronous replication can be enabled or disabled on a
per-transaction basis using the
synchronous_commit
setting.
Add protocol support for sending file system backups to standby servers
using the streaming replication network connection (Magnus Hagander,
Heikki Linnakangas)
This avoids the requirement of manually transferring a file
system backup when setting up a standby server.
Add
replication_timeout
setting (Fujii Masao, Heikki Linnakangas)
Replication connections that are idle for more than the
replication_timeout interval will be terminated
automatically. Formerly, a failed connection was typically not
detected until the TCP timeout elapsed, which is inconveniently
long in many situations.
Add command-line tool pg_basebackup
for creating a new standby server or database backup (Magnus
Hagander)
This is a read-only permission used for streaming replication.
It allows a non-superuser role to be used for replication connections.
Previously only superusers could initiate replication
connections; superusers still have this permission by default.
Previously, asking for serializable isolation guaranteed only that a
single MVCC snapshot would be used for the entire transaction, which
allowed certain documented anomalies. The old snapshot isolation
behavior is still available by requesting the REPEATABLE READ
isolation level.
Allow data-modification commands
(INSERT/UPDATE/DELETE) in
WITH clauses
(Marko Tiikkaja, Hitoshi Harada)
These commands can use RETURNING to pass data up to the
containing query.
Allow WITH
clauses to be attached to INSERT, UPDATE,
DELETE statements (Marko Tiikkaja, Hitoshi Harada)
Allow non-GROUP
BY columns in the query target list when the primary
key is specified in the GROUP BY clause (Peter
Eisentraut)
The SQL standard allows this behavior, and
because of the primary key, the result is unambiguous.
DISTINCT is the default behavior so use of this
key word is redundant, but the SQL standard allows it.
Fix ordinary queries with rules to use the same snapshot behavior
as EXPLAIN ANALYZE (Marko Tiikkaja)
Previously EXPLAIN ANALYZE used slightly different
snapshot timing for queries involving rules. The
EXPLAIN ANALYZE behavior was judged to be more logical.
Add per-column collation support
(Peter Eisentraut, Tom Lane)
Previously collation (the sort ordering of text strings) could only be
chosen at database creation.
Collation can now be set per column, domain, index, or
expression, via the SQL-standard COLLATE clause.
Add extensions which
simplify packaging of additions to PostgreSQL
(Dimitri Fontaine, Tom Lane)
Extensions are controlled by the new CREATE/ALTER/DROP EXTENSION
commands. This replaces ad-hoc methods of grouping objects that
are added to a PostgreSQL installation.
Add support for foreign
tables (Shigeru Hanada, Robert Haas, Jan Urbanski,
Heikki Linnakangas)
This allows data stored outside the database to be used like
native PostgreSQL-stored data. Foreign tables
are currently read-only, however.
Allow new values to be added to an existing enum type via
ALTER TYPE (Andrew
Dunstan)
Add RESTRICT/CASCADE to ALTER TYPE operations
on typed tables (Peter Eisentraut)
This controls
ADD/DROP/ALTER/RENAME
ATTRIBUTE cascading behavior.
Support ALTER TABLE name {OF | NOT OF}
type
(Noah Misch)
This syntax allows a standalone table to be made into a typed table,
or a typed table to be made standalone.
Add support for more object types in ALTER ... SET
SCHEMA commands (Dimitri Fontaine)
This command is now supported for conversions, operators, operator
classes, operator families, text search configurations, text search
dictionaries, text search parsers, and text search templates.
Add ALTER TABLE ...
ADD UNIQUE/PRIMARY KEY USING INDEX
(Gurjeet Singh)
This allows a primary key or unique constraint to be defined using an
existing unique index, including a concurrently created unique index.
Allow ALTER TABLE
to add foreign keys without validation (Simon Riggs)
The new option is called NOT VALID. The constraint's
state can later be modified to VALIDATED and validation
checks performed. Together these allow you to add a foreign key
with minimal impact on read and write operations.
For example, converting a varchar column to
text no longer requires a rewrite of the table.
However, increasing the length constraint on a
varchar column still requires a table rewrite.
Allow numeric to use a more compact, two-byte header
in common cases (Robert Haas)
Previously all numeric values had four-byte headers;
this change saves on disk storage.
Add support for dividing money by money
(Andy Balholm)
Allow binary I/O on type void (Radoslaw Smogura)
Improve hypotenuse calculations for geometric operators (Paul Matthews)
This avoids unnecessary overflows, and may also be more accurate.
Support hashing array values (Tom Lane)
This provides additional query optimization possibilities.
Don't treat a composite type as sortable unless all its column types
are sortable (Tom Lane)
This avoids possible "could not identify a comparison function"
failures at runtime, if it is possible to implement the query without
sorting. Also, ANALYZE won't try to use inappropriate
statistics-gathering methods for columns of such composite types.
These check whether the input is properly-formed XML.
They provide functionality that was previously available only in
the deprecated contrib/xml2 module.
This function is used to obtain a human-readable string describing
an object, based on the pg_class
OID, object OID, and sub-object ID. It can be used to help
interpret the contents of pg_depend.
Update comments for built-in operators and their underlying
functions (Tom Lane)
Functions that are meant to be used via an associated operator
are now commented as such.
Add variable quote_all_identifiers
to force the quoting of all identifiers in EXPLAIN
and in system catalog functions like pg_get_viewdef()
(Robert Haas)
This makes exporting schemas to tools and other databases with
different quoting rules easier.
This is more efficient and readable than previous methods of
iterating through the elements of an array value.
Allow RAISE without parameters to be caught in
the same places that could catch a RAISE ERROR
from the same location (Piyush Newe)
The previous coding threw the error
from the block containing the active exception handler.
The new behavior is more consistent with other DBMS products.
Fix pg_ctl
so it no longer incorrectly reports that the server is not
running (Bruce Momjian)
Previously this could happen if the server was running but
pg_ctl could not authenticate.
Improve pg_ctl start's "wait"
(-w) option (Bruce Momjian, Tom Lane)
The wait mode is now significantly more robust. It will not get
confused by non-default postmaster port numbers, non-default
Unix-domain socket locations, permission problems, or stale
postmaster lock files.
Add promote option to pg_ctl to
switch a standby server to primary (Fujii Masao)
Add a libpq connection option client_encoding
which behaves like the PGCLIENTENCODING environment
variable (Heikki Linnakangas)
The value auto sets the client encoding based on
the operating system locale.
Add PQlibVersion()
function which returns the libpq library version (Magnus
Hagander)
libpq already had PQserverVersion() which returns
the server version.
Allow libpq-using clients to
check the user name of the server process
when connecting via Unix-domain sockets, with the new requirepeer
connection option
(Peter Eisentraut)
PostgreSQL already allowed servers to check
the client user name when connecting via Unix-domain sockets.
This is necessary because of the parallel-make improvements.
Add make maintainer-check target
(Peter Eisentraut)
This target performs various source code checks that are not
appropriate for either the build or the regression tests. Currently:
duplicate_oids, SGML syntax and tabs check, NLS syntax check.
Support make check in contrib
(Peter Eisentraut)
Formerly only make installcheck worked, but now
there is support for testing in a temporary installation.
The top-level make check-world target now includes
testing contrib this way.
Revise the API for GUC variable assign hooks (Tom Lane)
The previous functions of assign hooks are now split between check
hooks and assign hooks, where the former can fail but the latter
shouldn't. This change will impact add-on modules that define custom
GUC parameters.
Add latches to the source code to support waiting for events (Heikki
Linnakangas)
Centralize data modification permissions-checking logic
(KaiGai Kohei)
Add missing get_object_oid() functions, for consistency
(Robert Haas)
Improve ability to use C++ compilers for compiling add-on modules by removing
conflicting key words (Tom Lane)
Add support for DragonFly BSD (Rumko)
Expose quote_literal_cstr() for backend use
(Robert Haas)
Previously only Solaris 9 kernel tuning was documented.
Handle non-ASCII characters consistently in HISTORY file
(Peter Eisentraut)
While the HISTORY file is in English, we do have to deal
with non-ASCII letters in contributor names. These are now
transliterated so that they are reasonably legible without assumptions
about character set.