Stark, additional fixes and editorialization by Neil Conway. Greg's patch
description:
Some more doc patches for partitioned tables. In particular replace
the caveat that INCLUDING CONSTRAINTS doesn't exist and replace it
with documentation of, well, INCLUDING CONSTRAINTS.
Also, there was an instance of "LIKE WITH DEFAULTS" which is
actually spelled "LIKE INCLUDING DEFAULTS".
< #A hyphen, "-", marks changes that will appear in the upcoming 8.2 release.#
> #A hyphen, "-", marks changes that will appear in the upcoming 8.3 release.#
< * -Make postmater and postgres options distinct so the postmaster -o
< option is no longer needed
< * -Allow pooled connections to list all prepared statements
<
< This would allow an application inheriting a pooled connection to know
< the statements prepared in the current session.
<
< * -Re-enable the GUC full_page_writes in 8.2 when reliability issues have
< been addressed
< o -Add "include file" functionality in postgresql.conf
< o -Allow per-database permissions to be set via GRANT
<
< Allow database connection checks based on GRANT rules in
< addition to the existing access checks in pg_hba.conf.
<
< o -Issue a warning if a change-on-restart-only postgresql.conf value
> o Issue a warning if a change-on-restart-only postgresql.conf value
< o -Automatically force archiving of partially-filled WAL files when
< pg_stop_backup() is called or the server is stopped
< o -Add reporting of the current WAL file and offset, perhaps as
< part of partial log file archiving
< * -Allow server logs to be remotely read and removed using SQL commands
< * -Allow protocol-level BIND parameter values to be logged
< * -Zero umasked bits in conversion from INET cast to CIDR
< * -Prevent INET cast to CIDR from dropping netmask, SELECT '1.1.1.1'::inet::cidr
< * -Allow INET + INT8 to increment the host part of the address or
< throw an error on overflow
< * -Add 'tid != tid ' operator for use in corruption recovery
< o -Allow customization of the known set of TZ names (generalize the
< present australian_timezones hack)
< o -Allow timezone names in SQL strings, '2006-05-24 21:11
< Americas/New_York'::timestamptz
< o -Add support for day-time syntax, INTERVAL '1 2:03:04' DAY TO
< SECOND
< o -Allow NULLs in arrays
< * -Add transaction_timestamp(), statement_timestamp(), clock_timestamp()
< functionality
<
< Current CURRENT_TIMESTAMP returns the start time of the current
< transaction, and gettimeofday() returns the wallclock time. This will
< make time reporting more consistent and will allow reporting of
< the statement start time.
<
< * -Allow to_char() to print localized month names
< * -Add sleep() function, remove from regress.c
< * -Allow user-defined functions retuning a domain value to enforce domain
< constraints
< * -Allow TRUNCATE ... CASCADE/RESTRICT
<
< This is like DELETE CASCADE, but truncates.
<
< * -Add COMMENT ON for all cluster global objects (roles, databases
< and tablespaces)
< * -Make row-wise comparisons work per SQL spec
<
< Right now, '(a, b) < (1, 2)' is processed as 'a < 1 and b < 2', but
< the SQL standard requires it to be processed as a column-by-column
< comparison, so the proper comparison is '(a < 1) OR (a = 1 AND b < 2)'.
<
< * -Enable escape_string_warning and standard_conforming_strings
> * Enable standard_conforming_strings
< o -Add ON COMMIT capability to CREATE TABLE AS ... SELECT
< o -Allow an alias to be provided for the target table in
< UPDATE/DELETE (Neil)
< o -Allow UPDATE tab SET ROW (col, ...) = (val, ...) for updating
< multiple columns
< o -Add ALTER TABLE tab INHERIT / NO INHERIT parent
< o -Have COPY return the number of rows loaded/unloaded?
< o -Allow COPY (SELECT ...) TO 'filename'
<
< o -Allow pooled connections to list all open WITH HOLD cursors
<
< Because WITH HOLD cursors exist outside transactions, this allows
< them to be listed so they can be closed.
<
< o -Allow INSERT INTO tab (col1, ..) VALUES (val1, ..), (val2, ..)
< o -Allow INSERT/UPDATE ... RETURNING new.col or old.col
< o -Allow PL/python to return composite types and result sets
<
< * -Have initdb set the input DateStyle (MDY or DMY) based on locale
< o -Improve psql's handling of multi-line statements
<
< Currently, while \e saves a single statement as one entry, interactive
< statements are saved one line at a time. Ideally all statements
< would be saved like \e does.
<
< o -Allow multi-line column values to align in the proper columns
<
< If the second output column value is 'a\nb', the 'b' should appear
< in the second display column, rather than the first column as it
< does now.
<
< o -Display IN, INOUT, and OUT parameters in \df
< o -Allow pg_dump to use multiple -t and -n switches, exclusion
< ability, and regular expression object matching
< o -Update pg_dump and psql to use the new COPY libpq API (Christopher)
< o -Add a function to support Parse/DescribeStatement capability
< * -Add fillfactor to control reserved free space during index creation
< * -Add system view to show free space map contents
< * -Allow installing to directories containing spaces
<
< This is possible if proper quoting is added to the makefiles for the
< install targets. Because PostgreSQL supports relocatable installs, it
< is already possible to install into a directory that doesn't contain
< spaces and then copy the install to a directory with spaces.
<
< * -%Clean up compiler warnings (especially with gcc version 4)
< * -Remove BeOS and QNX-specific code
< o -Port contrib/xml2
an SQL dump if an error occurs. Along the way, make some improvements and
copy-edits to the surrounding text. Patch from Simon Riggs, additional
fixes by Neil Conway.
contrib functionality. Along the way, remove the USER_LOCKS configuration
symbol, since it no longer makes any sense to try to compile that out.
No user documentation yet ... mmoncure has promised to write some.
Thanks to Abhijit Menon-Sen for creating a first draft to work from.
>
> * Set client encoding based on the client operating system encoding
>
> Currently client_encoding is set in postgresql.conf, which
> defaults to the server encoding.
the table being analyzed. This prevents two ANALYZEs from running
concurrently on the same table and possibly suffering concurrent-update
failures while trying to store their results into pg_statistic. The
downside is that a database-wide ANALYZE executed within a transaction
block will hold ShareUpdateExclusiveLock on many tables simultaneously,
which could lead to concurrency issues or even deadlock against another
such ANALYZE. However, this seems a corner case of less importance
than getting unexpected errors from a foreground ANALYZE when autovacuum
elects to analyze the same table concurrently. Per discussion.
< o Reorder physical storage order to reduce padding?
<
< This involves having the user-specified order of columns
< be different from the physical order. SELECT * would
< need to reorder the physical values to match the
< user-specified ordering.
<
< o Store disk pages with no alignment/padding?
<
< This necessitates adding CPU-required padding when moving
< rows from disk to memory.
<
< One idea is to store the header in network byte order (high bits
< first), and read the high bits to determine the header length.
< http://archives.postgresql.org/pgsql-hackers/2006-09/msg00848.php
> One idea is to create zero-or-one-byte-header versions
> of varlena data types. In involves setting the high-bit and
> 0-127 length in the single-byte header, or clear the high bit
> and store the 7-bit ASCII value in the rest of the byte.
> The small-header versions have no alignment requirements.
> http://archives.postgresql.org/pgsql-hackers/2006-09/msg01372.php
and create a new view pg_timezone_names that provides information about
the zones known in the 'zic' database. Magnus Hagander, with some
additional work by Tom Lane.
alias with the old name for backwards compatibility. Per discussion,
the old name is actively wrong because validity and well-formedness
have different meanings in XML.
a schema is our own temp schema or another backend's temp schema, and use
these in place of some former kluges in information_schema. Per my
proposal of yesterday.
< o Store disk pages with no alignment/padding?
>
> This involves having the user-specified order of columns
> be different from the physical order. SELECT * would
> need to reorder the physical values to match the
> user-specified ordering.
>
> o Store disk pages with no alignment/padding?
>
> This necessitates adding CPU-required padding when moving
> rows from disk to memory.
>
>
> http://archives.postgresql.org/pgsql-hackers/2006-09/msg00848.php
>
< * Research storing disk pages with no alignment/padding
> * Consider ways of storing rows more compactly on disk
>
> o Store disk pages with no alignment/padding?
> o Reorder physical storage order to reduce padding?
> o Support a smaller header for short variable-length fields?
> o Reduce the row header size?
agreed these symbols are less easily confused. I made new pg_operator
entries (with new OIDs) for the old names, so as to provide backward
compatibility while making it pretty easy to remove the old names in
some future release cycle. This commit only touches the core datatypes,
contrib will be fixed separately.
than being equivalent to setting log_min_duration_statement to zero, this
option now forces logging of all query durations, but doesn't force logging
of query text. Also, add duration logging coverage for fastpath function
calls.
proposal. Parameter logging works even for binary-format parameters, and
logging overhead is avoided when disabled.
log_statement = all output for the src/test/examples/testlibpq3.c example
now looks like
LOG: statement: execute <unnamed>: SELECT * FROM test1 WHERE t = $1
DETAIL: parameters: $1 = 'joe''s place'
LOG: statement: execute <unnamed>: SELECT * FROM test1 WHERE i = $1::int4
DETAIL: parameters: $1 = '2'
and log_min_duration_statement = 0 results in
LOG: duration: 2.431 ms parse <unnamed>: SELECT * FROM test1 WHERE t = $1
LOG: duration: 2.335 ms bind <unnamed> to <unnamed>: SELECT * FROM test1 WHERE t = $1
DETAIL: parameters: $1 = 'joe''s place'
LOG: duration: 0.394 ms execute <unnamed>: SELECT * FROM test1 WHERE t = $1
DETAIL: parameters: $1 = 'joe''s place'
LOG: duration: 1.251 ms parse <unnamed>: SELECT * FROM test1 WHERE i = $1::int4
LOG: duration: 0.566 ms bind <unnamed> to <unnamed>: SELECT * FROM test1 WHERE i = $1::int4
DETAIL: parameters: $1 = '2'
LOG: duration: 0.173 ms execute <unnamed>: SELECT * FROM test1 WHERE i = $1::int4
DETAIL: parameters: $1 = '2'
(This example demonstrates the folly of ignoring parse/bind steps for duration
logging purposes, BTW.)
Along the way, create a less ad-hoc mechanism for determining which commands
are logged by log_statement = mod and log_statement = ddl. The former coding
was actually missing quite a few things that look like ddl to me, and it
did not handle EXECUTE or extended query protocol correctly at all.
This commit does not do anything about the question of whether log_duration
should be removed or made less redundant with log_min_duration_statement.
that has parameters is always planned afresh for each Bind command,
treating the parameter values as constants in the planner. This removes
the performance penalty formerly often paid for using out-of-line
parameters --- with this definition, the planner can do constant folding,
LIKE optimization, etc. After a suggestion by Andrew@supernews.
can create or modify rules for the table. Do setRuleCheckAsUser() while
loading rules into the relcache, rather than when defining a rule. This
ensures that permission checks for tables referenced in a rule are done with
respect to the current owner of the rule's table, whereas formerly ALTER TABLE
OWNER would fail to update the permission checking for associated rules.
Removal of separate RULE privilege is needed to prevent various scenarios
in which a grantee of RULE privilege could effectively have any privilege
of the table owner. For backwards compatibility, GRANT/REVOKE RULE is still
accepted, but it doesn't do anything. Per discussion here:
http://archives.postgresql.org/pgsql-hackers/2006-04/msg01138.php
of the syntax as this fundamentally dead-end approach can, in particular
combinations of single and multi column assignments. Improve rather
inadequate documentation and provide some regression tests.
> * Simplify ability to create partitioned tables
>
> This would allow creation of partitioned tables without requiring
> creation of rules for INSERT/UPDATE/DELETE, and constraints for
> rapid partition selection. Options could include range and hash
> partition selection.
>
> * Allow auto-selection of partitioned tables for min/max() operations
< Last updated: Sat Sep 2 08:31:04 EDT 2006
> Last updated: Sat Sep 2 16:31:46 EDT 2006
< o Allow UPDATE tab SET ROW (col, ...) = (...) for updating multiple
< columns
> o -Allow UPDATE tab SET ROW (col, ...) = (val, ...) for updating
> multiple columns
> o Allow UPDATE tab SET ROW (col, ...) = (SELECT...)
< A subselect can also be used as the value source.
RETURNING play nice with views/rules. To wit, have the rule rewriter
rewrite any RETURNING clause found in a rule to produce what the rule's
triggering query asked for in its RETURNING clause, in particular drop
the RETURNING clause if no RETURNING in the triggering query. This
leaves the responsibility for knowing how to produce the view's output
columns on the rule author, without requiring any fundamental changes
in rule semantics such as adding new rule event types would do. The
initial implementation constrains things to ensure that there is
exactly one, unconditionally invoked RETURNING clause among the rules
for an event --- later we might be able to relax that, but for a post
feature freeze fix it seems better to minimize how much invention we do.
Per gripe from Jaime Casanova.
"server_version" but uses the handy PG_VERSION_NUM which allows apps to
do things like if ($version >= 80200) without having to parse apart the
value of server_version themselves.
Greg Sabino Mullane greg@turnstep.com
< Last updated: Tue Aug 29 12:21:52 EDT 2006
> Last updated: Wed Aug 30 20:34:28 EDT 2006
< o Allow COPY (SELECT ...) TO 'filename'
<
< COPY should also be able to output views using COPY (SELECT
< * FROM view) TO 'filename' internally.
< http://archives.postgresql.org/pgsql-patches/2005-09/msg00148.php
> o -Allow COPY (SELECT ...) TO 'filename'
queries via a cursor, fetching a limited number of rows at a time and
therefore not risking exhausting memory. A disadvantage of the scheme
is that 'aligned' output mode will align each group of rows independently
leading to odd-looking output, but all the other output formats work
reasonably well. Chris Mair, with some additional hacking by moi.
optionally bind. I re-added the "statement:" label so people will
understand why the line is being printed (it is log_*statement
behavior).
Use single quotes for bind values, instead of double quotes, and double
literal single quotes in bind values (and document that). I also made
use of the DETAIL line to have much cleaner output.
> o Allow DEFERRABLE and end-of-statement UNIQUE constraints?
>
> This would allow UPDATE tab SET col = col + 1 to work if col has
> a unique index. Currently, uniqueness checks are done while the
> command is being executed, rather than at the end of the statement
> or transaction.
>
<
< * Allow DEFERRABLE and end-of-statement UNIQUE constraints?
<
< This would allow UPDATE tab SET col = col + 1 to work if col has
< a unique index. Currently, uniqueness checks are done while the
< command is being executed, rather than at the end of the statement
< or transaction.
< * Allow DEFERRABLE UNIQUE constraints?
> * Allow DEFERRABLE and end-of-statement UNIQUE constraints?
>
> This would allow UPDATE tab SET col = col + 1 to work if col has
> a unique index. Currently, uniqueness checks are done while the
> command is being executed, rather than at the end of the statement
> or transaction.
>
Fix all the standard PLs to be able to return tuples from FOO_RETURNING
statements as well as utility statements that return tuples. Also,
fix oversight that SPI_processed wasn't set for a utility statement
returning tuples. Per recent discussion.
< * All backends running as threads in a single process (not want)
> * All backends running as threads in a single process (not wanted)
< * Optimizer hints (not want)
> * Optimizer hints (not wanted)
>
> * Allow AS in "SELECT col AS label" to be optional (not wanted)
>
> Because we support postfix operators, it isn't possible to make AS
> optional and continue to use bison.
> http://archives.postgresql.org/pgsql-sql/2006-08/msg00164.php
< o Allow COPY to output from SELECT
> o Allow COPY (SELECT ...) TO 'filename'
< COPY should also be able to output views.
> COPY should also be able to output views using COPY (SELECT
> * FROM view) TO 'filename' internally.
of the transaction ID counter. Nothing is done with the epoch except to
store it in checkpoint records, but this provides a foundation with which
add-on code can pretend that XIDs never wrap around. This is a severely
trimmed and rewritten version of the xxid patch submitted by Marko Kreen.
Per discussion, the epoch counter seems the only part of xxid that really
needs to be in the core server.
< * %Disallow changing DEFAULT expression of a SERIAL column?
<
< This should be done only if the existing SERIAL problems cannot be
< fixed.
<
< * %Disallow ALTER SEQUENCE changes for SERIAL sequences because pg_dump
< does not dump the changes
by abandoning the idea that it should say SERIAL in the dump. Instead,
dump serial sequences and column defaults just like regular ones.
Add a new backend command ALTER SEQUENCE OWNED BY to let pg_dump recreate
the sequence-to-column dependency that was formerly created "behind the
scenes" by SERIAL. This restores SERIAL to being truly "just a macro"
consisting of component operations that can be stated explicitly in SQL.
Furthermore, the new command allows sequence ownership to be reassigned,
so that old mistakes can be cleaned up.
Also, downgrade the OWNED-BY dependency from INTERNAL to AUTO, since there
is no longer any very compelling argument why the sequence couldn't be
dropped while keeping the column. (This forces initdb, to be sure the
right kinds of dependencies are in there.)
Along the way, add checks to prevent ALTER OWNER or SET SCHEMA on an
owned sequence; you can now only do this indirectly by changing the
owning table's owner or schema. This is an oversight in previous
releases, but probably not worth back-patching.
that ps_status provides by appending 'waiting' to the PS display. This
completes the project of making it feasible to turn off process title
updates and instead rely on pg_stat_activity. Per my suggestion a few
weeks ago.
than N seconds apart. This allows a simple, if not very high performance,
means of guaranteeing that a PITR archive is no more than N seconds behind
real time. Also make pg_current_xlog_location return the WAL Write pointer,
add pg_current_xlog_insert_location to return the Insert pointer, and fix
pg_xlogfile_name_offset to return its results as a two-element record instead
of a smashed-together string, as per recent discussion.
Simon Riggs
found. Besides stopping those early who have no dtrace installed
whatsoever, this will also alert those who have dtrace in /usr/sbin, which
might not be in the path, which would produce confusing failures much later
in the build process.
Add documentation about pointing configure to find dtrace.
such as debugging and performance measurement. This consists of two features:
a table of "rendezvous variables" that allows separately-loaded shared
libraries to communicate, and a new GUC setting "local_preload_libraries"
that allows libraries to be loaded into specific sessions without explicit
cooperation from the client application. To make local_preload_libraries
as flexible as possible, we do not restrict its use to superusers; instead,
it is restricted to load only libraries stored in $libdir/plugins/. The
existing LOAD command has also been modified to allow non-superusers to
LOAD libraries stored in this directory.
This patch also renames the existing GUC variable preload_libraries to
shared_preload_libraries (after a suggestion by Simon Riggs) and does some
code refactoring in dfmgr.c to improve clarity.
Korry Douglas, with a little help from Tom Lane.
merely a matter of fixing the error check, since the underlying Portal
infrastructure already handles it. This in turn allows these statements
to be used in some existing plpgsql and plperl contexts, such as a
plpgsql FOR loop. Also, do some marginal code cleanup in places that
were being sloppy about distinguishing SELECT from SELECT INTO.
< o Allow INSERT/UPDATE ... RETURNING new.col or old.col
<
< This is useful for returning the auto-generated key for an INSERT.
< One complication is how to handle rules that run as part of
< the insert.
< http://archives.postgresql.org/pgsql-patches/2005-07/msg00568.php
> o -Allow INSERT/UPDATE ... RETURNING new.col or old.col
plpgsql support to come later. Along the way, convert execMain's
SELECT INTO support into a DestReceiver, in order to eliminate some ugly
special cases.
Jonah Harris and Tom Lane
>
>
> Features We Do _Not_ Want
> =========================
>
> * All backends running as threads in a single process (not want)
>
> This eliminates the process protection we get from the current setup.
> Thread creation is usually the same overhead as process creation on
> modern systems, so it seems unwise to use a pure threaded model.
>
> * Optimizer hints (not want)
>
> Optimizer hints are used to work around problems in the optimizer. We
> would rather have the problems reported and fixed.
> http://archives.postgresql.org/pgsql-hackers/2006-08/msg00506.php
< A package would be a schema with its own variables,
< private functions, and initialization functions. It
> A package would be a schema with public/private variables,
> public/private functions, and initialization functions. It
< private functions, and initialization functions
> private functions, and initialization functions. It
> is also possible to implement these capabilities
> in all schemas and not use a separate "packages"
> syntax at all.
loaded libraries: call functions _PG_init() and _PG_fini() if the library
defines such symbols. Hence we no longer need to specify an initialization
function in preload_libraries: we can assume that the library used the
_PG_init() convention, instead. This removes one source of pilot error
in use of preloaded libraries. Original patch by Ralf Engelschall,
preload_libraries changes by me.
< o Automatically force archiving of partially-filled WAL files when
> o -Automatically force archiving of partially-filled WAL files when
<
< Doing this will allow administrators to know more easily when
< the archive contains all the files needed for point-in-time
< recovery.
< http://archives.postgresql.org/pgsql-patches/2005-04/msg00121.php
<
< o Add reporting of the current WAL file and offset, perhaps as
> o -Add reporting of the current WAL file and offset, perhaps as
<
< The offset allows parts of a WAL file to be archived using
< an external program.
<
o print user name for all
o print portal name if defined for all
o print query for all
o reduce log_statement header to single keyword
o print bind parameters as DETAIL if text mode
to happen automatically during pg_stop_backup(). Add some functions for
interrogating the current xlog insertion point and for easily extracting
WAL filenames from the hex WAL locations displayed by pg_stop_backup
and friends. Simon Riggs with some editorialization by Tom Lane.
the DROP pass rather than the ADD_CONSTR pass. On examining the code I
think this was just an oversight rather than intentional, and it seems
to satisfy the principle of least surprise better than the alternative
solution that was discussed. Add an example to the ref page showing how
to do ALTER TYPE and update the default in one command. Per gripe from
Markus Bertheau that that wasn't possible.
(table or index) before trying to open its relcache entry. This fixes
race conditions in which someone else commits a change to the relation's
catalog entries while we are in process of doing relcache load. Problems
of that ilk have been reported sporadically for years, but it was not
really practical to fix until recently --- for instance, the recent
addition of WAL-log support for in-place updates helped.
Along the way, remove pg_am.amconcurrent: all AMs are now expected to support
concurrent update.
created in the bootstrap phase proper, rather than added after-the-fact
by initdb. This is cleaner than before because it allows us to retire the
undocumented ALTER TABLE ... CREATE TOAST TABLE command, but the real reason
I'm doing it is so that toast tables of shared catalogs will now have
predetermined OIDs. This will allow a reasonably clean solution to the
problem of locking tables before we load their relcache entries, to appear
in a forthcoming patch.
the float8 versions of the aggregates, which is all that the standard requires.
Sergey's original patch also provided versions using numeric arithmetic,
but given the size and slowness of the code, I doubt we ought to include
those in core.
the opportunity to treat COUNT(*) as a zero-argument aggregate instead
of the old hack that equated it to COUNT(1); this is materially cleaner
(no more weird ANYOID cases) and ought to be at least a tiny bit faster.
Original patch by Sergey Koposov; review, documentation, simple regression
tests, pg_dump and psql support by moi.
< o Allow point-in-time recovery to archive partially filled
< write-ahead logs? [pitr]
> o Add command to archive partially filled write-ahead logs? [pitr]
< of a disk failure. This could be triggered by a user command or
< a timer.
> of a disk failure.
< recovery. A function call to do this would also be useful.
> recovery.
> o Add reporting of the current WAL file and offset, perhaps as
> part of partial log file archiving
>
> The offset allows parts of a WAL file to be archived using
> an external program.
>
< o Add reporting of the current WAL file and offset, perhaps as
< part of partial log file archiving
<
< The offset allows parts of a WAL file to be archived using
< an external program.
< o Add reporting of the current WAL file, perhaps as part of
< partial log file archiving
> o Add reporting of the current WAL file and offset, perhaps as
> part of partial log file archiving
configuration files that can be altered by a DBA. The australian_timezones
GUC setting disappears, replaced by a timezone_abbreviations setting (set this
to 'Australia' to get the effect of australian_timezones). The list of zone
names defined by default has undergone a bit of cleanup, too. Documentation
still needs some work --- in particular, should we fix Table B-4, or just get
rid of it? Joachim Wieland, with some editorializing by moi.
just exec instead of creating a subprocess. This reduces process usage
from four processes per parallel test to two. I have no idea whether
a comparable optimization is possible or useful in the Windows port.
This allows it to be used on Windows without installing mingw
(though you do still need 'diff'), and opens the door to future
improvements such as message localization.
Magnus Hagander and Tom Lane.
it can handle small fillfactors for ordinary-sized index entries without
failing on large ones; fix nbtinsert.c to distinguish leaf and nonleaf
pages; change the minimum fillfactor to 10% for all index types.
To this end, add a couple of columns to pg_class, relminxid and relvacuumxid,
based on which we calculate the pg_database columns after each vacuum.
We now force all databases to be vacuumed, even template ones. A backend
noticing too old a database (meaning pg_database.datminxid is in danger of
falling behind Xid wraparound) will signal the postmaster, which in turn will
start an autovacuum iteration to process the offending database. In principle
this is only there to cope with frozen (non-connectable) databases without
forcing users to set them to connectable, but it could force regular user
database to go through a database-wide vacuum at any time. Maybe we should
warn users about this somehow. Of course the real solution will be to use
autovacuum all the time ;-)
There are some additional improvements we could have in this area: for example
the vacuum code could be smarter about not updating pg_database for each table
when called by autovacuum, and do it only once the whole autovacuum iteration
is done.
I updated the system catalogs documentation, but I didn't modify the
maintenance section. Also having some regression tests for this would be nice
but it's not really a very straightforward thing to do.
Catalog version bumped due to system catalog changes.
discussion (including making def_arg allow reserved words), add missed
opt_definition for UNIQUE case. Put the reloptions support code in a less
random place (I chose to make a new file access/common/reloptions.c).
Eliminate header inclusion creep. Make the index options functions safely
user-callable (seems like client apps might like to be able to test validity
of options before trying to make an index). Reduce overhead for normal case
with no options by allowing rd_options to be NULL. Fix some unmaintainably
klugy code, including getting rid of Natts_pg_class_fixed at long last.
Some stylistic cleanup too, and pay attention to keeping comments in sync
with code.
Documentation still needs work, though I did fix the omissions in
catalogs.sgml and indexam.sgml.
< o Add ALTER TABLE tab ADD/DROP INHERITS parent
<
< This allows tables to be added/removed from an inheritance
< hierarchy. This is particularly useful for table partitioning.
< http://archives.postgresql.org/pgsql-hackers/2006-05/msg00988.php
<
> o -Add ALTER TABLE tab INHERIT / NO INHERIT parent
Open items:
There were a few tangentially related issues that have come up that I think
are TODOs. I'm likely to tackle one or two of these next so I'm interested in
hearing feedback on them as well.
. Constraints currently do not know anything about inheritance. Tom suggested
adding a coninhcount and conislocal like attributes have to track their
inheritance status.
. Foreign key constraints currently do not get copied to new children (and
therefore my code doesn't verify them). I don't think it would be hard to
add them and treat them like CHECK constraints.
. No constraints at all are copied to tables defined with LIKE. That makes it
hard to use LIKE to define new partitions. The standard defines LIKE and
specifically says it does not copy constraints. But the standard already has
an option called INCLUDING DEFAULTS; we could always define a non-standard
extension LIKE table INCLUDING CONSTRAINTS that gives the user the option to
request a copy including constraints.
. Personally, I think the whole attislocal thing is bunk. The decision about
whether to drop a column from children tables or not is something that
should be up to the user and trying to DWIM based on whether there was ever
a local definition or the column was acquired purely through inheritance is
hardly ever going to match up with user expectations.
. And of course there's the whole unique and primary key constraint issue. I
think to get any traction at all on this you have a prerequisite of a real
partitioned table implementation where the system knows what the partition
key is so it can recognize when it's a leading part of an index key.
Greg Stark
be delivered directly to the collector process. The extra process context
swaps required to transfer data through the buffer process seem to outweigh
any value the buffering might have. Per recent discussion and tests.
I modified Bruce's draft patch to use poll() rather than select() where
available (this makes a noticeable difference on my system), and fixed
up the EXEC_BACKEND case.
< o Add support for WITH HOLD cursors
> o Add support for WITH HOLD and SCROLL cursors
>
> PL/pgSQL cursors should support the same syntax as
> backend cursors.
>
< * %Disallow changing DEFAULT expression of a SERIAL column?
<
< This should be done only if the existing SERIAL problems cannot be
< fixed.
<
> * -Disallow changing DEFAULT expression of a SERIAL column
will be expanded to a list of their member fields, rather than creating
a nested rowtype field as formerly. (The old behavior is still available
by omitting '.*'.) This syntax is not allowed by the SQL spec AFAICS,
so changing its behavior doesn't violate the spec. The new behavior is
substantially more useful since it allows, for example, triggers to check
for data changes with 'if row(new.*) is distinct from row(old.*)'. Per
my recent proposal.
< * Reuse index tuples that point to rows that are not visible to anyone?
> * Reuse index tuples that point to heap tuples that are not visible to
> anyone?
< * Allow heap reuse of UPDATEd rows if old and new versions are on the
< same heap page?
> * Allow heap reuse of UPDATEd rows if no indexed columns are changed,
> and old and new versions are on the same heap page?
< This is possible for same-page updates because a single index row
< can point to both old and new values.
> While vacuum handles DELETEs fine, updating of non-indexed columns, like
> counters, are difficult for VACUUM to handle efficiently. This method
> is possible for same-page updates because a single index row can be
> used to point to both old and new values.
>
> * Allow heap reuse of UPDATEd rows if old and new versions are on the
> same heap page?
>
> This is possible for same-page updates because a single index row
> can point to both old and new values.
> http://archives.postgresql.org/pgsql-hackers/2006-06/msg01305.php
current commands; instead, store current-status information in shared
memory. This substantially reduces the overhead of stats_command_string
and also ensures that pg_stat_activity is fully up to date at all times.
Per my recent proposal.
section into PL/pgSQL and non-PL/pgSQL sections:
< o Fix PL/pgSQL RENAME to work on variables other than OLD/NEW
< o Allow function parameters to be passed by name,
< get_employee_salary(emp_id => 12345, tax_year => 2001)
< o Add Oracle-style packages
< o Add table function support to pltcl, plpython
< o Add capability to create and call PROCEDURES
< o Allow PL/pgSQL to handle %TYPE arrays, e.g. tab.col%TYPE[]
< o Allow function argument names to be statements from PL/PgSQL
< o Add MOVE to PL/pgSQL
< o Add support for polymorphic arguments and return types to
< languages other than PL/PgSQL
< o Add support for OUT and INOUT parameters to languages other
< than PL/PgSQL
< o Add single-step debugging of PL/PgSQL functions
< o Allow PL/PgSQL to support WITH HOLD cursors
< o Allow PL/PgSQL RETURN to return row or record functions
<
< http://archives.postgresql.org/pgsql-patches/2005-11/msg00045.php
> o PL/pgSQL
> o Fix RENAME to work on variables other than OLD/NEW
> o Allow function parameters to be passed by name,
> get_employee_salary(emp_id => 12345, tax_year => 2001)
> o Add Oracle-style packages
> o Allow handling of %TYPE arrays, e.g. tab.col%TYPE[]
> o Allow listing of record column names, and access to
> record columns via variables, e.g. columns := r.(*),
> tval2 := r.(colname)
>
> http://archives.postgresql.org/pgsql-patches/2005-07/msg00458.php
> http://archives.postgresql.org/pgsql-patches/2006-05/msg00302.php
> http://archives.postgresql.org/pgsql-patches/2006-06/msg00031.php
>
> o Add MOVE
> o Add single-step debugging of functions
> o Add support for WITH HOLD cursors
> o Allow PL/RETURN to return row or record functions
>
> http://archives.postgresql.org/pgsql-patches/2005-11/msg00045.php
>
>
> o Other
> o Add table function support to pltcl, plpython
> o Add support for polymorphic arguments and return types to
> languages other than PL/PgSQL
> o Add capability to create and call PROCEDURES
> o Add support for OUT and INOUT parameters to languages other
> than PL/PgSQL
<
< o Add new version of PQescapeString() that doesn't double backslashes
< that are part of a client-only multibyte sequence
<
< Single-quote is not a valid byte in any supported client-only
< encoding. This requires using mblen() to determine if the
< backslash is inside or outside a multi-byte sequence.
<
< o Add new version of PQescapeString() that doesn't double
< backslashes when standard_conforming_strings is true and
< non-E strings are used
< Right now only one encoding is allowed per database.
> Right now only one encoding is allowed per database. [locale]
> * Add CREATE COLLATE? [locale]
< pg_get_tabledef(), pg_get_domaindef(), pg_get_functiondef(), and
< make use of them in pg_dump
> pg_get_tabledef(), pg_get_domaindef(), pg_get_functiondef()
< pg_get_tabledef(), pg_get_domaindef(), pg_get_functiondef()
> pg_get_tabledef(), pg_get_domaindef(), pg_get_functiondef(), and
> make use of them in pg_dump
< * Allow a database in tablespace t1 with tables created in
> o Allow a database in tablespace t1 with tables created in
125c125
< * Allow reporting of which objects are in which tablespaces
> o Allow reporting of which objects are in which tablespaces
593c593
< * Allow GRANT/REVOKE permissions to be inherited by objects based on
> o Allow GRANT/REVOKE permissions to be inherited by objects based on
596c596
< * Allow SERIAL sequences to inherit permissions from the base table?
> o Allow SERIAL sequences to inherit permissions from the base table?
that the Mackert-Lohmann formula applies across all the repetitions of the
nestloop, not just each scan independently. We use the M-L formula to
estimate the number of pages fetched from the index as well as from the table;
that isn't what it was designed for, but it seems reasonably applicable
anyway. This makes large numbers of repetitions look much cheaper than
before, which accords with many reports we've received of overestimation
of the cost of a nestloop. Also, change the index access cost model to
charge random_page_cost per index leaf page touched, while explicitly
not counting anything for access to metapage or upper tree pages. This
may all need tweaking after we get some field experience, but in simple
tests it seems to be giving saner results than before. The main thing
is to get the infrastructure in place to let cost_index() and amcostestimate
functions take repeated scans into account at all. Per my recent proposal.
Note: this patch changes pg_proc.h, but I did not force initdb because
the changes are basically cosmetic --- the system does not look into
pg_proc to decide how to call an index amcostestimate function, and
there's no way to call such a function from SQL at all.
This shouldn't affect simple indexscans much, while for bitmap scans that
are touching a lot of index rows, this seems to bring the estimates more
in line with reality. Per recent discussion.
assumed that a sequential page fetch has cost 1.0. This patch doesn't
in itself change the system's behavior at all, but it opens the door to
people adopting other units of measurement for EXPLAIN costs. Also, if
we ever decide it's worth inventing per-tablespace access cost settings,
this change provides a workable intellectual framework for that.
< o Allow COPY to output from views
> o Allow COPY to output from SELECT
570c570
< Another idea would be to allow actual SELECT statements in a COPY.
> COPY should also be able to output views.
as this seems only likely to create headaches for module developers. Put
the macro in the pre-existing fmgr.h file instead. Avoid being too cute
about how many fields we can cram into a word, and avoid trying to fetch
from a library we've already unlinked.
Along the way, it occurred to me that the magic block really ought to be
'const' so it can be stored in the program text area. Do the same for
the existing data blocks for PG_FUNCTION_INFO_V1 functions.
It now only checks four things:
Major version number (7.4 or 8.1 for example)
NAMEDATALEN
FUNC_MAX_ARGS
INDEX_MAX_KEYS
The three constants were chosen because:
1. We document them in the config page in the docs
2. We mark them as changable in pg_config_manual.h
3. Changing any of these will break some of the more popular modules:
FUNC_MAX_ARGS changes fmgr interface, every module uses this NAMEDATALEN
changes syscache interface, every PL as well as tsearch uses this
INDEX_MAX_KEYS breaks tsearch and anything using GiST.
Martijn van Oosterhout
---------------------------------------------------------------------------
Add dynamic record inspection to PL/PgSQL, useful for generic triggers:
tval2 := r.(cname);
or
columns := r.(*);
Titus von Boxberg
An article at WebProNews quoted from the PG docs as to the merits of
stored procedures. I have added a bit more material on their merits,
as well as making a few changes to improve the introductions to
PL/Perl and PL/Tcl.
Chris Browne
kept but now deprecated. Patch from Adam Sjøgren. Add regression test to
show plperl trigger data (Andrew).
TBD: apply similar changes to plpgsql, plpython and pltcl.
* some refactoring and simplify code int gistutil.c and gist.c
* now in some cases it can be called used-defined
picksplit method for non-first column in index, but here
is a place to do more.
* small fix of docs related to support NULL.
> o Add ALTER TABLE tab ADD/DROP INHERITS parent
>
> pg_attribute.attislocal has to be set to 'false' for ADD, and
> pg_attribute.attinhcount adjusted appropriately
>
> * Referential Integrity
>
> o Add MATCH PARTIAL referential integrity
> o Change foreign key constraint for array -> element to mean element
> in array?
> o Enforce referential integrity for system tables
>
>
< Referential Integrity
< =====================
<
< * Add MATCH PARTIAL referential integrity
> Triggers
> ========
< * Change foreign key constraint for array -> element to mean element
< in array?
801d804
< * Enforce referential integrity for system tables
and standard_conforming_strings. The encoding changes are needed for proper
escaping in multibyte encodings, as per the SQL-injection vulnerabilities
noted in CVE-2006-2313 and CVE-2006-2314. Concurrent fixes are being applied
to the server to ensure that it rejects queries that may have been corrupted
by attempted SQL injection, but this merely guarantees that unpatched clients
will fail rather than allow injection. An actual fix requires changing the
client-side code. While at it we have also fixed these routines to understand
about standard_conforming_strings, so that the upcoming changeover to SQL-spec
string syntax can be somewhat transparent to client code.
Since the existing API of PQescapeString and PQescapeBytea provides no way to
inform them which settings are in use, these functions are now deprecated in
favor of new functions PQescapeStringConn and PQescapeByteaConn. The new
functions take the PGconn to which the string will be sent as an additional
parameter, and look inside the connection structure to determine what to do.
So as to provide some functionality for clients using the old functions,
libpq stores the latest encoding and standard_conforming_strings values
received from the backend in static variables, and the old functions consult
these variables. This will work reliably in clients using only one Postgres
connection at a time, or even multiple connections if they all use the same
encoding and string syntax settings; which should cover many practical
scenarios.
Clients that use homebrew escaping methods, such as PHP's addslashes()
function or even hardwired regexp substitution, will require extra effort
to fix :-(. It is strongly recommended that such code be replaced by use of
PQescapeStringConn/PQescapeByteaConn if at all feasible.
parser will allow "\'" to be used to represent a literal quote mark. The
"\'" representation has been deprecated for some time in favor of the
SQL-standard representation "''" (two single quote marks), but it has been
used often enough that just disallowing it immediately won't do. Hence
backslash_quote allows the settings "on", "off", and "safe_encoding",
the last meaning to allow "\'" only if client_encoding is a valid server
encoding. That is now the default, and the reason is that in encodings
such as SJIS that allow 0x5c (ASCII backslash) to be the last byte of a
multibyte character, accepting "\'" allows SQL-injection attacks as per
CVE-2006-2314 (further details will be published after release). The
"on" setting is available for backward compatibility, but it must not be
used with clients that are exposed to untrusted input.
Thanks to Akio Ishida and Yasuo Ohgaki for identifying this security issue.
issued by autovacuum. Add accessor functions to them, and use those in the
pg_stat_*_tables system views.
Catalog version bumped due to changes in the pgstat views and the pgstat file.
Patch from Larry Rosenman, minor improvements by me.
throw warnings for 100%-SQL-standard constructs, clean up some minor
infelicities, try to un-break ecpg to the best of my ability. (It's not clear
how ecpg is going to find out the setting of standard_conforming_strings,
though.) I think pg_dump still needs work, too.
(relpages/reltuples). To do this, create formal support in heapam.c for
"overwrite" tuple updates (including xlog replay capability) and use that
instead of the ad-hoc overwrites we'd been using in VACUUM and CREATE INDEX.
Take the responsibility for updating stats during CREATE INDEX out of the
individual index AMs, and do it where it belongs, in catalog/index.c. Aside
from being more modular, this avoids having to update the same tuple twice in
some paths through CREATE INDEX. It's probably not measurably faster, but
for sure it's a lot cleaner than before.
< * %Disallow changing default expression of a SERIAL column?
> * %Disallow changing DEFAULT expression of a SERIAL column?
472a473,476
> * Add DEFAULT .. AS OWNER so permission checks are done as the table
> owner
>
> This would be useful for SERIAL nextval() calls and CHECK constraints.
The former approach used ExclusiveLock on pg_database, which being a
cluster-wide lock meant only one of these operations could proceed at
a time; worse, it also blocked all incoming connections in ReverifyMyDatabase.
Now that we have LockSharedObject(), we can use locks of different types
applied to databases considered as objects. This allows much more
flexible management of the interlocking: two CREATE DATABASEs need not
block each other, and need not block connections except to the template
database being used. Similarly DROP DATABASE doesn't block unrelated
operations. The locking used in flatfiles.c is also much narrower in
scope than before. Per recent proposal.
This formulation requires every AM to provide amvacuumcleanup, unlike before,
but it's surely a whole lot cleaner. Also, add an 'amstorage' column to
pg_am so that we can get rid of hardwired knowledge in DefineOpClass().