users/rhaas/postgres.git
14 years agovolatile-ize. snaparray
Robert Haas [Thu, 27 Oct 2011 12:21:10 +0000 (08:21 -0400)]
volatile-ize.

14 years agoClean up ProcArrayEndTransaction().
Robert Haas [Sat, 15 Oct 2011 11:10:13 +0000 (07:10 -0400)]
Clean up ProcArrayEndTransaction().

14 years agoSimplify ProcArrayRemove().
Robert Haas [Sat, 15 Oct 2011 10:57:18 +0000 (06:57 -0400)]
Simplify ProcArrayRemove().

14 years agoRemove another reference to latestCompletedXid.
Robert Haas [Sat, 15 Oct 2011 10:42:26 +0000 (06:42 -0400)]
Remove another reference to latestCompletedXid.

14 years agoDon't take ProcArrayLock when committing.
Robert Haas [Fri, 14 Oct 2011 19:28:56 +0000 (15:28 -0400)]
Don't take ProcArrayLock when committing.

14 years agoRip out hppo stuff.
Robert Haas [Tue, 11 Oct 2011 12:22:09 +0000 (08:22 -0400)]
Rip out hppo stuff.

14 years agoAnother attempt to unbreak HOT.
Robert Haas [Mon, 10 Oct 2011 19:03:24 +0000 (15:03 -0400)]
Another attempt to unbreak HOT.

14 years agoStuff. Need to rip out hppo crap.
Robert Haas [Sat, 8 Oct 2011 02:50:11 +0000 (22:50 -0400)]
Stuff.  Need to rip out hppo crap.

14 years agoTry to set takenDuringRecovery appropriately.
Robert Haas [Fri, 7 Oct 2011 16:26:59 +0000 (12:26 -0400)]
Try to set takenDuringRecovery appropriately.

14 years agoifdef SNAPARRAY_DEBUG
Robert Haas [Wed, 5 Oct 2011 19:41:16 +0000 (15:41 -0400)]
ifdef SNAPARRAY_DEBUG

14 years agoMore stupid bug fixes.
Robert Haas [Fri, 30 Sep 2011 00:08:51 +0000 (20:08 -0400)]
More stupid bug fixes.

14 years agoBug fixes and additional assertions.
Robert Haas [Thu, 29 Sep 2011 18:26:03 +0000 (14:26 -0400)]
Bug fixes and additional assertions.

14 years agoRemove some debugging code.
Robert Haas [Thu, 29 Sep 2011 00:00:10 +0000 (20:00 -0400)]
Remove some debugging code.

14 years agoMinor doc fixes.
Robert Haas [Sat, 17 Sep 2011 01:46:06 +0000 (20:46 -0500)]
Minor doc fixes.

14 years agoBe less tentative.
Robert Haas [Sat, 17 Sep 2011 01:34:19 +0000 (20:34 -0500)]
Be less tentative.

14 years agoUnbreak XIDCACHE_DEBUG.
Robert Haas [Fri, 16 Sep 2011 22:11:16 +0000 (17:11 -0500)]
Unbreak XIDCACHE_DEBUG.

14 years agoRewrite GetOldestXmin().
Robert Haas [Fri, 16 Sep 2011 21:37:49 +0000 (16:37 -0500)]
Rewrite GetOldestXmin().

14 years agoRewrite TransactionIdIsInProgress().
Robert Haas [Fri, 16 Sep 2011 19:20:55 +0000 (14:20 -0500)]
Rewrite TransactionIdIsInProgress().

14 years agoRewrite caching mechanism.
Robert Haas [Thu, 15 Sep 2011 19:54:42 +0000 (14:54 -0500)]
Rewrite caching mechanism.

This leaves behind some duplicate code that needs to be cleaned up, but
gets us much closer to being able to do a proper global_xmin computation.

14 years agoTODO LIST:
Robert Haas [Thu, 25 Aug 2011 23:05:53 +0000 (19:05 -0400)]
TODO LIST:
 - AssignTransactionId() needs to WAL log sooner, before actually getting
   the new XID
 - AssignTransactionId() should also update the SnapArray before getting
   the new XID, even in normal operation, if there are too many cached subxids
 - Rewrite TransactionIdIsInProgress().
 - Compute global_xmin properly.
 - Review residual references to GetSnapshotData().
 - ProcArray code should not take SnapArrayLock.

