Commit Graph

32184 Commits

Author SHA1 Message Date
Peter Eisentraut
7ce4abf599 Improve detection of Python 3.2 installations
Because of ABI tagging, the library version number might no longer be
exactly the Python version number, so do extra lookups.  This affects
installations without a shared library, such as ActiveState's
installer.

Also update the way to detect the location of the 'config' directory,
which can also be versioned.

Ashesh Vashi
2011-08-18 14:47:03 +03:00
Peter Eisentraut
7b1509d562 Change PyInit_plpy to external linkage
Module initialization functions in Python 3 must have external
linkage, because PyMODINIT_FUNC does dllexport on Windows-like
platforms.  Without this change, the build with Python 3 fails on
Windows.
2011-08-18 13:41:56 +03:00
Tom Lane
f85e4057cf Update 9.1 release notes to reflect commits through today.
Also do another pass of copy-editing.
2011-08-17 20:18:23 -04:00
Tom Lane
f26474eff4 Fix two issues in plpython's handling of composite results.
Dropped columns within a composite type were not handled correctly.
Also, we did not check for whether a composite result type had changed
since we cached the information about it.

Jan Urbański, per a bug report from Jean-Baptiste Quenot
2011-08-17 17:07:25 -04:00
Andrew Dunstan
22a55b3af6 Properly handle empty arrays returned from plperl functions.
Bug reported by David Wheeler, fix by Alex Hunsaker.
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	modified:   src/pl/plperl/plperl.c
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	autom4te.cache/
#	configure.in~
#	doc/src/sgml/ref/grant.sgml~
#	src/backend/port/win32_latch.c~
#	src/bin/psql/command.c~
#	src/include/pg_config.h.win32~
#	src/pl/plpython/plpython.c~
#	src/tools/msvc/pgbison.bat~
#	src/tools/msvc/pgbison.pl.bak
#	src/tools/msvc/pgflex.bat~
#	src/tools/msvc/pgflex.pl.bak
#	src/tools/pgindent/README~
#	src/tools/pgindent/pgindent.pl
#	src/tools/pgindent/pgindent.pl~
#	xxxxx
#	yyyyyy
2011-08-17 12:03:26 -04:00
Peter Eisentraut
dfee7d16ad Translation updates 2011-08-17 14:02:49 +03:00
Magnus Hagander
aee1df4de5 Adjust wording now that estimated size can increase
Per comment form Fujii Masao.
2011-08-17 11:01:50 +02:00
Heikki Linnakangas
59dd4790e2 If backup-end record is not seen, and we reach end of recovery from a
streamed backup, throw an error and refuse to start up. The restore has not
finished correctly in that case and the data directory is possibly corrupt.
We already errored out in case of archive recovery, but could not during
crash recovery because we couldn't distinguish between the case that
pg_start_backup() was called and the database then crashed (must not error,
data is OK), and the case that we're restoring from a backup and not all
the needed WAL was replayed (data can be corrupt).

To distinguish those cases, add a line to backup_label to indicate
whether the backup was taken with pg_start/stop_backup(), or by streaming
(ie. pg_basebackup).

This is a different implementation than what I committed to 9.2 a week ago.
That implementation was not back-patchable because it required re-initdb.

Fujii Masao
2011-08-17 11:41:29 +03:00
Peter Eisentraut
9dcaf9a052 Move \r out of translatable strings
The translation tools are very unhappy about seeing \r in translatable
strings, so move it to a separate fprintf call.
2011-08-17 10:55:22 +03:00
Peter Eisentraut
1361a47359 MacOS -> Mac OS
Josh Kupershmidt
2011-08-17 10:05:55 +03:00
Tom Lane
1713bbca7d Forget about targeting catalog cache invalidations by tuple TID.
The TID isn't stable enough: we might queue an sinval event before a VACUUM
FULL, and then process it afterwards, when the target tuple no longer has
the same TID.  So we must invalidate entries on the basis of hash value
only.  The old coding can be shown to result in various bizarre,
hard-to-reproduce errors in the presence of concurrent VACUUM FULLs on
system catalogs, and could easily result in permanent catalog corruption,
up to and including complete loss of tables.

