]> granicus.if.org Git - postgresql/log
postgresql
11 years agoFix typo in comment.
Heikki Linnakangas [Thu, 25 Apr 2013 11:03:10 +0000 (14:03 +0300)]
Fix typo in comment.

Peter Geoghegan

11 years agopg_basebackup: Add missing newlines at end of lines
Peter Eisentraut [Thu, 25 Apr 2013 02:51:10 +0000 (22:51 -0400)]
pg_basebackup: Add missing newlines at end of lines

11 years agoinitdb: Improve some messages
Peter Eisentraut [Thu, 25 Apr 2013 02:50:33 +0000 (22:50 -0400)]
initdb: Improve some messages

11 years agoPL/pgSQL doc: Add example for RETURN QUERY
Peter Eisentraut [Wed, 24 Apr 2013 02:46:36 +0000 (22:46 -0400)]
PL/pgSQL doc: Add example for RETURN QUERY

Erwin Brandstetter and Pavel Stěhule

11 years agoAdd missing #include.
Heikki Linnakangas [Wed, 24 Apr 2013 16:11:25 +0000 (19:11 +0300)]
Add missing #include.

On non-Windows systems, sys/time.h was pulled in by portability/instr_time.h,
which pulled in time.h. We certainly should include time.h directly, since
we're using time(2), but the indirect include masked the problem on most
platforms.

Andres Freund

11 years agoFix assertion failure for REFRESH MATERIALIZED VIEW in PL.
Kevin Grittner [Wed, 24 Apr 2013 13:39:06 +0000 (08:39 -0500)]
Fix assertion failure for REFRESH MATERIALIZED VIEW in PL.

This was due to incomplete implementation of rowcount reporting
for RMV, which was due to initial waffling on whether it should
be provided.  It seems unlikely to be a useful or universally
available  number as more sophisticated techniques for maintaining
matviews are added, so remove the partial support rather than
completing it.

Per report of Jeevan Chalke, but with a different fix

11 years agoMake fast promotion the default promotion mode.
Simon Riggs [Wed, 24 Apr 2013 11:21:18 +0000 (12:21 +0100)]
Make fast promotion the default promotion mode.
Continue to allow a request for synchronous
checkpoints as a mechanism in case of problems.

11 years ago9.3 release notes: adjustments per Alvaro
Bruce Momjian [Wed, 24 Apr 2013 03:21:09 +0000 (23:21 -0400)]
9.3 release notes:  adjustments per Alvaro

11 years ago9.3 release note updates from Dean Rasheed, Jov, Heikki Linnakangas,
Bruce Momjian [Tue, 23 Apr 2013 21:06:17 +0000 (17:06 -0400)]
9.3 release note updates from Dean Rasheed, Jov, Heikki Linnakangas,
Erikjan Rijkers

11 years agoRemove prototype for cube(text) function that doesn't exist anymore.
Heikki Linnakangas [Tue, 23 Apr 2013 10:48:14 +0000 (13:48 +0300)]
Remove prototype for cube(text) function that doesn't exist anymore.

Adrian Schreyer

11 years ago9.3 release notes: add diacritics
Bruce Momjian [Mon, 22 Apr 2013 21:17:00 +0000 (17:17 -0400)]
9.3 release notes: add diacritics

Alvaro Herrera

11 years ago9.3 release notes: adjustments per Alvaro and Robert
Bruce Momjian [Mon, 22 Apr 2013 20:05:06 +0000 (16:05 -0400)]
9.3 release notes:  adjustments per Alvaro and Robert

11 years agoMention in docs that you can create SP-GiST indexes on range types.
Heikki Linnakangas [Mon, 22 Apr 2013 18:51:14 +0000 (21:51 +0300)]
Mention in docs that you can create SP-GiST indexes on range types.

This is new in 9.3devel.

11 years ago9.3 release notes: apply fixes suggested by Alvaro
Bruce Momjian [Mon, 22 Apr 2013 18:33:28 +0000 (14:33 -0400)]
9.3 release notes:  apply fixes suggested by Alvaro

11 years ago9.3 release notes: update streaming replication speedups
Bruce Momjian [Mon, 22 Apr 2013 14:22:43 +0000 (10:22 -0400)]
9.3 release notes:  update streaming replication speedups

Andres Freund

11 years agodoc: Improve example formatting
Peter Eisentraut [Mon, 22 Apr 2013 02:21:29 +0000 (22:21 -0400)]
doc: Improve example formatting

Erwin Brandstetter

11 years agodoc: Fix syntax in example
Peter Eisentraut [Mon, 22 Apr 2013 02:16:12 +0000 (22:16 -0400)]
doc: Fix syntax in example

LANGUAGE 'plpgsql' no longer works.  The single quotes need to be
removed.

Erwin Brandstetter