14 years agoDebugging code - rip me out.
Robert Haas [Thu, 25 Aug 2011 13:34:06 +0000 (09:34 -0400)]
Debugging code - rip me out.

14 years agoInitial work on SnapArray implementation.
Robert Haas [Tue, 16 Aug 2011 02:43:49 +0000 (22:43 -0400)]
Initial work on SnapArray implementation.

14 years agoDump all roles first, then all config settings on roles.
Robert Haas [Fri, 14 Oct 2011 18:16:02 +0000 (14:16 -0400)]
Dump all roles first, then all config settings on roles.

This way, if a role's config setting uses the name of another role,
the validity of the dump isn't dependent on the order in which those
two roles are dumped.

Code by Phil Sorber, comment by me.

14 years agoAvoid potential relcache leak in objectaddress.c.
Robert Haas [Fri, 14 Oct 2011 15:35:40 +0000 (11:35 -0400)]
Avoid potential relcache leak in objectaddress.c.

Nobody using the missing_ok flag yet, but let's speculate that this will
be a better interface for future callers.

KaiGai Kohei, with some adjustments by me.

14 years agoDocument actual string that has to be returned by the client for MD5
Bruce Momjian [Fri, 14 Oct 2011 00:48:50 +0000 (20:48 -0400)]
Document actual string that has to be returned by the client for MD5
authentication.

Report and pseudo code by Cyan Ogilvie

14 years agoRemove all "traces" of trace_userlocks, because userlocks were removed
Bruce Momjian [Thu, 13 Oct 2011 23:59:13 +0000 (19:59 -0400)]
Remove all "traces" of trace_userlocks, because userlocks were removed
in PG 8.2.

14 years agoFix up Perl-to-Postgres datatype conversions in pl/perl.
Tom Lane [Thu, 13 Oct 2011 22:02:43 +0000 (18:02 -0400)]
Fix up Perl-to-Postgres datatype conversions in pl/perl.

This patch restores the pre-9.1 behavior that pl/perl functions returning
VOID ignore the result value of their last Perl statement.  9.1.0
unintentionally threw an error if the last statement returned a reference,
as reported by Amit Khandekar.

Also, make sure it works to return a string value for a composite type,
so long as the string meets the type's input format.  We already allowed
the equivalent behavior for arrays, so it seems inconsistent to not allow
it for composites.

In addition, ensure we throw errors for attempts to return arrays or hashes
when the function's declared result type is not an array or composite type,
respectively.  Pre-9.1 versions rather uselessly returned strings like
ARRAY(0x221a9a0) or HASH(0x221aa90), while 9.1.0 threw an error for the
hash case and returned a garbage value for the array case.

Also, clean up assorted grotty coding in Perl array conversion, including
use of a session-lifespan memory context to accumulate the array value
(resulting in session-lifespan memory leak on error), failure to apply the
declared typmod if any, and failure to detect some cases of non-rectangular
multi-dimensional arrays.

Alex Hunsaker and Tom Lane

14 years agoUpdate documentation about ts_rank().
Bruce Momjian [Thu, 13 Oct 2011 18:17:20 +0000 (14:17 -0400)]
Update documentation about ts_rank().

14 years agoHave pg_ctl return an exit status of 3 if the server is not running, to
Bruce Momjian [Thu, 13 Oct 2011 17:01:56 +0000 (13:01 -0400)]
Have pg_ctl return an exit status of 3 if the server is not running, to
match the Linux Standard Base Core Specification 3.1.

Aaron W. Swenson

14 years agoFix typo in dummy_seclabel documentation.
Tom Lane [Thu, 13 Oct 2011 16:16:07 +0000 (12:16 -0400)]
Fix typo in dummy_seclabel documentation.

dummy_label -> dummy_seclabel

Thom Brown

14 years agoDocument who can drop a table (owner and user with permissions).
Bruce Momjian [Thu, 13 Oct 2011 14:05:54 +0000 (10:05 -0400)]
Document who can drop a table (owner and user with permissions).

14 years agoRemove tab in sgml file.
Bruce Momjian [Thu, 13 Oct 2011 13:32:39 +0000 (09:32 -0400)]
Remove tab in sgml file.

14 years agoDon't mark auto-generated types as extension members.
Tom Lane [Wed, 12 Oct 2011 22:40:09 +0000 (18:40 -0400)]
Don't mark auto-generated types as extension members.