This commit is just a minimal fix that removes the unsafe comparison.
We should remove transmission of the tuple TID from sinval messages
altogether, and then arrange to suppress the extra message in the common
case of a heap_update that doesn't change the key hashvalue.  But that's
going to be much more invasive, and will only produce a probably-marginal
performance gain, so it doesn't seem like material for a back-patch.

Back-patch to 9.0.  Before that, VACUUM FULL refused to do any tuple moving
if it found any INSERT_IN_PROGRESS or DELETE_IN_PROGRESS tuples (and
CLUSTER would give up altogether), so there was no risk of moving a tuple
that might be the subject of an unsent sinval message.
2011-08-16 15:26:30 -04:00
Tom Lane
84333962ea Fix incorrect order of operations during sinval reset processing.
We have to be sure that we have revalidated each nailed-in-cache relcache
entry before we try to use it to load data for some other relcache entry.
The introduction of "mapped relations" in 9.0 broke this, because although
we updated the state kept in relmapper.c early enough, we failed to
propagate that information into relcache entries soon enough; in
particular, we could try to fetch pg_class rows out of pg_class before
we'd updated its relcache entry's rd_node.relNode value from the map.

This bug accounts for Dave Gould's report of failures after "vacuum full
pg_class", and I believe that there is risk for other system catalogs
as well.

The core part of the fix is to copy relmapper data into the relcache
entries during "phase 1" in RelationCacheInvalidate(), before they'll be
used in "phase 2".  To try to future-proof the code against other similar
bugs, I also rearranged the order in which nailed relations are visited
during phase 2: now it's pg_class first, then pg_class_oid_index, then
other nailed relations.  This should ensure that RelationClearRelation can
apply RelationReloadIndexInfo to all nailed indexes without risking use
of not-yet-revalidated relcache entries.

Back-patch to 9.0 where the relation mapper was introduced.
2011-08-16 14:38:29 -04:00
Tom Lane
f48e62274f Preserve toast value OIDs in toast-swap-by-content for CLUSTER/VACUUM FULL.
This works around the problem that a catalog cache entry might contain a
toast pointer that we try to dereference just as a VACUUM FULL completes
on that catalog.  We will see the sinval message on the cache entry when
we acquire lock on the toast table, but by that point we've already told
tuptoaster.c "here's the pointer to fetch", so it's difficult from a code
structural standpoint to update the pointer before we use it.  Much less
painful to ensure that toast pointers are not invalidated in the first
place.  We have to add a bit of code to deal with the case that a value
that previously wasn't toasted becomes so; but that should be a
seldom-exercised corner case, so the inefficiency shouldn't be significant.

Back-patch to 9.0.  In prior versions, we didn't allow CLUSTER on system
catalogs, and VACUUM FULL didn't result in reassignment of toast OIDs, so
there was no problem.
2011-08-16 13:48:11 -04:00
Tom Lane
45476031a5 Fix race condition in relcache init file invalidation.
The previous code tried to synchronize by unlinking the init file twice,
but that doesn't actually work: it leaves a window wherein a third process
could read the already-stale init file but miss the SI messages that would
tell it the data is stale.  The result would be bizarre failures in catalog
accesses, typically "could not read block 0 in file ..." later during
startup.

Instead, hold RelCacheInitLock across both the unlink and the sending of
the SI messages.  This is more straightforward, and might even be a bit
faster since only one unlink call is needed.

This has been wrong since it was put in (in 2002!), so back-patch to all
supported releases.
2011-08-16 13:12:03 -04:00
Magnus Hagander
0615782b23 Adjust total size in pg_basebackup progress report when reality changes
When streaming including WAL, the size estimate will always be incorrect,
since we don't know how much WAL is included. To make sure the output doesn't
look completely unreasonable, this patch increases the total size whenever we
go past the estimate, to make sure we never go above 100%.
2011-08-16 16:59:22 +02:00
Peter Eisentraut
be78374f16 Make pg_basebackup progress report translatable
Also fix a potential portability bug, because INT64_FORMAT is only
guaranteed to be available with snprintf, not fprintf.
2011-08-16 11:28:07 +03:00
Peter Eisentraut
adbb764e50 Use less cryptic variable names 2011-08-16 11:25:28 +03:00
Bruce Momjian
96a770d5da In pg_upgrade, avoid dumping orphaned temporary tables. This makes the
pg_upgrade schema matching pattern match pg_dump/pg_dumpall.