11 years agoIn 9.3 release notes, split up items
Bruce Momjian [Mon, 22 Apr 2013 01:05:31 +0000 (21:05 -0400)]
In 9.3 release notes, split up items

Split log shipping speed improvement and fail-over speed improvement items.

Per request from Simon

11 years ago9.3 release note adjustments per request from Andres Freund
Bruce Momjian [Sun, 21 Apr 2013 14:08:58 +0000 (10:08 -0400)]
9.3 release note adjustments per request from Andres Freund

11 years agoRemove 9.3 item about fixing DROP INDEX CONCURRENTLY
Bruce Momjian [Sun, 21 Apr 2013 13:16:23 +0000 (09:16 -0400)]
Remove 9.3 item about fixing DROP INDEX CONCURRENTLY

Already fixed in back branch.

11 years ago9.3 release note fixes
Bruce Momjian [Sun, 21 Apr 2013 13:14:34 +0000 (09:14 -0400)]
9.3 release note fixes

Move commit_delay, fix Zoltan's name, and adjust range type histogram
text.

11 years agoAdjust 9.3 release notes per request from Simon
Bruce Momjian [Sun, 21 Apr 2013 13:05:16 +0000 (09:05 -0400)]
Adjust 9.3 release notes per request from Simon

11 years agoReorder 9.3 release note items
Bruce Momjian [Sun, 21 Apr 2013 04:57:18 +0000 (00:57 -0400)]
Reorder 9.3 release note items

Typo fix from David Fetter.

11 years agoMore 9.3 release note reorderings
Bruce Momjian [Sat, 20 Apr 2013 21:31:06 +0000 (17:31 -0400)]
More 9.3 release note reorderings

11 years agoFix Gilles Darold's name in 9.3 release notes.
Bruce Momjian [Sat, 20 Apr 2013 21:09:10 +0000 (17:09 -0400)]
Fix Gilles Darold's name in 9.3 release notes.

11 years agoFix longstanding race condition in plancache.c.
Tom Lane [Sat, 20 Apr 2013 20:59:21 +0000 (16:59 -0400)]
Fix longstanding race condition in plancache.c.

When creating or manipulating a cached plan for a transaction control
command (particularly ROLLBACK), we must not perform any catalog accesses,
since we might be in an aborted transaction.  However, plancache.c busily
saved or examined the search_path for every cached plan.  If we were
unlucky enough to do this at a moment where the path's expansion into
schema OIDs wasn't already cached, we'd do some catalog accesses; and with
some more bad luck such as an ill-timed signal arrival, that could lead to
crashes or Assert failures, as exhibited in bug #8095 from Nachiket Vaidya.
Fortunately, there's no real need to consider the search path for such
commands, so we can just skip the relevant steps when the subject statement
is a TransactionStmt.  This is somewhat related to bug #5269, though the
failure happens during initial cached-plan creation rather than
revalidation.

This bug has been there since the plan cache was invented, so back-patch
to all supported branches.

11 years agoReorder some 9.3 release item entries
Bruce Momjian [Sat, 20 Apr 2013 20:50:56 +0000 (16:50 -0400)]
Reorder some 9.3 release item entries

More to go.

11 years agoPush 9.3 release SGML file
Bruce Momjian [Sat, 20 Apr 2013 20:32:32 +0000 (16:32 -0400)]
Push 9.3 release SGML file

Forgotten in previous commit.

11 years agoPublish draft 9.3 release notes
Bruce Momjian [Sat, 20 Apr 2013 20:29:58 +0000 (16:29 -0400)]
Publish draft 9.3 release notes

No links added yet.

11 years agodoc: Mention SATA alongside IDE for Linux
Peter Eisentraut [Sat, 20 Apr 2013 19:56:22 +0000 (15:56 -0400)]
doc: Mention SATA alongside IDE for Linux

suggested by Jov

11 years agoClean up references to SQL92
Peter Eisentraut [Sat, 20 Apr 2013 15:04:41 +0000 (11:04 -0400)]
Clean up references to SQL92

In most cases, these were just references to the SQL standard in
general.  In a few cases, a contrast was made between SQL92 and later
standards -- those have been kept unchanged.

11 years agoImprove error message when an FDW doesn't support WHERE CURRENT OF.
Tom Lane [Fri, 19 Apr 2013 20:14:56 +0000 (16:14 -0400)]
Improve error message when an FDW doesn't support WHERE CURRENT OF.

If an FDW fails to take special measures with a CurrentOfExpr, we will
end up trying to execute it as an ordinary qual, which was being treated
as a purely internal failure condition.  Provide a more user-oriented
error message for such cases.

11 years agoDon't try to pass -I switch to postmaster in contrib/start-scripts/linux.
Tom Lane [Fri, 19 Apr 2013 17:28:45 +0000 (13:28 -0400)]
Don't try to pass -I switch to postmaster in contrib/start-scripts/linux.