Relation rowtypes and automatically-generated array types do not need to
have their own extension membership dependency entries.  If we create such
then it becomes more difficult to remove items from an extension, and it's
also harder for an extension upgrade script to make sure it duplicates the
dependencies created by the extension's regular installation script.

I changed the code in such a way that this happened in commit
988cccc620dd8c16d77f88ede167b22056176324, I think because of worries about
the shell-type-replacement case; but that cure was worse than the disease.
It would only matter if one extension created a shell type that was
replaced with an auto-generated type in another extension, which seems
pretty far-fetched.  Better to make this work unsurprisingly in normal
cases.

Report and patch by Robert Haas, comment adjustments by me.

14 years agoDocument how to accent Alvaro Herrera in the release notes.
Bruce Momjian [Wed, 12 Oct 2011 21:20:05 +0000 (17:20 -0400)]
Document how to accent Alvaro Herrera in the release notes.

14 years agoClarify wording of foreign key documentation to mention null entries as
Bruce Momjian [Wed, 12 Oct 2011 20:58:39 +0000 (16:58 -0400)]
Clarify wording of foreign key documentation to mention null entries as
not matching the primary key.

Report from Marek.Balgar@seznam.cz

14 years agoModify RelationGetBufferForTuple() to use a typedef, rather than a
Bruce Momjian [Wed, 12 Oct 2011 20:53:54 +0000 (16:53 -0400)]
Modify RelationGetBufferForTuple() to use a typedef, rather than a
struct, to help pgindent.

14 years agoModify pgindent to use a renamed pg_bsd_indent binary. New features
Bruce Momjian [Wed, 12 Oct 2011 19:45:46 +0000 (15:45 -0400)]
Modify pgindent to use a renamed pg_bsd_indent binary.  New features
include the ability to supply a typedef file, rather than list them on
the command line.  Also improve the README.

14 years agoThrow a useful error message if an extension script file is fed to psql.
Tom Lane [Wed, 12 Oct 2011 19:45:03 +0000 (15:45 -0400)]
Throw a useful error message if an extension script file is fed to psql.

We have seen one too many reports of people trying to use 9.1 extension
files in the old-fashioned way of sourcing them in psql.  Not only does
that usually not work (due to failure to substitute for MODULE_PATHNAME
and/or @extschema@), but if it did work they'd get a collection of loose
objects not an extension.  To prevent this, insert an \echo ... \quit
line that prints a suitable error message into each extension script file,
and teach commands/extension.c to ignore lines starting with \echo.
That should not only prevent any adverse consequences of loading a script
file the wrong way, but make it crystal clear to users that they need to
do it differently now.

Tom Lane, following an idea of Andrew Dunstan's.  Back-patch into 9.1
... there is not going to be much value in this if we wait till 9.2.

14 years agoModify up/home macro to match standard parameter list; fixes doc build.
Bruce Momjian [Wed, 12 Oct 2011 18:04:59 +0000 (14:04 -0400)]
Modify up/home macro to match standard parameter list;  fixes doc build.

14 years agoImprove documentation of psql's \q command.
Tom Lane [Wed, 12 Oct 2011 17:59:30 +0000 (13:59 -0400)]
Improve documentation of psql's \q command.

The documentation neglected to explain its behavior in a script file
(it only ends execution of the script, not psql as a whole), and failed
to mention the long form \quit either.

14 years agoAdd Up/Home link to the top of the HTML doc output.
Bruce Momjian [Wed, 12 Oct 2011 15:24:13 +0000 (11:24 -0400)]
Add Up/Home link to the top of the HTML doc output.

Backpatch to 9.0.X and 9.1.X.

14 years agoAdd comment on why pulling data from a "name" index column can't crash.
Tom Lane [Tue, 11 Oct 2011 22:40:53 +0000 (18:40 -0400)]
Add comment on why pulling data from a "name" index column can't crash.

It's been bothering me for several days that pretending that the cstring
data stored in a btree name_ops column is really a "name" Datum could lead
to reading past the end of memory.  However, given the current memory
layout used for index-only scans in the btree code, a crash is in fact not
possible.  Document that so we don't break it.  I have not thought of any
other solutions that aren't fairly ugly too, and most of them lose the
functionality of index-only scans on name columns altogether, so this seems
like the way to go.