Fix for 9.0, 9.1, and 9.2.
2011-08-15 22:40:09 -04:00
Peter Eisentraut
b0313ddd6e Adjust regression tests for error message change 2011-08-15 17:29:52 +03:00
Peter Eisentraut
90ffdf83d2 Add "Reason code" prefix to internal SSI error messages
This makes it clearer that the error message is perhaps not supposed
to be understood by users, and it also makes it somewhat clearer that
it was not accidentally omitted from translation.

Idea from Heikki Linnakangas, except that we don't mark "Reason code"
for translation at this point, because that would make the
implementation too cumbersome.
2011-08-15 15:24:44 +03:00
Tom Lane
148f321eb4 Fix unsafe order of operations in foreign-table DDL commands.
When updating or deleting a system catalog tuple, it's necessary to acquire
RowExclusiveLock on the catalog before looking up the tuple; otherwise a
concurrent VACUUM FULL on the catalog might move the tuple to a different
TID before we can apply the update.  Coding patterns that find the tuple
via a table scan aren't at risk here, but when obtaining the tuple from a
catalog cache, correct ordering is important; and several routines in
foreigncmds.c got it wrong.  Noted while running the regression tests in
parallel with VACUUM FULL of assorted system catalogs.

For consistency I moved all the heap_open calls to the starts of their
functions, including a couple for which there was no actual bug.

Back-patch to 8.4 where foreigncmds.c was added.
2011-08-14 15:40:29 -04:00
Peter Eisentraut
00fc5d2263 Message style improvements 2011-08-14 21:03:40 +03:00
Peter Eisentraut
280daac707 Fix typo 2011-08-14 10:41:13 +03:00
Tom Lane
6a3f153d08 Fix incorrect timeout handling during initial authentication transaction.
The statement start timestamp was not set before initiating the transaction
that is used to look up client authentication information in pg_authid.
In consequence, enable_sig_alarm computed a wrong value (far in the past)
for statement_fin_time.  That didn't have any immediate effect, because the
timeout alarm was set without reference to statement_fin_time; but if we
subsequently blocked on a lock for a short time, CheckStatementTimeout
would consult the bogus value when we cancelled the lock timeout wait,
and then conclude we'd timed out, leading to immediate failure of the
connection attempt.  Thus an innocent "vacuum full pg_authid" would cause
failures of concurrent connection attempts.  Noted while testing other,
more serious consequences of vacuum full on system catalogs.

We should set the statement timestamp before StartTransactionCommand(),
so that the transaction start timestamp is also valid.  I'm not sure if
there are any non-cosmetic effects of it not being valid, but the xact
timestamp is at least sent to the statistics machinery.

Back-patch to 9.0.  Before that, the client authentication timeout was done
outside any transaction and did not depend on this state to be valid.
2011-08-13 17:52:41 -04:00
Bruce Momjian
fee4a066b1 Add major features list and introductory text for 9.1 release notes.
Backpatch to 9.1, obviously.
2011-08-11 16:37:24 -04:00
Robert Haas
a60c16db5f Unbreak legacy syntax "COMMENT ON RULE x IS y", with no relation name.
check_object_ownership() isn't happy about the null relation pointer.
We could fix it there, but this seems more future-proof.
2011-08-11 11:29:20 -04:00
Tom Lane
989f530d3f Back-patch assorted latch-related fixes.
Fix a whole bunch of signal handlers that had been hacked to do things that
might change errno, without adding the necessary save/restore logic for
errno.  Also make some minor fixes in unix_latch.c, and clean up bizarre
and unsafe scheme for disowning the process's latch.  While at it, rename
the PGPROC latch field to procLatch for consistency with 9.2.

Issues noted while reviewing a patch by Peter Geoghegan.
2011-08-10 12:20:45 -04:00
Tom Lane
74d099494c Measure WaitLatch's timeout parameter in milliseconds, not microseconds.
The original definition had the problem that timeouts exceeding about 2100
seconds couldn't be specified on 32-bit machines.  Milliseconds seem like
sufficient resolution, and finer grain than that would be fantasy anyway
on many platforms.

