This release contains improvements in many areas, demonstrating the continued growth of PostgreSQL™. There are more improvements and fixes in 7.0 than in any previous release. The developers have confidence that this is the best release yet; we do our best to put out only solid releases, and this one is no exception.
Major changes in this release:
Foreign keys are now implemented, with the exception of PARTIAL MATCH foreign keys. Many users have been asking for this feature, and we are pleased to offer it.
Continuing on work started a year ago, the optimizer has been improved, allowing better query plan selection and faster performance with less memory usage.
psql, our interactive terminal monitor, has been updated with a variety of new features. See the psql manual page for details.
SQL92 join syntax is now supported, though only as INNER JOIN for this release. JOIN, NATURAL JOIN, JOIN/USING, and JOIN/ON are available, as are column correlation names.
A dump/restore using pg_dump is required for those wishing to migrate data from any previous release of PostgreSQL™. For those upgrading from 6.5.*, you can instead use pg_upgrade to upgrade to this release; however, a full dump/reload installation is always the most robust method for upgrades.
Interface and compatibility issues to consider for the new release include:
The date/time types datetime and timespan have been superseded by the SQL92-defined types timestamp and interval. Although there has been some effort to ease the transition by allowing PostgreSQL™ to recognize the deprecated type names and translate them to the new type names, this mechanism cannot be completely transparent to your existing application.
The optimizer has been substantially improved in the area of query cost estimation. In some cases, this will result in decreased query times as the optimizer makes a better choice for the preferred plan. However, in a small number of cases, usually involving pathological distributions of data, your query times might go up. If you are dealing with large amounts of data, you might want to check your queries to verify performance.
The JDBC and ODBC interfaces have been upgraded and extended.
The string function CHAR_LENGTH is now a native function. Previous versions translated this into a call to LENGTH, which could result in ambiguity with other types implementing LENGTH such as the geometric types.
Bug Fixes --------- Prevent function calls exceeding maximum number of arguments (Tom) Improve CASE construct (Tom) Fix SELECT coalesce(f1,0) FROM int4_tbl GROUP BY f1 (Tom) Fix SELECT sentence.words FROM sentence GROUP BY sentence.words (Tom) Fix GROUP BY scan bug (Tom) Improvements in SQL grammar processing (Tom) Fix for views involved in INSERT ... SELECT ... (Tom) Fix for SELECT a/2, a/2 FROM test_missing_target GROUP BY a/2 (Tom) Fix for subselects in INSERT ... SELECT (Tom) Prevent INSERT ... SELECT ... ORDER BY (Tom) Fixes for relations greater than 2GB, including vacuum Improve propagating system table changes to other backends (Tom) Improve propagating user table changes to other backends (Tom) Fix handling of temp tables in complex situations (Bruce, Tom) Allow table locking at table open, improving concurrent reliability (Tom) Properly quote sequence names in pg_dump (Ross J. Reedstrom) Prevent DROP DATABASE while others accessing Prevent any rows from being returned by GROUP BY if no rows processed (Tom) Fix SELECT COUNT(1) FROM table WHERE ...' if no rows matching WHERE (Tom) Fix pg_upgrade so it works for MVCC (Tom) Fix for SELECT ... WHERE x IN (SELECT ... HAVING SUM(x) > 1) (Tom) Fix for "f1 datetime DEFAULT 'now'" (Tom) Fix problems with CURRENT_DATE used in DEFAULT (Tom) Allow comment-only lines, and ;;; lines too. (Tom) Improve recovery after failed disk writes, disk full (Hiroshi) Fix cases where table is mentioned in FROM but not joined (Tom) Allow HAVING clause without aggregate functions (Tom) Fix for "--" comment and no trailing newline, as seen in perl interface Improve pg_dump failure error reports (Bruce) Allow sorts and hashes to exceed 2GB file sizes (Tom) Fix for pg_dump dumping of inherited rules (Tom) Fix for NULL handling comparisons (Tom) Fix inconsistent state caused by failed CREATE/DROP commands (Hiroshi) Fix for dbname with dash Prevent DROP INDEX from interfering with other backends (Tom) Fix file descriptor leak in verify_password() Fix for "Unable to identify an operator =$" problem Fix ODBC so no segfault if CommLog and Debug enabled (Dirk Niggemann) Fix for recursive exit call (Massimo) Fix for extra-long timezones (Jeroen van Vianen) Make pg_dump preserve primary key information (Peter E) Prevent databases with single quotes (Peter E) Prevent DROP DATABASE inside transaction (Peter E) ecpg memory leak fixes (Stephen Birch) Fix for SELECT null::text, SELECT int4fac(null) and SELECT 2 + (null) (Tom) Y2K timestamp fix (Massimo) Fix for VACUUM 'HEAP_MOVED_IN was not expected' errors (Tom) Fix for views with tables/columns containing spaces (Tom) Prevent privileges on indexes (Peter E) Fix for spinlock stuck problem when error is generated (Hiroshi) Fix ipcclean on Linux Fix handling of NULL constraint conditions (Tom) Fix memory leak in odbc driver (Nick Gorham) Fix for privilege check on UNION tables (Tom) Fix to allow SELECT 'a' LIKE 'a' (Tom) Fix for SELECT 1 + NULL (Tom) Fixes to CHAR Fix log() on numeric type (Tom) Deprecate ':' and ';' operators Allow vacuum of temporary tables Disallow inherited columns with the same name as new columns Recover or force failure when disk space is exhausted (Hiroshi) Fix INSERT INTO ... SELECT with AS columns matching result columns Fix INSERT ... SELECT ... GROUP BY groups by target columns not source columns (Tom) Fix CREATE TABLE test (a char(5) DEFAULT text '', b int4) with INSERT (Tom) Fix UNION with LIMIT Fix CREATE TABLE x AS SELECT 1 UNION SELECT 2 Fix CREATE TABLE test(col char(2) DEFAULT user) Fix mismatched types in CREATE TABLE ... DEFAULT Fix SELECT * FROM pg_class where oid in (0,-1) Fix SELECT COUNT('asdf') FROM pg_class WHERE oid=12 Prevent user who can create databases can modifying pg_database table (Peter E) Fix btree to give a useful elog when key > 1/2 (page - overhead) (Tom) Fix INSERT of 0.0 into DECIMAL(4,4) field (Tom) Enhancements ------------ New CLI interface include file sqlcli.h, based on SQL3/SQL98 Remove all limits on query length, row length limit still exists (Tom) Update jdbc protocol to 2.0 (Jens Glaser <firstname.lastname@example.org>) Add TRUNCATE command to quickly truncate relation (Mike Mascari) Fix to give super user and createdb user proper update catalog rights (Peter E) Allow ecpg bool variables to have NULL values (Christof) Issue ecpg error if NULL value for variable with no NULL indicator (Christof) Allow ^C to cancel COPY command (Massimo) Add SET FSYNC and SHOW PG_OPTIONS commands(Massimo) Function name overloading for dynamically-loaded C functions (Frankpitt) Add CmdTuples() to libpq++(Vince) New CREATE CONSTRAINT TRIGGER and SET CONSTRAINTS commands(Jan) Allow CREATE FUNCTION/WITH clause to be used for all language types configure --enable-debug adds -g (Peter E) configure --disable-debug removes -g (Peter E) Allow more complex default expressions (Tom) First real FOREIGN KEY constraint trigger functionality (Jan) Add FOREIGN KEY ... MATCH FULL ... ON DELETE CASCADE (Jan) Add FOREIGN KEY ... MATCH <unspecified> referential actions (Don Baccus) Allow WHERE restriction on ctid (physical heap location) (Hiroshi) Move pginterface from contrib to interface directory, rename to pgeasy (Bruce) Change pgeasy connectdb() parameter ordering (Bruce) Require SELECT DISTINCT target list to have all ORDER BY columns (Tom) Add Oracle's COMMENT ON command (Mike Mascari <email@example.com>) libpq's PQsetNoticeProcessor function now returns previous hook(Peter E) Prevent PQsetNoticeProcessor from being set to NULL (Peter E) Make USING in COPY optional (Bruce) Allow subselects in the target list (Tom) Allow subselects on the left side of comparison operators (Tom) New parallel regression test (Jan) Change backend-side COPY to write files with permissions 644 not 666 (Tom) Force permissions on PGDATA directory to be secure, even if it exists (Tom) Added psql LASTOID variable to return last inserted oid (Peter E) Allow concurrent vacuum and remove pg_vlock vacuum lock file (Tom) Add privilege check for vacuum (Peter E) New libpq functions to allow asynchronous connections: PQconnectStart(), PQconnectPoll(), PQresetStart(), PQresetPoll(), PQsetenvStart(), PQsetenvPoll(), PQsetenvAbort (Ewan Mellor) New libpq PQsetenv() function (Ewan Mellor) create/alter user extension (Peter E) New postmaster.pid and postmaster.opts under $PGDATA (Tatsuo) New scripts for create/drop user/db (Peter E) Major psql overhaul (Peter E) Add const to libpq interface (Peter E) New libpq function PQoidValue (Peter E) Show specific non-aggregate causing problem with GROUP BY (Tom) Make changes to pg_shadow recreate pg_pwd file (Peter E) Add aggregate(DISTINCT ...) (Tom) Allow flag to control COPY input/output of NULLs (Peter E) Make postgres user have a password by default (Peter E) Add CREATE/ALTER/DROP GROUP (Peter E) All administration scripts now support --long options (Peter E, Karel) Vacuumdb script now supports --all option (Peter E) ecpg new portable FETCH syntax Add ecpg EXEC SQL IFDEF, EXEC SQL IFNDEF, EXEC SQL ELSE, EXEC SQL ELIF and EXEC SQL ENDIF directives Add pg_ctl script to control backend start-up (Tatsuo) Add postmaster.opts.default file to store start-up flags (Tatsuo) Allow --with-mb=SQL_ASCII Increase maximum number of index keys to 16 (Bruce) Increase maximum number of function arguments to 16 (Bruce) Allow configuration of maximum number of index keys and arguments (Bruce) Allow unprivileged users to change their passwords (Peter E) Password authentication enabled; required for new users (Peter E) Disallow dropping a user who owns a database (Peter E) Change initdb option --with-mb to --enable-multibyte Add option for initdb to prompts for superuser password (Peter E) Allow complex type casts like col::numeric(9,2) and col::int2::float8 (Tom) Updated user interfaces on initdb, initlocation, pg_dump, ipcclean (Peter E) New pg_char_to_encoding() and pg_encoding_to_char() functions (Tatsuo) libpq non-blocking mode (Alfred Perlstein) Improve conversion of types in casts that don't specify a length New plperl internal programming language (Mark Hollomon) Allow COPY IN to read file that do not end with a newline (Tom) Indicate when long identifiers are truncated (Tom) Allow aggregates to use type equivalency (Peter E) Add Oracle's to_char(), to_date(), to_datetime(), to_timestamp(), to_number() conversion functions (Karel Zak <firstname.lastname@example.org>) Add SELECT DISTINCT ON (expr [, expr ...]) targetlist ... (Tom) Check to be sure ORDER BY is compatible with the DISTINCT operation (Tom) Add NUMERIC and int8 types to ODBC Improve EXPLAIN results for Append, Group, Agg, Unique (Tom) Add ALTER TABLE ... ADD FOREIGN KEY (Stephan Szabo) Allow SELECT .. FOR UPDATE in PL/pgSQL (Hiroshi) Enable backward sequential scan even after reaching EOF (Hiroshi) Add btree indexing of boolean values, >= and <= (Don Baccus) Print current line number when COPY FROM fails (Massimo) Recognize POSIX time zone e.g. "PST+8" and "GMT-8" (Thomas) Add DEC as synonym for DECIMAL (Thomas) Add SESSION_USER as SQL92 key word, same as CURRENT_USER (Thomas) Implement SQL92 column aliases (aka correlation names) (Thomas) Implement SQL92 join syntax (Thomas) Make INTERVAL reserved word allowed as a column identifier (Thomas) Implement REINDEX command (Hiroshi) Accept ALL in aggregate function SUM(ALL col) (Tom) Prevent GROUP BY from using column aliases (Tom) New psql \encoding option (Tatsuo) Allow PQrequestCancel() to terminate when in waiting-for-lock state (Hiroshi) Allow negation of a negative number in all cases Add ecpg descriptors (Christof, Michael) Allow CREATE VIEW v AS SELECT f1::char(8) FROM tbl Allow casts with length, like foo::char(8) New libpq functions PQsetClientEncoding(), PQclientEncoding() (Tatsuo) Add support for SJIS user defined characters (Tatsuo) Larger views/rules supported Make libpq's PQconndefaults() thread-safe (Tom) Disable // as comment to be ANSI conforming, should use -- (Tom) Allow column aliases on views CREATE VIEW name (collist) Fixes for views with subqueries (Tom) Allow UPDATE table SET fld = (SELECT ...) (Tom) SET command options no longer require quotes Update pgaccess to 0.98.6 New SET SEED command New pg_options.sample file New SET FSYNC command (Massimo) Allow pg_descriptions when creating tables Allow pg_descriptions when creating types, columns, and functions Allow psql \copy to allow delimiters (Peter E) Allow psql to print nulls as distinct from "" [null] (Peter E) Types ----- Many array fixes (Tom) Allow bare column names to be subscripted as arrays (Tom) Improve type casting of int and float constants (Tom) Cleanups for int8 inputs, range checking, and type conversion (Tom) Fix for SELECT timespan('21:11:26'::time) (Tom) netmask('x.x.x.x/0') is 255.255.255.255 instead of 0.0.0.0 (Oleg Sharoiko) Add btree index on NUMERIC (Jan) Perl fix for large objects containing NUL characters (Douglas Thomson) ODBC fix for large objects (free) Fix indexing of cidr data type Fix for Ethernet MAC addresses (macaddr type) comparisons Fix for date/time types when overflows happened in computations (Tom) Allow array on int8 (Peter E) Fix for rounding/overflow of NUMERIC type, like NUMERIC(4,4) (Tom) Allow NUMERIC arrays Fix bugs in NUMERIC ceil() and floor() functions (Tom) Make char_length()/octet_length including trailing blanks (Tom) Made abstime/reltime use int4 instead of time_t (Peter E) New lztext data type for compressed text fields Revise code to handle coercion of int and float constants (Tom) Start at new code to implement a BIT and BIT VARYING type (Adriaan Joubert) NUMERIC now accepts scientific notation (Tom) NUMERIC to int4 rounds (Tom) Convert float4/8 to NUMERIC properly (Tom) Allow type conversion with NUMERIC (Thomas) Make ISO date style (2000-02-16 09:33) the default (Thomas) Add NATIONAL CHAR [ VARYING ] (Thomas) Allow NUMERIC round and trunc to accept negative scales (Tom) New TIME WITH TIME ZONE type (Thomas) Add MAX()/MIN() on time type (Thomas) Add abs(), mod(), fac() for int8 (Thomas) Rename functions to round(), sqrt(), cbrt(), pow() for float8 (Thomas) Add transcendental math functions (e.g. sin(), acos()) for float8 (Thomas) Add exp() and ln() for NUMERIC type Rename NUMERIC power() to pow() (Thomas) Improved TRANSLATE() function (Edwin Ramirez, Tom) Allow X=-Y operators (Tom) Allow SELECT float8(COUNT(*))/(SELECT COUNT(*) FROM t) FROM t GROUP BY f1; (Tom) Allow LOCALE to use indexes in regular expression searches (Tom) Allow creation of functional indexes to use default types Performance ----------- Prevent exponential space consumption with many AND's and OR's (Tom) Collect attribute selectivity values for system columns (Tom) Reduce memory usage of aggregates (Tom) Fix for LIKE optimization to use indexes with multibyte encodings (Tom) Fix r-tree index optimizer selectivity (Thomas) Improve optimizer selectivity computations and functions (Tom) Optimize btree searching for cases where many equal keys exist (Tom) Enable fast LIKE index processing only if index present (Tom) Re-use free space on index pages with duplicates (Tom) Improve hash join processing (Tom) Prevent descending sort if result is already sorted(Hiroshi) Allow commuting of index scan query qualifications (Tom) Prefer index scans in cases where ORDER BY/GROUP BY is required (Tom) Allocate large memory requests in fix-sized chunks for performance (Tom) Fix vacuum's performance by reducing memory allocation requests (Tom) Implement constant-expression simplification (Bernard Frankpitt, Tom) Use secondary columns to be used to determine start of index scan (Hiroshi) Prevent quadruple use of disk space when doing internal sorting (Tom) Faster sorting by calling fewer functions (Tom) Create system indexes to match all system caches (Bruce, Hiroshi) Make system caches use system indexes (Bruce) Make all system indexes unique (Bruce) Improve pg_statistics management for VACUUM speed improvement (Tom) Flush backend cache less frequently (Tom, Hiroshi) COPY now reuses previous memory allocation, improving performance (Tom) Improve optimization cost estimation (Tom) Improve optimizer estimate of range queries x > lowbound AND x < highbound (Tom) Use DNF instead of CNF where appropriate (Tom, Taral) Further cleanup for OR-of-AND WHERE-clauses (Tom) Make use of index in OR clauses (x = 1 AND y = 2) OR (x = 2 AND y = 4) (Tom) Smarter optimizer computations for random index page access (Tom) New SET variable to control optimizer costs (Tom) Optimizer queries based on LIMIT, OFFSET, and EXISTS qualifications (Tom) Reduce optimizer internal housekeeping of join paths for speedup (Tom) Major subquery speedup (Tom) Fewer fsync writes when fsync is not disabled (Tom) Improved LIKE optimizer estimates (Tom) Prevent fsync in SELECT-only queries (Vadim) Make index creation use psort code, because it is now faster (Tom) Allow creation of sort temp tables > 1 Gig Source Tree Changes ------------------- Fix for linux PPC compile New generic expression-tree-walker subroutine (Tom) Change form() to varargform() to prevent portability problems Improved range checking for large integers on Alphas Clean up #include in /include directory (Bruce) Add scripts for checking includes (Bruce) Remove un-needed #include's from *.c files (Bruce) Change #include's to use <> and "" as appropriate (Bruce) Enable Windows compilation of libpq Alpha spinlock fix from Uncle George <email@example.com> Overhaul of optimizer data structures (Tom) Fix to cygipc library (Yutaka Tanida) Allow pgsql to work on newer Cygwin snapshots (Dan) New catalog version number (Tom) Add Linux ARM Rename heap_replace to heap_update Update for QNX (Dr. Andreas Kardos) New platform-specific regression handling (Tom) Rename oid8 -> oidvector and int28 -> int2vector (Bruce) Included all yacc and lex files into the distribution (Peter E.) Remove lextest, no longer needed (Peter E) Fix for libpq and psql on Windows (Magnus) Internally change datetime and timespan into timestamp and interval (Thomas) Fix for plpgsql on BSD/OS Add SQL_ASCII test case to the regression test (Tatsuo) configure --with-mb now deprecated (Tatsuo) NT fixes NetBSD fixes (Johnny C. Lam <firstname.lastname@example.org>) Fixes for Alpha compiles New multibyte encodings