14 years agoGenerate index-only scan tuple descriptor from the plan node's indextlist.
Tom Lane [Tue, 11 Oct 2011 22:11:51 +0000 (18:11 -0400)]
Generate index-only scan tuple descriptor from the plan node's indextlist.

Dept. of second thoughts: as long as we've got that tlist hanging around
anyway, we can apply ExecTypeFromTL to it to get a suitable descriptor for
the ScanTupleSlot.  This is a nicer solution than the previous one because
it eliminates some hard-wired knowledge about btree name_ops, and because
it avoids the somewhat shaky assumption that we needn't set up the scan
tuple descriptor in EXPLAIN_ONLY mode.  It doesn't change what actually
happens at run-time though, and I'm still a bit nervous about that.

14 years agoImprove entab's Makefile install entry.
Bruce Momjian [Tue, 11 Oct 2011 22:03:34 +0000 (18:03 -0400)]
Improve entab's Makefile install entry.

Andrew Dunstan

14 years agoDocument that not backing up postmaster.pid and postmaster.opts might
Bruce Momjian [Tue, 11 Oct 2011 21:33:20 +0000 (17:33 -0400)]
Document that not backing up postpid and postmaster.opts might
help prevent pg_ctl from getting confused.

Backpatch to 9.1.

14 years agoConsider index-only scans even when there is no matching qual or ORDER BY.
Tom Lane [Tue, 11 Oct 2011 19:00:30 +0000 (15:00 -0400)]
Consider index-only scans even when there is no matching qual or ORDER BY.

By popular demand.

14 years agoRearrange the implementation of index-only scans.
Tom Lane [Tue, 11 Oct 2011 18:20:06 +0000 (14:20 -0400)]
Rearrange the implementation of index-only scans.

This commit changes index-only scans so that data is read directly from the
index tuple without first generating a faux heap tuple.  The only immediate
benefit is that indexes on system columns (such as OID) can be used in
index-only scans, but this is necessary infrastructure if we are ever to
support index-only scans on expression indexes.  The executor is now ready
for that, though the planner still needs substantial work to recognize
the possibility.

To do this, Vars in index-only plan nodes have to refer to index columns
not heap columns.  I introduced a new special varno, INDEX_VAR, to mark
such Vars to avoid confusion.  (In passing, this commit renames the two
existing special varnos to OUTER_VAR and INNER_VAR.)  This allows
ruleutils.c to handle them with logic similar to what we use for subplan
reference Vars.

Since index-only scans are now fundamentally different from regular
indexscans so far as their expression subtrees are concerned, I also chose
to change them to have their own plan node type (and hence, their own
executor source file).

14 years agoReplace hardcoded switch in object_exists() with a lookup table.
Robert Haas [Tue, 11 Oct 2011 13:14:30 +0000 (09:14 -0400)]
Replace hardcoded switch in object_exists() with a lookup table.

There's no particular advantage to this change on its face; indeed,
it's possible that this might be slightly slower than the old way.
But it makes this information more easily accessible to other
functions, and therefore paves the way for future code consolidation.
Performance isn't critical here, so there's no need to be smart about
how we do the search.

This is a heavily cut-down version of a patch from KaiGai Kohei,
with several fixes by me.  Additional review from Dimitri Fontaine.

14 years agoRepair breakage in VirtualXactLock.
Robert Haas [Tue, 11 Oct 2011 11:39:09 +0000 (07:39 -0400)]
Repair breakage in VirtualXactLock.

I broke this in commit 84e37126770dd6de903dad88ce150a49b63b5ef9.  Report and
fix by Fujii Masao.

14 years agoMake the reference to "CREATE USER" in the CREATE ROLE page a link.
Robert Haas [Mon, 10 Oct 2011 17:38:32 +0000 (13:38 -0400)]
Make the reference to "CREATE USER" in the CREATE ROLE page a link.

This might help to avoid confusion between the CREATE USER command,
and the deprecated CREATEUSER option to CREATE ROLE, as per a recent
complaint from Ron Adams.  At any rate, having a cross-link here
seems like a good idea; two commands that are so similar should
reference each other.

14 years agoImprove documentation of how to fiddle with SCSI drives on FreeBSD.
Robert Haas [Mon, 10 Oct 2011 17:21:35 +0000 (13:21 -0400)]
Improve documentation of how to fiddle with SCSI drives on FreeBSD.