Back-patch to 9.1 so that this aspect of the latch API won't change between
9.1 and later releases.

Peter Geoghegan
2011-08-09 18:52:35 -04:00
Tom Lane
6760a4d402 Documentation improvement and minor code cleanups for the latch facility.
Improve the documentation around weak-memory-ordering risks, and do a pass
of general editorialization on the comments in the latch code.  Make the
Windows latch code more like the Unix latch code where feasible; in
particular provide the same Assert checks in both implementations.
Fix poorly-placed WaitLatch call in syncrep.c.

This patch resolves, for the moment, concerns around weak-memory-ordering
bugs in latch-related code: we have documented the restrictions and checked
that existing calls meet them.  In 9.2 I hope that we will install suitable
memory barrier instructions in SetLatch/ResetLatch, so that their callers
don't need to be quite so careful.
2011-08-09 15:30:51 -04:00
Tom Lane
028a0c5a29 Fix nested PlaceHolderVar expressions that appear only in targetlists.
A PlaceHolderVar's expression might contain another, lower-level
PlaceHolderVar.  If the outer PlaceHolderVar is used, the inner one
certainly will be also, and so we have to make sure that both of them get
into the placeholder_list with correct ph_may_need values during the
initial pre-scan of the query (before deconstruct_jointree starts).
We did this correctly for PlaceHolderVars appearing in the query quals,
but overlooked the issue for those appearing in the top-level targetlist;
with the result that nested placeholders referenced only in the targetlist
did not work correctly, as illustrated in bug #6154.

While at it, add some error checking to find_placeholder_info to ensure
that we don't try to create new placeholders after it's too late to do so;
they have to all be created before deconstruct_jointree starts.

Back-patch to 8.4 where the PlaceHolderVar mechanism was introduced.
2011-08-09 00:48:58 -04:00
Peter Eisentraut
8956231576 Add "Compatibility" section to ALTER EXTENSION reference page
Almost all other pages have one; this one must have been forgotten.
2011-08-07 22:16:43 +03:00
Peter Eisentraut
9089628d96 Remove whitespace from end of lines 2011-08-07 16:15:00 +03:00
Peter Eisentraut
b689df4ca9 Rename "Example" sections to "Examples" in dblink chapter
For consistency with other man pages.
2011-08-07 15:52:03 +03:00
Peter Eisentraut
ad8641d535 Fix a whitespace issue with the man pages
There is what may actually be a mistake in our markup.  The problem is
in a situation like

<para>
 <command>FOO</command> is ...

there is strictly speaking a line break before "FOO".  In the HTML
output, this does not appear to be a problem, but in the man page
output, this shows up, so you get double blank lines at odd places.

So far, we have attempted to work around this with an XSL hack, but
that causes other problems, such as creating run-ins in places like

<acronym>SQL</acronym> <command>COPY</command>

So fix the problem properly by removing the extra whitespace.  I only
fixed the problems that affect the man page output, not all the
places.
2011-08-07 10:56:03 +03:00
Tom Lane
af0eca1a80 Clean up ill-advised attempt to invent a private set of Node tags.
Somebody thought it'd be cute to invent a set of Node tag numbers that were
defined independently of, and indeed conflicting with, the main tag-number
list.  While this accidentally failed to fail so far, it would certainly
lead to trouble as soon as anyone wanted to, say, apply copyObject to these
node types.  Clang was already complaining about the use of makeNode on
these tags, and I think quite rightly so.  Fix by pushing these node
definitions into the mainstream, including putting replnodes.h where it
belongs.
2011-08-06 14:53:59 -04:00
Tom Lane
34e2ef661b Fix thinko in documentation of local_preload_libraries.
Somebody added a cross-reference to shared_preload_libraries, but wrote the
wrong variable name when they did it (and didn't bother to make it a link
either).

Spotted by Christoph Anton Mitterer.
2011-08-05 21:18:11 -04:00
Tom Lane
20b6578bdb Reduce PG_SYSLOG_LIMIT to 900 bytes.
The previous limit of 1024 was set on the assumption that all modern syslog
implementations have line length limits of 2KB or so.  However, this is
false, as at least Solaris and sysklogd truncate at only 1KB.  900 seems
to leave enough room for the max likely length of the tacked-on prefixes,
so let's go with that.