Undo thinko in commit 87306184580c9c49717b00d48a2f9e717f21e0a8.
Per bug #8098 from Catherine Devlin.

11 years agoFix typo in comment.
Robert Haas [Fri, 19 Apr 2013 13:32:49 +0000 (09:32 -0400)]
Fix typo in comment.

Fabrízio de Royes Mello

11 years agoStandardize spelling of "nonblocking"
Peter Eisentraut [Fri, 19 Apr 2013 03:35:19 +0000 (23:35 -0400)]
Standardize spelling of "nonblocking"

Only adjusted the user-exposed messages and documentation,  not all
source code comments.

11 years agopg_upgrade: Add checksum C comment
Bruce Momjian [Wed, 17 Apr 2013 21:39:14 +0000 (17:39 -0400)]
pg_upgrade:  Add checksum C comment

We might eventually allow checksum to no-checksum upgrades.

11 years agosepgsql: Minor improvement to test script, doc fix.
Robert Haas [Wed, 17 Apr 2013 13:55:24 +0000 (09:55 -0400)]
sepgsql: Minor improvement to test script, doc fix.

KaiGai Kohei

11 years agosepgsql: One more getObjectIdentity in lieu of getObjectDescription.
Robert Haas [Wed, 17 Apr 2013 13:52:25 +0000 (09:52 -0400)]
sepgsql: One more getObjectIdentity in lieu of getObjectDescription.

KaiGai Kohei, based on a suggestion from Álvaro Herrera

11 years agodoc: Update PQgetssl() documentation
Peter Eisentraut [Wed, 17 Apr 2013 01:42:10 +0000 (21:42 -0400)]
doc: Update PQgetssl() documentation

The return type of PQgetssl() was changed from SSL* to void* a long time
ago, but the documentation was not updated.

11 years agopgindent: add newline to die() so script line number is not reported on failure.
Bruce Momjian [Tue, 16 Apr 2013 14:30:31 +0000 (10:30 -0400)]
pgindent:  add newline to die() so script line number is not reported on failure.

11 years agoRemove some unused and seldom used fields from RelationAmInfo.
Heikki Linnakangas [Tue, 16 Apr 2013 12:01:21 +0000 (15:01 +0300)]
Remove some unused and seldom used fields from RelationAmInfo.

This saves some memory from each index relcache entry. At least on a 64-bit
machine, it saves just enough to shrink a typical relcache entry's memory
usage from 2k to 1k. That's nice if you have a lot of backends and a lot of
indexes.

11 years agoFix function return type confusion
Peter Eisentraut [Tue, 16 Apr 2013 02:33:24 +0000 (22:33 -0400)]
Fix function return type confusion

When parse_hba_line's return type was changed from bool to a pointer,
the MANDATORY_AUTH_ARG macro wasn't adjusted.

11 years agoMark json IO and extraction functions immutable.
Andrew Dunstan [Tue, 16 Apr 2013 01:46:25 +0000 (21:46 -0400)]
Mark json IO and extraction functions immutable.

Per complaint from Hubert Depesz Lubaczewski.

Catalog version bumped.

11 years agoCorrect handling of NULL arguments in json funcs.
Andrew Dunstan [Mon, 15 Apr 2013 20:20:21 +0000 (16:20 -0400)]
Correct handling of NULL arguments in json funcs.

Per gripe from Tom Lane.

11 years agoImprove GiST index search performance for trigram regex queries.
Tom Lane [Mon, 15 Apr 2013 16:49:29 +0000 (12:49 -0400)]
Improve GiST index search performance for trigram regex queries.

The initial coding just descended the index if any of the target trigrams
were possibly present at the next level down.  But actually we can apply
trigramsMatchGraph() so as to take advantage of AND requirements when there
are some.  The input data might contain false positive matches, but that
can only result in a false positive result, not false negative, so it's
safe to do it this way.

Alexander Korotkov

11 years agoAdd serial comma
Peter Eisentraut [Sun, 14 Apr 2013 15:12:30 +0000 (11:12 -0400)]
Add serial comma

11 years agopg_ctl: Add idempotent option
Peter Eisentraut [Sun, 14 Apr 2013 03:42:42 +0000 (23:42 -0400)]
pg_ctl: Add idempotent option

This changes the behavior of the start and stop actions to exit
successfully if the server was already started or stopped.

This changes the default behavior of the start action:  Before, if the
server was already running, it would print a message and succeed.  Now,
that situation will result in an error.  When running in idempotent
mode, no message is printed and pg_ctl exits successfully.

It was considered to just make the idempotent behavior the default and
only option, but pg_upgrade needs the old behavior.