Per suggestions from Achilleas Mantzios and Greg Smith.

14 years agoFix typo in docs for libpq keepalives_count option.
Robert Haas [Mon, 10 Oct 2011 17:10:47 +0000 (13:10 -0400)]
Fix typo in docs for libpq keepalives_count option.

Shigehiro Honda

14 years agoAdd doc index entry for pg_resetxlog.
Robert Haas [Mon, 10 Oct 2011 17:05:25 +0000 (13:05 -0400)]
Add doc index entry for pg_resetxlog.

Fujii Masao

14 years agoDocument DELETE/UPDATE command tag behavior when triggers are involved.
Robert Haas [Mon, 10 Oct 2011 16:53:04 +0000 (12:53 -0400)]
Document DELETE/UPDATE command tag behavior when triggers are involved.

Marti Raudsepp

14 years agoSome minor wordsmithing for the cascading replication documentation.
Robert Haas [Mon, 10 Oct 2011 14:15:45 +0000 (10:15 -0400)]
Some minor wordsmithing for the cascading replication documentation.

Per report from Thom Brown.

14 years agoMark GUC external_pid_file's default as '' in postgresql.conf, rather
Bruce Momjian [Mon, 10 Oct 2011 12:16:36 +0000 (08:16 -0400)]
Mark GUC external_pid_file's default as '' in postgresql.conf, rather
than '(none)'.

14 years agoAttempt to reduce local dependencies in regression tests.
Robert Haas [Mon, 10 Oct 2011 11:58:17 +0000 (07:58 -0400)]
Attempt to reduce local dependencies in regression tests.

This appears to be another case where the relative sort order of letters
vs. numbers can throw things off.

Pavel Stehule

14 years agoIn pg_upgrade, add -o/-O options to pass parameters to the servers, and
Bruce Momjian [Mon, 10 Oct 2011 11:43:28 +0000 (07:43 -0400)]
In pg_upgrade, add -o/-O options to pass parameters to the servers, and
document its use for config-only directory installs.

14 years agoFix ALTER TABLE ONLY .. DROP CONSTRAINT.
Robert Haas [Mon, 10 Oct 2011 03:39:52 +0000 (23:39 -0400)]
Fix ALTER TABLE ONLY .. DROP CONSTRAINT.

When I consolidated two copies of the HOT-chain search logic in commit
4da99ea4231e3d8bbf28b666748c1028e7b7d665, I introduced a behavior
change: the old code wouldn't necessarily traverse the entire chain,
if the most recently returned tuple were updated while the HOT chain
traversal is in progress.  The new behavior seems more correct, but
unfortunately, the code here relies on a scan with SnapshotNow failing
to see its own updates.  That seems pretty shaky even with the old HOT
chain traversal behavior, since there's no guarantee that these
updates will always be HOT, but it's trivial to broke a failure with
the new HOT search logic.  Fix by updating just the first matching
pg_constraint tuple, rather than all of them, since there should be
only one anyway.  But since nobody has reproduced this failure on older
versions, no back-patch for now.

Report and test case by Alex Hunsaker; tablecmds.c changes by me.

14 years agoRevert accidental change to pg_config_manual.h.
Robert Haas [Mon, 10 Oct 2011 02:20:44 +0000 (22:20 -0400)]
Revert accidental change to pg_config_manual.h.

This was broken in commit 53dbc27c62d8e1b6c5253feba04a5094cb8fe046, which
introduced unlogged tables.  Fortunately, as debugging tools go, this one
is pretty cheap, which is probably why it took nine months for someone to
notice, but it's not intended to be enabled by default, so revert.

Noted by Fujii Masao.

14 years agoClean up a couple of box gist helper functions.
Heikki Linnakangas [Sun, 9 Oct 2011 15:55:27 +0000 (18:55 +0300)]
Clean up a couple of box gist helper functions.

The original idea of this patch was to make box picksplit run faster, by
eliminating unnecessary palloc() overhead, but that was obsoleted by the new
double-sorting split algorithm that doesn't call these functions so heavily
anymore. Nevertheless, the code looks better this way.

Original patch by me, reviewed and tidied up after the double-sorting patch
by Kevin Grittner.

14 years agoImprove index-only scans to avoid repeated access to the index page.