As with the previous change, it doesn't seem wise to back-patch this into
already-released branches; but it should be OK to sneak it into 9.1.

Noah Misch
2011-08-05 21:02:52 -04:00
Bruce Momjian
95245e8878 Fix markup for recent wal_level clarification.
Backpatch to 9.1 and 9.0.
2011-08-04 15:02:02 -04:00
Bruce Momjian
857433b80e In documentaiton, clarify which commands have reduced WAL volume for
wal_level = minimum.

Backpatch to 9.1 and 9.0.
2011-08-04 12:06:53 -04:00
Tom Lane
1318f1ad77 Move CheckRecoveryConflictDeadlock() call to a safer place.
This kluge was inserted in a spot apparently chosen at random: the lock
manager's state is not yet fully set up for the wait, and in particular
LockWaitCancel hasn't been armed by setting lockAwaited, so the ProcLock
will not get cleaned up if the ereport is thrown.  This seems to not cause
any observable problem in trivial test cases, because LockReleaseAll will
silently clean up the debris; but I was able to cause failures with tests
involving subtransactions.

Fixes breakage induced by commit c85c941470.
Back-patch to all affected branches.
2011-08-02 15:16:37 -04:00
Tom Lane
0dd6a09e3d Fix incorrect initialization of ProcGlobal->startupBufferPinWaitBufId.
It was initialized in the wrong place and to the wrong value.  With bad
luck this could result in incorrect query-cancellation failures in hot
standby sessions, should a HS backend be holding pin on buffer number 1
while trying to acquire a lock.
2011-08-02 13:24:00 -04:00
Heikki Linnakangas
bc6616aaed Avoid integer overflow when LIMIT + OFFSET >= 2^63.
This fixes bug #6139 reported by Hitoshi Harada.
2011-08-02 11:29:43 +03:00
Peter Eisentraut
c1b910ed18 Add host name resolution information to pg_hba.conf error messages
This is to be able to analyze issues with host names in pg_hba.conf.
2011-07-31 18:08:21 +03:00
Bruce Momjian
4d2d5b8196 Fix pg_update to properly test for the data directory's existence on
Win32.

Backpatch to 9.1.
2011-07-30 01:50:51 -04:00
Tom Lane
4798aa5b09 Fix pg_restore's direct-to-database mode for standard_conforming_strings.
pg_backup_db.c contained a mini SQL lexer with which it tried to identify
boundaries between SQL commands, but that code was not designed to cope
with standard_conforming_strings, and would get the wrong answer if a
backslash immediately precedes a closing single quote in such a string,
as per report from Julian Mehnle.  The bug only affects direct-to-database
restores from archive files made with standard_conforming_strings = on.

Rather than complicating the code some more to try to fix that, let's just
rip it all out.  The only reason it was needed was to cope with COPY data
embedded into ordinary archive entries, which was a layout that was used
only for about the first three weeks of the archive format's existence,
and never in any production release of pg_dump.  Instead, just rely on the
archive file layout to tell us whether we're printing COPY data or not.

This bug represents a data corruption hazard in all releases in which
standard_conforming_strings can be turned on, ie 8.2 and later, so
back-patch to all supported branches.
2011-07-28 14:07:04 -04:00
Peter Eisentraut
42221b597e Minor message style adjustment 2011-07-27 23:55:32 +03:00
Robert Haas
0b624d64a1 Fix typo.
Noted by Josh Kupershmidt.
2011-07-27 11:20:34 -04:00
Peter Eisentraut
14e109e82e Add missing newlines at end of error messages 2011-07-26 23:27:40 +03:00
Robert Haas
d94eb49634 Clarify which relkinds accept column comments.
Per discussion with Josh Kupershmidt.
2011-07-26 09:39:03 -04:00
Andrew Dunstan
5c70cc890d Don't build replacement getpeereid function on mingw.
Windows doesn't have Unix sockets, so it's not needed, and moreover causes compile warnings.
2011-07-25 23:46:52 -04:00