Tom Lane [Tue, 11 Dec 2007 19:01:06 +0000 (19:01 +0000)]
Remove the long-deprecated -u option from psql, since it does nothing very
useful and confuses people who think it is the same as -U. (Eventually
we might want to re-introduce it as being an alias for -U, but that should
not happen until the switch has actually not been there for a few releases.)
Likewise in pg_dump and pg_restore. Per gripe from Robert Treat and
subsequent discussion.
Alvaro Herrera [Tue, 11 Dec 2007 15:19:05 +0000 (15:19 +0000)]
Extend the format of CSV logs to include the additional information supplied
with the logged event. CSV logs are now a first-class citizen along plain
text logs in that they carry much of the same information.
Tom Lane [Tue, 11 Dec 2007 02:31:49 +0000 (02:31 +0000)]
Remove the -P options of oid2name and pgbench, as they are security
hazards. Instead teach these programs to prompt for a password when
necessary, just like all our other programs.
I did not bother to invent -W switches for them, since the return on
investment seems so low.
Tom Lane [Tue, 11 Dec 2007 02:08:59 +0000 (02:08 +0000)]
Make vacuumlo prompt for password when needed, thus making its -W
switch optional, as is the case for every other one of our programs.
I had already documented its -W as being optional, so this is bringing
the code into line with the docs ...
Tom Lane [Sun, 9 Dec 2007 21:01:18 +0000 (21:01 +0000)]
The E. J. Pratt verse used as a tsearch test case is unfortunately still
under copyright in the US and many other places. Substitute a little
something from a poet who's more safely dead. Per gripe from Bjorn Munch.
Tom Lane [Sun, 9 Dec 2007 19:01:40 +0000 (19:01 +0000)]
Fix up the PQconnectionUsedPassword mess: create a separate
PQconnectionNeedsPassword function that tells the right thing for whether to
prompt for a password, and improve PQconnectionUsedPassword so that it checks
whether the password used by the connection was actually supplied as a
connection argument, instead of coming from environment or a password file.
Per bug report from Mark Cave-Ayland and subsequent discussion.
Tom Lane [Sat, 8 Dec 2007 21:05:11 +0000 (21:05 +0000)]
Fix mergejoin cost estimation so that we consider the statistical ranges of
the two join variables at both ends: not only trailing rows that need not be
scanned because there cannot be a match on the other side, but initial rows
that will be scanned without possibly having a match. This allows a more
realistic estimate of startup cost to be made, per recent pgsql-performance
discussion. In passing, fix a couple of bugs that had crept into
mergejoinscansel: it was not quite up to speed for the task of estimating
descending-order scans, which is a new requirement in 8.3.
Bruce Momjian [Fri, 7 Dec 2007 17:52:15 +0000 (17:52 +0000)]
Remove completed 8.3 TODO items:
< o -Allow commenting of variables in postgresql.conf to restore them
< to defaults
< o -Add a GUC variable to control the tablespace for temporary objects
< and sort files
< Monitoring
< ==========
<
< * -Allow server log information to be output as CSV format
< * -Add ability to monitor the use of temporary sort files
< * -Allow user-defined types to accept 'typmod' parameters
<
< http://archives.postgresql.org/pgsql-hackers/2005-08/msg01142.php
< http://archives.postgresql.org/pgsql-hackers/2005-09/msg00012.php
< http://archives.postgresql.org/pgsql-hackers/2006-08/msg00149.php
<
< * -Add Globally/Universally Unique Identifier (GUID/UUID)
<
< http://archives.postgresql.org/pgsql-patches/2006-09/msg00209.php
< http://archives.postgresql.org/pgsql-general/2007-01/msg00853.php
<
< * -Support a data type with specific enumerated values (ENUM)
< o -Add support for arrays of complex types
< o -Make 64-bit version of the MONEY data type
< * -Add ISO day of week format 'ID' to to_char() where Monday = 1
< * -Add a field 'isoyear' to extract(), based on the ISO week
< * -Add RESET SESSION command to reset all session state
< o -Make CLUSTER preserve recently-dead tuples per MVCC requirements
< o -Add more logical syntax CLUSTER table USING index;
< support current syntax for backward compatibility
< o -Allow UPDATE/DELETE WHERE CURRENT OF cursor
< o -Add support for MOVE cursors
< o -Allow PL/PythonU to return boolean rather than 1/0
< o -Allow psql \pset boolean variables to set to fixed values, rather
< than toggle
< o -Add -f to pg_dumpall
< Dependency Checking
< ===================
<
< * -Flush cached query plans when the dependent objects change or
< when new ANALYZE statistics are available
< * -Track dependencies in function bodies and recompile/invalidate
< * -Invalidate prepared queries, like INSERT, when the table definition
< is altered
<
< * -Allow use of indexes to search for NULLs
< * -Allow the creation of indexes with mixed ascending/descending
< specifiers
< * -Reduce checkpoint performance degredation by forcing data to disk
< more evenly
< * -Allow sequential scans to take advantage of other concurrent
< sequential scans, also called "Synchronised Scanning"
< * -Consider shrinking expired tuples to just their headers
< * -Allow heap reuse of UPDATEd rows if no indexed columns are changed,
< and old and new versions are on the same heap page
< * -Reduce XID consumption of read-only queries
< o -Turn on by default
< o -Allow multiple vacuums so large tables do not starve small
< tables
< * -Allow the pg_xlog directory location to be specified during initdb
< with a symlink back to the /data location
< * -Allow buffered WAL writes and fsync
< * -Allow ORDER BY ... LIMIT # to select high/low value without sort or
< index using a sequential scan for highest/lowest values
< * -Merge xmin/xmax/cmin/cmax back into three header fields
< o -Support a smaller header for short variable-length fields
< * -Move NAMEDATALEN from postgres_ext.h to pg_config_manual.h
< * -Fix problem with excessive logging during SSL disconnection
<
< http://archives.postgresql.org/pgsql-bugs/2006-12/msg00122.php
< http://archives.postgresql.org/pgsql-bugs/2007-05/msg00065.php
<
< o -Add long file support for binary pg_dump output
Tom Lane [Fri, 7 Dec 2007 16:44:58 +0000 (16:44 +0000)]
Clean up a couple of problems in crosstab_hash's use of a hash table.
The original coding leaked memory (at least 8K per crosstab_hash call)
because it allowed the hash table to be allocated as a child of
TopMemoryContext and then never freed it. Fix that by putting the
hash table under per_query_ctx, instead. Also get rid of use
of a static variable to point to the hash table. Aside from being
ugly, that would actively do the wrong thing in the case of re-entrant
calls to crosstab_hash, which are at least theoretically possible
since it was expecting the static variable to stay valid across
a SPI_execute call.
Alvaro Herrera [Thu, 6 Dec 2007 14:32:54 +0000 (14:32 +0000)]
Change wording of logged message when cancelling an autovacuum task, using
american speling (unlike this commit message). Per complaint from Mike C. on
bug #3790 and subsequent discussion.
Tom Lane [Tue, 4 Dec 2007 23:45:01 +0000 (23:45 +0000)]
Correct misattribution of earthdistance module --- according to its
old README file, Bruno Wolff did the bulk of the work, but for some
reason only Hal Snyder was credited here.
Tom Lane [Mon, 3 Dec 2007 22:37:17 +0000 (22:37 +0000)]
Fix build_minmax_path() to cope if an IS NULL clause turns up in the
indexable-clauses list for a btree index. Formerly it just Asserted that
all such clauses were opclauses, but that's no longer true in 8.3.
Per bug #3796 from Matthias Schoeneich.
Tom Lane [Mon, 3 Dec 2007 19:20:40 +0000 (19:20 +0000)]
Remove contrib/spi/preprocessor, which has been uninteresting ever
since we supported standard FOREIGN KEY constraint syntax. It was
harmless enough just sitting there, but the prospect of having to
document it is surely more work than it's worth.
Tom Lane [Mon, 3 Dec 2007 00:03:05 +0000 (00:03 +0000)]
Revert COPY OUT to follow the pre-8.3 handling of ASCII control characters,
namely that \r, \n, \t, \b, \f, \v are dumped as those two-character
representations rather than a backslash and the literal control character.
I had made it do the other to save some code, but this was ill-advised,
because dump files in which these characters appear literally are prone to
newline mangling. Fortunately, doing it the old way should only cost a few
more lines of code, and not slow down the copy loop materially.
Per bug #3795 from Lou Duchez.
Tom Lane [Sun, 2 Dec 2007 22:33:20 +0000 (22:33 +0000)]
Ensure that all <sect1> and <refentry> tags have IDs. This is needed
to ensure that the resulting webpages have predictable URLs, instead of
ever-changing numeric IDs. The new contrib docs were the biggest
offender, but some old stuff had the problem too. Also, rename a couple
of new contrib sgml files for consistency's sake.
Tom Lane [Sun, 2 Dec 2007 19:20:32 +0000 (19:20 +0000)]
Improve the manual's discussion of partitioning. Recommend using a
trigger instead of a rule to redirect insertions, use NEW.* notation
where appropriate, some other updates and adjustments. David Fetter
and Tom Lane
Tom Lane [Sat, 1 Dec 2007 23:44:44 +0000 (23:44 +0000)]
Code review for LIKE ... INCLUDING INDEXES patch. Fix failure to propagate
constraint status of copied indexes (bug #3774), as well as various other
small bugs such as failure to pstrdup when needed. Allow INCLUDING INDEXES
indexes to be merged with identical declared indexes (perhaps not real useful,
but the code is there and having it not apply to LIKE indexes seems pretty
unorthogonal). Avoid useless work in generateClonedIndexStmt(). Undo some
poorly chosen API changes, and put a couple of routines in modules that seem
to be better places for them.
Andrew Dunstan [Sat, 1 Dec 2007 15:20:34 +0000 (15:20 +0000)]
Workaround for perl problem where evaluating UTF8 regexes can cause
implicit loading of modules, thereby breaking Safe rules.
We compile and call a tiny perl function on trusted interpreter init, after which
the problem does not occur.
Tom Lane [Fri, 30 Nov 2007 21:22:54 +0000 (21:22 +0000)]
Avoid incrementing the CommandCounter when CommandCounterIncrement is called
but no database changes have been made since the last CommandCounterIncrement.
This should result in a significant improvement in the number of "commands"
that can typically be performed within a transaction before hitting the 2^32
CommandId size limit. In particular this buys back (and more) the possible
adverse consequences of my previous patch to fix plan caching behavior.
The implementation requires tracking whether the current CommandCounter
value has been "used" to mark any tuples. CommandCounter values stored into
snapshots are presumed not to be used for this purpose. This requires some
small executor changes, since the executor used to conflate the curcid of
the snapshot it was using with the command ID to mark output tuples with.
Separating these concepts allows some small simplifications in executor APIs.
Something for the TODO list: look into having CommandCounterIncrement not do
AcceptInvalidationMessages. It seems fairly bogus to be doing it there,
but exactly where to do it instead isn't clear, and I'm disinclined to mess
with asynchronous behavior during late beta.
Tom Lane [Fri, 30 Nov 2007 18:38:34 +0000 (18:38 +0000)]
Repair bug that allowed RevalidateCachedPlan to attempt to rebuild a cached
plan before the effects of DDL executed in an immediately prior SPI operation
had been absorbed. Per report from Chris Wood.
This patch has an unpleasant side effect of causing the number of
CommandCounterIncrement()s done by a typical plpgsql function to
approximately double. Amelioration of the consequences of that
will be undertaken in a separate patch.
Tom Lane [Wed, 28 Nov 2007 21:56:30 +0000 (21:56 +0000)]
Make a cleanup pass over error reports in tsearch code. Use ereport
for user-facing errors, fix some poor choices of errcode, adhere to
message style guide.
Tom Lane [Wed, 28 Nov 2007 20:44:26 +0000 (20:44 +0000)]
Improve test coverage of CLOBBER_CACHE_ALWAYS by having it also force
reloading of operator class information on each use of LookupOpclassInfo.
Had this been in place a year ago, it would have helped me find a bug
in the then-new 'operator family' code. Now that we have a build farm
member testing CLOBBER_CACHE_ALWAYS on a regular basis, it seems worth
expending a little bit of effort here.
Tom Lane [Wed, 28 Nov 2007 19:33:05 +0000 (19:33 +0000)]
Adjust the names of a couple of tsearch index support functions that had
inappropriately generic-sounding names. This is more or less free since
we already forced initdb for the next beta, and it may prevent confusion or
name conflicts (particularly at the C-global-symbol level) down the road.
Per my proposal yesterday.
Tom Lane [Wed, 28 Nov 2007 18:47:56 +0000 (18:47 +0000)]
Install a lookaside cache to speed up repeated lookups of the same operator
by short-circuiting schema search path and ambiguous-operator resolution
computations. Remarkably, this buys as much as 45% speedup of repetitive
simple queries that involve operators that are not an exact match to the
input datatypes. It should be marginally faster even for exact-match
cases, though I've not had success in proving an improvement in benchmark
tests. Per report from Guillame Smet and subsequent discussion.
Tom Lane [Tue, 27 Nov 2007 19:58:44 +0000 (19:58 +0000)]
Fix plpgsql to not lookup block labels except in contexts where a block label
is sane (eg, EXIT argument or first part of a qualified identifier), and cause
more-closely-nested record variables to take precedence over outer block
labels. This cures the breakage exhibited by Marko Kreen that 8.3 no longer
allowed a function's name to be used for a variable within the function, and
makes plpgsql's handling of block labels more like Oracle's. It's important
to fix this now because we are documenting the use of block labels as variable
qualifiers for the first time in 8.3.
Tom Lane [Tue, 27 Nov 2007 18:29:11 +0000 (18:29 +0000)]
Add quote_literal(anyelement) to preserve (and, in fact, extend) a
useful consequence of the former liberal implicit casting to text;
namely that you can feed non-string values to quote_literal() and get
unsurprising results. Per discussion.
Peter Eisentraut [Tue, 27 Nov 2007 12:21:05 +0000 (12:21 +0000)]
Make casts from xml to text independent of the XML option setting, thus
immutable and indexable. Also fix the volatility settings of some other
XML-related functions.
Bruce Momjian [Mon, 26 Nov 2007 23:31:09 +0000 (23:31 +0000)]
Add:
< * -Make 64-bit version of the MONEY data type
< * Add locale-aware MONEY type, and support multiple currencies
<
< http://archives.postgresql.org/pgsql-general/2005-08/msg01432.php
< http://archives.postgresql.org/pgsql-hackers/2007-03/msg01181.php
<
< * MONEY dumps in a locale-specific format making it difficult to
< restore to a system with a different locale
>
> * MONEY data type
>
> o -Make 64-bit version of the MONEY data type
> * Add locale-aware MONEY type, and support multiple currencies
>
> http://archives.postgresql.org/pgsql-general/2005-08/msg01432.php
> http://archives.postgresql.org/pgsql-hackers/2007-03/msg01181.php
>
> * MONEY dumps in a locale-specific format making it difficult to
> restore to a system with a different locale
> * Allow MONEY to be cast to/from other numeric data types
Tom Lane [Mon, 26 Nov 2007 16:46:51 +0000 (16:46 +0000)]
Fix select_common_type() so that it can select a domain type, if all inputs
to a UNION, CASE, or related construct are of the same domain type. The
main part of this routine smashes domains to their base types, which seems
necessary because the logic involves TypeCategory() and IsPreferredType(),
neither of which work usefully on domains. However, we can add a first
pass that just detects whether all the inputs are exactly the same type,
and if so accept that without question (so long as it's not UNKNOWN).
Per recent gripe from Dean Rasheed.
In passing, remove some tests for InvalidOid, which have clearly been dead
code for quite some time now, because getBaseType() would fail on that input.
Also, clarify the manual's not-very-precise description of the existing
algorithm's behavior.