11 years agoFix sporadic rebuilds for .pc files
Peter Eisentraut [Sat, 13 Apr 2013 02:45:51 +0000 (22:45 -0400)]
Fix sporadic rebuilds for .pc files

The build of .pc (pkg-config) files depends on all makefiles in use, and
in dependency tracking mode, the previous coding ended up including
/dev/null as a makefile.  Apparently, on some platforms the modification
time of /dev/null changes sporadically, and so the .pc files would end
up being rebuilt every so often.  Fix that by changing the makefile code
to do without using /dev/null.

11 years agoClean up the mess around EXPLAIN and materialized views.
Tom Lane [Fri, 12 Apr 2013 23:25:20 +0000 (19:25 -0400)]
Clean up the mess around EXPLAIN and materialized views.

Revert the matview-related changes in explain.c's API, as per recent
complaint from Robert Haas.  The reason for these appears to have been
principally some ill-considered choices around having intorel_startup do
what ought to be parse-time checking, plus a poor arrangement for passing
it the view parsetree it needs to store into pg_rewrite when creating a
materialized view.  Do the latter by having parse analysis stick a copy
into the IntoClause, instead of doing it at runtime.  (On the whole,
I seriously question the choice to represent CREATE MATERIALIZED VIEW as a
variant of SELECT INTO/CREATE TABLE AS, because that means injecting even
more complexity into what was already a horrid legacy kluge.  However,
I didn't go so far as to rethink that choice ... yet.)

I also moved several error checks into matview parse analysis, and
made the check for external Params in a matview more accurate.

In passing, clean things up a bit more around interpretOidsOption(),
and fix things so that we can use that to force no-oids for views,
sequences, etc, thereby eliminating the need to cons up "oids = false"
options when creating them.

catversion bump due to change in IntoClause.  (I wonder though if we
really need readfuncs/outfuncs support for IntoClause anymore.)

11 years agopgindent: improve error messages
Bruce Momjian [Fri, 12 Apr 2013 19:25:33 +0000 (15:25 -0400)]
pgindent: improve error messages

per suggestion from Gurjeet Singh

11 years agopgindent: fix downloading of BSD indent binary
Bruce Momjian [Fri, 12 Apr 2013 15:42:27 +0000 (11:42 -0400)]
pgindent:  fix downloading of BSD indent binary

Also fix accessing pgentab binary and tar.

Gurjeet Singh

11 years agosepgsql: Enforce db_procedure:{execute} permission.
Robert Haas [Fri, 12 Apr 2013 12:55:56 +0000 (08:55 -0400)]
sepgsql: Enforce db_procedure:{execute} permission.

To do this, we add an additional object access hook type,
OAT_FUNCTION_EXECUTE.

KaiGai Kohei

11 years agoMinor wording corrections for object-access hook stuff.
Robert Haas [Fri, 12 Apr 2013 12:39:38 +0000 (08:39 -0400)]
Minor wording corrections for object-access hook stuff.

KaiGai Kohei

11 years agosepgql: Use getObjectIdentity rather than getObjectDescription.
Robert Haas [Fri, 12 Apr 2013 12:35:55 +0000 (08:35 -0400)]
sepgql: Use getObjectIdentity rather than getObjectDescription.

KaiGai Kohei, based on a suggestion from Álvaro Herrera

11 years agoDocument that git_changelog needs updating for major version stamping.
Bruce Momjian [Thu, 11 Apr 2013 16:27:02 +0000 (12:27 -0400)]
Document that git_changelog needs updating for major version stamping.

11 years agoRemove quotes around SQL statement in error message
Alvaro Herrera [Thu, 11 Apr 2013 15:00:09 +0000 (12:00 -0300)]
Remove quotes around SQL statement in error message

11 years agoFix confusion between ObjectType and ObjectClass
Alvaro Herrera [Thu, 11 Apr 2013 14:59:47 +0000 (11:59 -0300)]
Fix confusion between ObjectType and ObjectClass

Per report by Will Leinweber and Peter Eisentraut

11 years agodoc: Update DTrace information
Peter Eisentraut [Thu, 11 Apr 2013 03:05:13 +0000 (23:05 -0400)]
doc: Update DTrace information

The old web site link no longer worked, and some information was
outdated.

11 years agoUpdate the description for the graphical installers
Magnus Hagander [Wed, 10 Apr 2013 19:37:49 +0000 (21:37 +0200)]
Update the description for the graphical installers

Remove references to "one click", as we're not supposed to call
them that anymore.

11 years agoFix SIGUSR1 handling by unconnected bgworkers
Alvaro Herrera [Wed, 10 Apr 2013 19:01:16 +0000 (16:01 -0300)]
Fix SIGUSR1 handling by unconnected bgworkers

Latch activity was not being detected by non-database-connected workers; the
SIGUSR1 signal handler which is normally in charge of that was set to SIG_IGN.
Create a simple handler to call latch_sigusr1_handler instead.

Robert Haas (bug report and suggested fix)

11 years agoFix SIGHUP handling by unconnected bgworkers
Alvaro Herrera [Wed, 10 Apr 2013 18:59:45 +0000 (15:59 -0300)]
Fix SIGHUP handling by unconnected bgworkers

Add a SignalUnconnectedWorkers() call so that non-database-connected background
workers are also notified when postmaster is SIGHUPped.  Previously, only
database-connected workers were.

Michael Paquier (bug report and fix)

11 years agoMake contrib/pg_trgm also support regex searches with GiST indexes.
Tom Lane [Wed, 10 Apr 2013 17:30:14 +0000 (13:30 -0400)]
Make contrib/pg_trgm also support regex searches with GiST indexes.

This wasn't addressed in the original patch, but it doesn't take very
much additional code to cover the case, so let's get it done.

Since pg_trgm 1.1 hasn't been released yet, I just changed the definition
of what's in it, rather than inventing a 1.2.

11 years agoMake worker_spi sample code more complete
Alvaro Herrera [Wed, 10 Apr 2013 16:29:25 +0000 (13:29 -0300)]
Make worker_spi sample code more complete

Make use of some GUC variables, and add SIGHUP handling to reload
the config file.  Patch submitted by Guillaume Lelarge.

Also, report to pg_stat_activity.  Per report from Marc Cousin, add
setting of statement start time.

11 years agoFix hstore_to_json_loose example in docs.
Andrew Dunstan [Wed, 10 Apr 2013 13:26:46 +0000 (09:26 -0400)]
Fix hstore_to_json_loose example in docs.

Marti Raudsepp.

11 years agoRemove duplicate initialization in XLogReadRecord.
Robert Haas [Wed, 10 Apr 2013 03:58:02 +0000 (23:58 -0400)]
Remove duplicate initialization in XLogReadRecord.

Per a note from Dickson S. Guedes.

11 years agoCreate a distinction between a populated matview and a scannable one.
Kevin Grittner [Tue, 9 Apr 2013 18:02:49 +0000 (13:02 -0500)]
Create a distinction between a populated matview and a scannable one.

The intent was that being populated would, long term, be just one
of the conditions which could affect whether a matview was
scannable; being populated should be necessary but not always
sufficient to scan the relation.  Since only CREATE and REFRESH
currently determine the scannability, names and comments
accidentally conflated these concepts, leading to confusion.

Also add missing locking for the SQL function which allows a
test for scannability, and fix a modularity violatiion.

Per complaints from Tom Lane, although its not clear that these
will satisfy his concerns.  Hopefully this will at least better
frame the discussion.

11 years agoAdjust ExplainOneQuery_hook_type to take a DestReceiver argument.
Robert Haas [Tue, 9 Apr 2013 14:13:38 +0000 (10:13 -0400)]
Adjust ExplainOneQuery_hook_type to take a DestReceiver argument.

The materialized views patch adjusted ExplainOneQuery to take an
additional DestReceiver argument, but failed to add a matching
argument to the definition of ExplainOneQuery_hook.  This is a
problem for users of the hook that want to call ExplainOnePlan.
Fix by adding the missing argument.

11 years agoSupport indexing of regular-expression searches in contrib/pg_trgm.
Tom Lane [Tue, 9 Apr 2013 05:05:55 +0000 (01:05 -0400)]
Support indexing of regular-expression searches in contrib/pg_trgm.

This works by extracting trigrams from the given regular expression,
in generally the same spirit as the previously-existing support for
LIKE searches, though of course the details are far more complicated.

Currently, only GIN indexes are supported.  We might be able to make
it work with GiST indexes later.

The implementation includes adding API functions to backend/regex/
to provide a view of the search NFA created from a regular expression.
These functions are meant to be generic enough to be supportable in
a standalone version of the regex library, should that ever happen.

Alexander Korotkov, reviewed by Heikki Linnakangas and Tom Lane

11 years agoMinor rewording of README comments
Simon Riggs [Mon, 8 Apr 2013 16:20:26 +0000 (17:20 +0100)]
Minor rewording of README comments

11 years agoFix calculation of how many segments to retain for wal_keep_segments.
Heikki Linnakangas [Mon, 8 Apr 2013 13:26:52 +0000 (16:26 +0300)]
Fix calculation of how many segments to retain for wal_keep_segments.

KeepLogSeg function was broken when we switched to use a 64-bit int for the
segment number.

Per report from Jeff Janes.

11 years agoSkip extraneous locking in XLogCheckBuffer().
Simon Riggs [Mon, 8 Apr 2013 08:11:49 +0000 (09:11 +0100)]
Skip extraneous locking in XLogCheckBuffer().
Heikki reported comment was wrong, so fixed
code to match the comment: we only need to
take additional locking precautions when we
have a shared lock on the buffer.

11 years agoAvoid tricky race condition recording XLOG_HINT
Simon Riggs [Mon, 8 Apr 2013 07:52:39 +0000 (08:52 +0100)]
Avoid tricky race condition recording XLOG_HINT
We copy the buffer before inserting an XLOG_HINT to avoid WAL CRC errors
caused by concurrent hint writes to buffer while share locked. To make this work
we refactor RestoreBackupBlock() to allow an XLOG_HINT to avoid the normal
path for backup blocks, which assumes the underlying buffer is exclusive locked.
Resulting code completely changes layout of XLOG_HINT WAL records, but
this isn't even beta code, so this is a low impact change.
In passing, avoid taking WALInsertLock for full page writes on checksummed
hints, remove related cruft from XLogInsert() and improve xlog_desc record for
XLOG_HINT.

Andres Freund

Bug report by Fujii Masao, testing by Jeff Janes and Jaime Casanova,
review by Jeff Davis and Simon Riggs. Applied with changes from review
and some comment editing.

11 years agoREADME comments on checksums on page holes.
Simon Riggs [Mon, 8 Apr 2013 07:42:52 +0000 (08:42 +0100)]
README comments on checksums on page holes.

11 years agoTune BufferGetLSNAtomic() when checksums !enabled
Simon Riggs [Sun, 7 Apr 2013 21:37:39 +0000 (22:37 +0100)]
Tune BufferGetLSNAtomic() when checksums !enabled

From performance analysis by Heikki Linnakangas

11 years agoFix checksums for CLUSTER, VACUUM FULL etc.
Simon Riggs [Sun, 7 Apr 2013 21:16:51 +0000 (22:16 +0100)]
Fix checksums for CLUSTER, VACUUM FULL etc.
In CLUSTER, VACUUM FULL and ALTER TABLE SET TABLESPACE
I erroneously set checksum before log_newpage, which
sets the LSN and invalidates the checksum. So set
checksum immediately *after* log_newpage.

Bug report Fujii Masao, Fix and patch by Jeff Davis

11 years agoGet rid of USE_WIDE_UPPER_LOWER dependency in trigram construction.
Tom Lane [Sun, 7 Apr 2013 18:45:33 +0000 (14:45 -0400)]
Get rid of USE_WIDE_UPPER_LOWER dependency in trigram construction.

contrib/pg_trgm's make_trigrams() was coded to ignore multibyte character
boundaries and just make trigrams from bytes if USE_WIDE_UPPER_LOWER wasn't
defined.  This is a bit odd, since there's no obvious reason why trigram
compaction rules should depend on the presence of towlower() and friends.
What's more, there was an Assert() that would fail if that code path was
fed any multibyte characters.

We need to do something about this since the pending regex-indexing patch
has an assumption that you get just one "trgm" from any three characters.
The best solution seems to be to remove the USE_WIDE_UPPER_LOWER
dependency, which shouldn't really have been there in the first place.
The second loop in make_trigrams() is now just a fast path and not a
potentially incompatible algorithm.

If there is anybody still using Postgres on machines without wcstombs() or
towlower(), and they have non-ASCII data indexed by pg_trgm, they'll need
to REINDEX those indexes after pg_upgrade to 9.3, else searches may fail
incorrectly. It seems likely that there are no such installations, though.

In passing, rename cnt_trigram to compact_trigram, which seems to better
describe its functionality, and improve make_trigrams' test for whether it
has to use the slow path or not (per a suggestion from Alexander Korotkov).

11 years agoIn isolationtester, retry after EINTR return from select(2).
Tom Lane [Sun, 7 Apr 2013 02:28:49 +0000 (22:28 -0400)]
In isolationtester, retry after EINTR return from select(2).

Per report from Jaime Casanova.  Very curious that no one else has seen
this failure ... but the code is clearly wrong as-is.

11 years agosepgsql: Enforce db_schema:search permission.
Robert Haas [Fri, 5 Apr 2013 12:51:31 +0000 (08:51 -0400)]
sepgsql: Enforce db_schema:search permission.

KaiGai Kohei, with comment and doc wordsmithing by me

11 years agoImprove documentation about the relationship of extensions and schemas.
Tom Lane [Fri, 5 Apr 2013 02:37:25 +0000 (22:37 -0400)]
Improve documentation about the relationship of extensions and schemas.

There's been some confusion expressed about this point, so clarify.
Extended version of a patch by David Wheeler.

11 years agodoc: Fix number of columns in table
Peter Eisentraut [Fri, 5 Apr 2013 01:07:05 +0000 (21:07 -0400)]
doc: Fix number of columns in table

11 years agoFix line count in slashUsage().
Tom Lane [Fri, 5 Apr 2013 00:29:46 +0000 (20:29 -0400)]
Fix line count in slashUsage().

Counting newlines shows that quite a few recent patches have neglected
to update the output-lines count given to PageOutput().  Fortunately
it's not terribly critical that this be exact, since we long since
exceeded the height of most people's terminal windows.  Still, maybe
we ought to think of a way to not have to maintain this manually anymore.

11 years agoAdd \watch [SEC] command to psql.
Tom Lane [Thu, 4 Apr 2013 23:56:33 +0000 (19:56 -0400)]
Add \watch [SEC] command to psql.

This allows convenient re-execution of commands.

Will Leinweber, reviewed by Peter Eisentraut, Daniel Farina, and Tom Lane

11 years agoFix off by one error in JSON extract path code.
Andrew Dunstan [Thu, 4 Apr 2013 22:26:52 +0000 (18:26 -0400)]
Fix off by one error in JSON extract path code.

Bug report by David Wheeler, diagnosis assistance from Tom Lane.

11 years agopsql: fix startup crash caused by PSQLRC containing a tilde
Bruce Momjian [Thu, 4 Apr 2013 16:56:21 +0000 (12:56 -0400)]
psql:  fix startup crash caused by PSQLRC containing a tilde

'strdup' the PSQLRC environment variable value before calling a routine
that might free() it.

Backpatch to 9.2, where the bug first appeared.

11 years agoFix crash on compiling a regular expression with more than 32k colors.
Heikki Linnakangas [Thu, 4 Apr 2013 16:04:57 +0000 (19:04 +0300)]
Fix crash on compiling a regular expression with more than 32k colors.

Throw an error instead.

Backpatch to all supported branches.

11 years agoFix a few thinkos in the JSON functions docs.
Andrew Dunstan [Thu, 4 Apr 2013 14:41:29 +0000 (10:41 -0400)]
Fix a few thinkos in the JSON functions docs.

Dickson S. Guedes

11 years agoCalculate # of semaphores correctly with --disable-spinlocks.
Heikki Linnakangas [Thu, 4 Apr 2013 13:31:44 +0000 (16:31 +0300)]
Calculate # of semaphores correctly with --disable-spinlocks.

The old formula didn't take into account that each WAL sender process needs
a spinlock. We had also already exceeded the fixed number of spinlocks
reserved for misc purposes (10). Bump that to 30.

Backpatch to 9.0, where WAL senders were introduced. If I counted correctly,
9.0 had exactly 10 predefined spinlocks, and 9.1 exceeded that, but bump the
limit in 9.0 too because 10 is uncomfortably close to the edge.

11 years agoAvoid updating our PgBackendStatus entry when track_activities is off.
Tom Lane [Wed, 3 Apr 2013 18:13:28 +0000 (14:13 -0400)]
Avoid updating our PgBackendStatus entry when track_activities is off.

The point of turning off track_activities is to avoid this reporting
overhead, but a thinko in commit 4f42b546fd87a80be30c53a0f2c897acb826ad52
caused pgstat_report_activity() to perform half of its updates anyway.
Fix that, and also make sure that we clear all the now-disabled fields
when transitioning to the non-reporting state.

11 years agoFix typo in FDW docs.
Tom Lane [Wed, 3 Apr 2013 14:26:18 +0000 (10:26 -0400)]
Fix typo in FDW docs.

Laurenz Albe

11 years agoMinor robustness improvements for isolationtester.
Tom Lane [Wed, 3 Apr 2013 01:15:37 +0000 (21:15 -0400)]
Minor robustness improvements for isolationtester.

Notice and complain about PQcancel() failures.  Also, don't dump core if
an error PGresult doesn't contain severity and message subfields, as it
might not if it was generated by libpq itself.  (We have a longstanding
TODO item to improve that, but in the meantime isolationtester had better
cope.)

I tripped across the latter item while investigating a trouble report on
buildfarm member spoonbill.  As for the former, there's no evidence that
PQcancel failure is actually involved in spoonbill's problem, but it still
seems like a bad idea to ignore an error return code.

11 years agoUpdate release notes for 9.2.4, 9.1.9, 9.0.13, 8.4.17.
Tom Lane [Mon, 1 Apr 2013 18:11:11 +0000 (14:11 -0400)]
Update release notes for 9.2.4, 9.1.9, 9.0.13, 8.4.17.

Security: CVE-2013-1899, CVE-2013-1901

11 years agoFix insecure parsing of server command-line switches.
Tom Lane [Mon, 1 Apr 2013 18:00:51 +0000 (14:00 -0400)]
Fix insecure parsing of server command-line switches.

An oversight in commit e710b65c1c56ca7b91f662c63d37ff2e72862a94 allowed
database names beginning with "-" to be treated as though they were secure
command-line switches; and this switch processing occurs before client
authentication, so that even an unprivileged remote attacker could exploit
the bug, needing only connectivity to the postmaster's port.  Assorted
exploits for this are possible, some requiring a valid database login,
some not.  The worst known problem is that the "-r" switch can be invoked
to redirect the process's stderr output, so that subsequent error messages
will be appended to any file the server can write.  This can for example be
used to corrupt the server's configuration files, so that it will fail when
next restarted.  Complete destruction of database tables is also possible.

Fix by keeping the database name extracted from a startup packet fully
separate from command-line switches, as had already been done with the
user name field.

The Postgres project thanks Mitsumasa Kondo for discovering this bug,
Kyotaro Horiguchi for drafting the fix, and Noah Misch for recognizing
the full extent of the danger.

Security: CVE-2013-1899

11 years agoMake REPLICATION privilege checks test current user not authenticated user.
Tom Lane [Mon, 1 Apr 2013 17:09:24 +0000 (13:09 -0400)]
Make REPLICATION privilege checks test current user not authenticated user.

The pg_start_backup() and pg_stop_backup() functions checked the privileges
of the initially-authenticated user rather than the current user, which is
wrong.  For example, a user-defined index function could successfully call
these functions when executed by ANALYZE within autovacuum.  This could
allow an attacker with valid but low-privilege database access to interfere
with creation of routine backups.  Reported and fixed by Noah Misch.

Security: CVE-2013-1901

11 years agoRevert "ecpg: Don't link compatlib with libpq"
Peter Eisentraut [Mon, 1 Apr 2013 03:50:51 +0000 (23:50 -0400)]
Revert "ecpg: Don't link compatlib with libpq"

This reverts commit 3780fc679cc428c1f211e1728c4281ca15e9746b.

HP-UX didn't like it.  There would probably be a way to fix that, but
since the net effect of all of this is zero because ecpg ends up using
libpq anyway, it's not worth bothering further.

11 years agoUpdate release notes for changes through today.
Tom Lane [Sun, 31 Mar 2013 22:59:35 +0000 (18:59 -0400)]
Update release notes for changes through today.

11 years agoIgnore extra subquery outputs in set_subquery_size_estimates().
Tom Lane [Sun, 31 Mar 2013 22:32:54 +0000 (18:32 -0400)]
Ignore extra subquery outputs in set_subquery_size_estimates().

In commit 0f61d4dd1b4f95832dcd81c9688dac56fd6b5687, I added code to copy up
column width estimates for each column of a subquery.  That code supposed
that the subquery couldn't have any output columns that didn't correspond
to known columns of the current query level --- which is true when a query
is parsed from scratch, but the assumption fails when planning a view that
depends on another view that's been redefined (adding output columns) since
the upper view was made.  This results in an assertion failure or even a
crash, as per bug #8025 from lindebg.  Remove the Assert and instead skip
the column if its resno is out of the expected range.

11 years agoAdd pkg-config files for libpq and ecpg libraries
Peter Eisentraut [Sun, 31 Mar 2013 20:58:40 +0000 (16:58 -0400)]
Add pkg-config files for libpq and ecpg libraries

This will hopefully be easier to use than pg_config for users who are
already used to the pkg-config interface.  It also works better for
multi-arch installations.

reviewed by Tom Lane

11 years agoecpg: Don't link compatlib with libpq
Peter Eisentraut [Sun, 31 Mar 2013 20:51:00 +0000 (16:51 -0400)]
ecpg: Don't link compatlib with libpq

It doesn't actually use libpq.  But we need to keep libpq in the
CPPFLAGS for building, because compatlib uses ecpglib.h which uses
libpq-fe.h, but we don't need to refer to libpq for linking.

reviewed by Tom Lane

11 years agopg_upgrade: don't copy/link files for invalid indexes
Bruce Momjian [Sun, 31 Mar 2013 02:20:53 +0000 (22:20 -0400)]
pg_upgrade:  don't copy/link files for invalid indexes

Now that pg_dump no longer dumps invalid indexes, per commit
683abc73dff549e94555d4020dae8d02f32ed78b, have pg_upgrade also skip
them.  Previously pg_upgrade threw an error if invalid indexes existed.

Backpatch to 9.2, 9.1, and 9.0 (where pg_upgrade was added to git)

11 years agoImprove code documentation about "magnetic disk" storage manager.
Tom Lane [Sat, 30 Mar 2013 18:23:45 +0000 (14:23 -0400)]
Improve code documentation about "magnetic disk" storage manager.

The modern incarnation of md.c is by no means specific to magnetic disk
technology, but every so often we hear from someone who's misled by the
label.  Try to clarify that it will work for anything that supports
standard filesystem operations.  Per suggestion from Andrew Dunstan.