]> granicus.if.org Git - postgresql/log
postgresql
12 years agoPrevent corner-case core dump in rfree().
Tom Lane [Sun, 15 Jul 2012 17:27:54 +0000 (13:27 -0400)]
Prevent corner-case core dump in rfree().

rfree() failed to cope with the case that pg_regcomp() had initialized the
regex_t struct but then failed to allocate any memory for re->re_guts (ie,
the first malloc call in pg_regcomp() failed).  It would try to touch the
guts struct anyway, and thus dump core.  This is a sufficiently narrow
corner case that it's not surprising it's never been seen in the field;
but still a bug is a bug, so patch all active branches.

Noted while investigating whether we need to call pg_regfree after a
failure return from pg_regcomp.  Other than this bug, it turns out we
don't, so adjust comments appropriately.

12 years agoDon't initialize TLI variable to -1, as TimeLineID is unsigned.
Heikki Linnakangas [Sat, 14 Jul 2012 18:02:04 +0000 (21:02 +0300)]
Don't initialize TLI variable to -1, as TimeLineID is unsigned.

This was causing a compiler warning with Solaris compiler. Use 0 instead.
The variable is initialized just for the sake of tidyness  and/or debugging,
it's not used for anything before setting it to a real value.

Per report and suggestion from Peter Eisentraut.

12 years agoPrint the name of the WAL file containing latest REDO ptr in pg_controldata.
Heikki Linnakangas [Sat, 14 Jul 2012 11:17:43 +0000 (14:17 +0300)]
Print the name of the WAL file containing latest REDO ptr in pg_controldata.

This makes it easier to determine how far back you need to keep archived WAL
files, to restore from a backup.

Fujii Masao

12 years agoAdd link to PEP 394 regarding python2 vs python3 naming
Peter Eisentraut [Sat, 14 Jul 2012 10:06:09 +0000 (13:06 +0300)]
Add link to PEP 394 regarding python2 vs python3 naming

12 years agoAdd fsync capability to initdb, and use sync_file_range() if available.
Tom Lane [Fri, 13 Jul 2012 21:16:58 +0000 (17:16 -0400)]
Add fsync capability to initdb, and use sync_file_range() if available.

Historically we have not worried about fsync'ing anything during initdb
(in fact, initdb intentionally passes -F to each backend launch to prevent
it from fsync'ing).  But with filesystems getting more aggressive about
caching data, that's not such a good plan anymore.  Make initdb do a pass
over the finished data directory tree to fsync everything.  For testing
purposes, the -N/--nosync flag can be used to restore the old behavior.

Also, testing shows that on Linux, sync_file_range() is much faster than
posix_fadvise() for hinting to the kernel that an fsync is coming,
apparently because the latter blocks on a rather small request queue while
the former doesn't.  So use this function if available in initdb, and also
in the backend's pg_flush_data() (where it currently will affect only the
speed of CREATE DATABASE's cloning step).

We will later make pg_regress invoke initdb with the --nosync flag
to avoid slowing down cases such as "make check" in contrib.  But
let's not do so until we've shaken out any portability issues in this
patch.

Jeff Davis, reviewed by Andres Freund

12 years agoCosmetic cleanup of ginInsertValue().
Tom Lane [Fri, 13 Jul 2012 15:37:39 +0000 (11:37 -0400)]
Cosmetic cleanup of ginInsertValue().

Make it clearer that the passed stack mustn't be empty, and that we
are not supposed to fall off the end of the stack in the main loop.
Tighten the loop that extracts the root block number, too.

Markus Wanner and Tom Lane

12 years agoAvoid extra newlines in XML mapping in table forest mode
Peter Eisentraut [Thu, 12 Jul 2012 20:47:33 +0000 (23:47 +0300)]
Avoid extra newlines in XML mapping in table forest mode

found by P. Broennimann

12 years agoSkip text->binary conversion of unnecessary columns in contrib/file_fdw.
Tom Lane [Thu, 12 Jul 2012 20:26:59 +0000 (16:26 -0400)]
Skip text->binary conversion of unnecessary columns in contrib/file_fdw.

When reading from a text- or CSV-format file in file_fdw, the datatype
input routines can consume a significant fraction of the runtime.
Often, the query does not need all the columns, so we can get a useful
speed boost by skipping I/O conversion for unnecessary columns.

To support this, add a "convert_selectively" option to the core COPY code.
This is undocumented and not accessible from SQL (for now, anyway).

Etsuro Fujita, reviewed by KaiGai Kohei

12 years agoRemove 'x =- 1' check for pgindent, not needed, per report from Andrew
Bruce Momjian [Thu, 12 Jul 2012 18:37:35 +0000 (14:37 -0400)]
Remove 'x =- 1' check for pgindent, not needed, per report from Andrew
Dunstan.

12 years agoFix memory and file descriptor leaks in pg_receivexlog/pg_basebackup
Magnus Hagander [Thu, 12 Jul 2012 11:31:19 +0000 (13:31 +0200)]
Fix memory and file descriptor leaks in pg_receivexlog/pg_basebackup

When the internal loop mode was added, freeing memory and closing
filedescriptors before returning became important, and a few cases
in the code missed that.

Fujii Masao

12 years agoAdd array_remove() and array_replace() functions.
Tom Lane [Wed, 11 Jul 2012 17:59:35 +0000 (13:59 -0400)]
Add array_remove() and array_replace() functions.

These functions support removing or replacing array element value(s)
matching a given search value.  Although intended mainly to support a
future array-foreign-key feature, they seem useful in their own right.

Marco Nenciarini and Gabriele Bartolini, reviewed by Alex Hunsaker

12 years agoDocument that Log-Shipping Standby Servers cannot be upgraded by
Bruce Momjian [Wed, 11 Jul 2012 03:08:19 +0000 (23:08 -0400)]
Document that Log-Shipping Standby Servers cannot be upgraded by
pg_upgrade.

Backpatch to 9.2.

12 years agoFix bogus macro definition.
Tom Lane [Wed, 11 Jul 2012 02:36:11 +0000 (22:36 -0400)]
Fix bogus macro definition.

Per buildfarm complaints.

12 years agoAdd comments about additional mule-internal charsets from emacs's
Tatsuo Ishii [Tue, 10 Jul 2012 23:10:50 +0000 (08:10 +0900)]
Add comments about additional mule-internal charsets from emacs's
source code(lisp/international/mule-conf.el).  These charsets have not
been supported up to now anyway, so this is just for adding
commentary.  Also add mention that we follow emacs's implementation,
not xemacs's.

12 years agoFix ASCII case in pg_wchar2mule_with_len.
Tom Lane [Tue, 10 Jul 2012 19:58:36 +0000 (15:58 -0400)]
Fix ASCII case in pg_wchar2mule_with_len.

Also some cosmetic improvements for wchar-to-mblen patch.

12 years agoplperl: Skip setting UTF8 flag when in SQL_ASCII encoding
Alvaro Herrera [Mon, 9 Jul 2012 21:36:29 +0000 (17:36 -0400)]
plperl: Skip setting UTF8 flag when in SQL_ASCII encoding

When in SQL_ASCII encoding, strings passed around are not necessarily
UTF8-safe.  We had already fixed this in some places, but it looks like
we missed some.

I had to backpatch Peter Eisentraut's a8b92b60 to 9.1 in order for this
patch to cherry-pick more cleanly.

Patch from Alex Hunsaker, tweaked by Kyotaro HORIGUCHI and myself.

Some desultory cleanup and comment addition by me, during patch review.

Per bug report from Christoph Berg in
20120209102116.GA14429@msgid.df7cb.de

12 years agoperltidy adjustments to new file
Alvaro Herrera [Mon, 9 Jul 2012 21:35:57 +0000 (17:35 -0400)]
perltidy adjustments to new file

12 years agoRe-implement extraction of fixed prefixes from regular expressions.
Tom Lane [Tue, 10 Jul 2012 18:54:37 +0000 (14:54 -0400)]
Re-implement extraction of fixed prefixes from regular expressions.

To generate btree-indexable conditions from regex WHERE conditions (such as
WHERE indexed_col ~ '^foo'), we need to be able to identify any fixed
prefix that a regex might have; that is, find any string that must be a
prefix of all strings satisfying the regex.  We used to do that with
entirely ad-hoc code that looked at the source text of the regex.  It
didn't know very much about regex syntax, which mostly meant that it would
fail to identify some optimizable cases; but Viktor Rosenfeld reported that
it would produce actively wrong answers for quantified parenthesized
subexpressions, such as '^(foo)?bar'.  Rather than trying to extend the
ad-hoc code to cover this, let's get rid of it altogether in favor of
identifying prefixes by examining the compiled form of a regex.

To do this, I've added a new entry point "pg_regprefix" to the regex library;
hopefully it is defined in a sufficiently general fashion that it can remain
in the library when/if that code gets split out as a standalone project.

Since this bug has been there for a very long time, this fix needs to get
back-patched.  However it depends on some other recent commits (particularly
the addition of wchar-to-database-encoding conversion), so I'll commit this
separately and then go to work on back-porting the necessary fixes.

12 years agoRefactor pattern_fixed_prefix() to avoid dealing in incomplete patterns.
Tom Lane [Tue, 10 Jul 2012 03:22:55 +0000 (23:22 -0400)]
Refactor pattern_fixed_prefix() to avoid dealing in incomplete patterns.

Previously, pattern_fixed_prefix() was defined to return whatever fixed
prefix it could extract from the pattern, plus the "rest" of the pattern.
That definition was sensible for LIKE patterns, but not so much for
regexes, where reconstituting a valid pattern minus the prefix could be
quite tricky (certainly the existing code wasn't doing that correctly).
Since the only thing that callers ever did with the "rest" of the pattern
was to pass it to like_selectivity() or regex_selectivity(), let's cut out
the middle-man and just have pattern_fixed_prefix's subroutines do this
directly.  Then pattern_fixed_prefix can return a simple selectivity
number, and the question of how to cope with partial patterns is removed
from its API specification.

While at it, adjust the API spec so that callers who don't actually care
about the pattern's selectivity (which is a lot of them) can pass NULL for
the selectivity pointer to skip doing the work of computing a selectivity
estimate.

This patch is only an API refactoring that doesn't actually change any
processing, other than allowing a little bit of useless work to be skipped.
However, it's necessary infrastructure for my upcoming fix to regex prefix
extraction, because after that change there won't be any simple way to
identify the "rest" of the regex, not even to the low level of fidelity
needed by regex_selectivity.  We can cope with that if regex_fixed_prefix
and regex_selectivity communicate directly, but not if we have to work
within the old API.  Hence, back-patch to all active branches.

12 years agoFix planner to pass correct collation to operator selectivity estimators.
Tom Lane [Mon, 9 Jul 2012 03:51:08 +0000 (23:51 -0400)]
Fix planner to pass correct collation to operator selectivity estimators.

We can do this without creating an API break for estimation functions
by passing the collation using the existing fmgr functionality for
passing an input collation as a hidden parameter.

The need for this was foreseen at the outset, but we didn't get around to
making it happen in 9.1 because of the decision to sort all pg_statistic
histograms according to the database's default collation.  That meant that
selectivity estimators generally need to use the default collation too,
even if they're estimating for an operator that will do something
different.  The reason it's suddenly become more interesting is that
regexp interpretation also uses a collation (for its LC_TYPE not LC_COLLATE
property), and we no longer want to use the wrong collation when examining
regexps during planning.  It's not that the selectivity estimate is likely
to change much from this; rather that we are thinking of caching compiled
regexps during planner estimation, and we won't get the intended benefit
if we cache them with a different collation than the executor will use.

Back-patch to 9.1, both because the regexp change is likely to get
back-patched and because we might as well get this right in all
collation-supporting branches, in case any third-party code wants to
rely on getting the collation.  The patch turns out to be minuscule
now that I've done it ...

12 years agoSimplify and document regex library's compact-NFA representation.
Tom Lane [Sat, 7 Jul 2012 21:39:50 +0000 (17:39 -0400)]
Simplify and document regex library's compact-NFA representation.

The previous coding abused the first element of a cNFA state's arcs list
to hold a per-state flag bit, which was confusing, undocumented, and not
even particularly efficient.  Get rid of that in favor of a separate
"stflags" vector.  Since there's only one bit in use, I chose to allocate a
char per state; we could possibly replace this with a bitmap at some point,
but that would make accesses a little slower.  It's already about 8X
smaller than before, so let's not get overly tense.

Also document the representation better than it was before, which is to say
not at all.

This patch is a byproduct of investigations towards extracting a "fixed
prefix" string from the compact-NFA representation of regex patterns.
Might need to back-patch it if we decide to back-patch that fix, but for
now it's just code cleanup so I'll just put it in HEAD.

12 years agoConvert libpq regress script to Perl
Alvaro Herrera [Fri, 6 Jul 2012 19:38:11 +0000 (15:38 -0400)]
Convert libpq regress script to Perl

This should ease its use on the Windows build environment.

12 years agoUpdate libpq test expected output
Alvaro Herrera [Fri, 6 Jul 2012 20:23:30 +0000 (16:23 -0400)]
Update libpq test expected output

Commit 2b443063 changed wording for some of the error messages, but
neglected updating the regress output to match.

12 years agoRun updated copyright.pl on HEAD and 9.2 trees, updating the psql
Bruce Momjian [Fri, 6 Jul 2012 16:28:18 +0000 (12:28 -0400)]
Run updated copyright.pl on HEAD and 9.2 trees, updating the psql
\copyright output to 2012.

Backpatch to 9.2.

12 years agoHave copyright.pl skip updating something that is just the current year,
Bruce Momjian [Fri, 6 Jul 2012 16:21:43 +0000 (12:21 -0400)]
Have copyright.pl skip updating something that is just the current year,
to avoid producing dups, e.g. 2012-2012

Backpatch to 9.2.

12 years agoModify copyright.pl so all lines are processed, not just the first
Bruce Momjian [Fri, 6 Jul 2012 15:58:55 +0000 (11:58 -0400)]
Modify copyright.pl so all lines are processed, not just the first
match, so files that contain embedded copyrights are updated, e.g.
pgsql/help.c.

Backpatch to 9.2.

12 years agoFix copyright.pl to properly skip the .git directory by adding a
Bruce Momjian [Fri, 6 Jul 2012 15:43:59 +0000 (11:43 -0400)]
Fix copyright.pl to properly skip the .git directory by adding a
basename() qualification.

12 years agoFix spacing in copyright.pl after being run with missing regex slash
Bruce Momjian [Fri, 6 Jul 2012 14:57:08 +0000 (10:57 -0400)]
Fix spacing in copyright.pl after being run with missing regex slash
(now added).

Backpatch to 9.2.

12 years agoUpdate pg_upgrade comments for recent configpath fix.
Bruce Momjian [Fri, 6 Jul 2012 13:39:22 +0000 (09:39 -0400)]
Update pg_upgrade comments for recent configpath fix.

12 years agoFix failure of new wchar->mb functions to advance from pointer.
Robert Haas [Fri, 6 Jul 2012 03:47:53 +0000 (23:47 -0400)]
Fix failure of new wchar->mb functions to advance from pointer.

Bug spotted by Tom Lane.

12 years agoFix PGDATAOLD and PGDATANEW to properly set pgconfig location, per
Bruce Momjian [Fri, 6 Jul 2012 03:36:30 +0000 (23:36 -0400)]
Fix PGDATAOLD and PGDATANEW to properly set pgconfig location, per
report from Tom.

Backpatch to 9.2.

12 years agoDon't try to trim "../" in join_path_components().
Tom Lane [Thu, 5 Jul 2012 21:15:05 +0000 (17:15 -0400)]
Don't try to trim "../" in join_path_components().

join_path_components() tried to remove leading ".." components from its
tail argument, but it was not nearly bright enough to do so correctly
unless the head argument was (a) absolute and (b) canonicalized.
Rather than try to fix that logic, let's just get rid of it: there is no
correctness reason to remove "..", and cosmetic concerns can be taken
care of by a subsequent canonicalize_path() call.  Per bug #6715 from
Greg Davidson.

Back-patch to all supported branches.  It appears that pre-9.2, this
function is only used with absolute paths as head arguments, which is why
we'd not noticed the breakage before.  However, third-party code might be
expecting this function to work in more general cases, so it seems wise
to back-patch.

In HEAD and 9.2, also make some minor cosmetic improvements to callers.

12 years agoRevert part of the previous patch that avoided using PLy_elog().
Heikki Linnakangas [Thu, 5 Jul 2012 20:40:25 +0000 (23:40 +0300)]
Revert part of the previous patch that avoided using PLy_elog().

That caused the plpython_unicode regression test to fail on SQL_ASCII
encoding, as evidenced by the buildfarm. The reason is that with the patch,
you don't get the detail in the error message that you got before. That
detail is actually very informative, so rather than just adjust the expected
output, let's revert that part of the patch for now to make the buildfarm
green again, and figure out some other way to avoid the recursion of
PLy_elog() that doesn't lose the detail.

12 years agoFix mapping of PostgreSQL encodings to Python encodings.
Heikki Linnakangas [Thu, 5 Jul 2012 18:45:24 +0000 (21:45 +0300)]
Fix mapping of PostgreSQL encodings to Python encodings.

Windows encodings, "win1252" and so forth, are named differently in Python,
like "cp1252". Also, if the PyUnicode_AsEncodedString() function call fails
for some reason, use a plain ereport(), not a PLy_elog(), to report that
error. That avoids recursion and crash, if PLy_elog() tries to call
PLyUnicode_Bytes() again.

This fixes bug reported by Asif Naeem. Backpatch down to 9.0, before that
plpython didn't even try these conversions.

Jan UrbaƄski, with minor comment improvements by me.

12 years agoRemove support for using wait3() in place of waitpid().
Tom Lane [Thu, 5 Jul 2012 18:00:40 +0000 (14:00 -0400)]
Remove support for using wait3() in place of waitpid().

All Unix-oid platforms that we currently support should have waitpid(),
since it's in V2 of the Single Unix Spec.  Our git history shows that
the wait3 code was added to support NextStep, which we officially dropped
support for as of 9.2.  So get rid of the configure test, and simplify the
macro spaghetti in reaper().  Per suggestion from Fujii Masao.

12 years agopg_upgrade: abstract out copying of files from old cluster to new
Alvaro Herrera [Thu, 5 Jul 2012 15:38:42 +0000 (11:38 -0400)]
pg_upgrade: abstract out copying of files from old cluster to new

Currently only pg_clog is copied, but some other directories could need
the same treatment as well, so create a subroutine to do it.

Extracted from my (somewhat larger) FOR KEY SHARE patch.

12 years agoFix function argument tab completion for schema-qualified or quoted function names
Magnus Hagander [Thu, 5 Jul 2012 12:03:49 +0000 (14:03 +0200)]
Fix function argument tab completion for schema-qualified or quoted function names

Dean Rasheed, reviewed by Josh Kupershmidt

12 years agoFix missing regex slash that caused perltidy to get confused on
Bruce Momjian [Thu, 5 Jul 2012 01:58:48 +0000 (21:58 -0400)]
Fix missing regex slash that caused perltidy to get confused on
copyright.pl.

Backpatch to 9.2.

12 years agoRun newly-configured perltidy script on Perl files.
Bruce Momjian [Thu, 5 Jul 2012 01:47:49 +0000 (21:47 -0400)]
Run newly-configured perltidy script on Perl files.

Run on HEAD and 9.2.

12 years agoReduce messages about implicit indexes and sequences to DEBUG1.
Robert Haas [Thu, 5 Jul 2012 00:34:24 +0000 (20:34 -0400)]
Reduce messages about implicit indexes and sequences to DEBUG1.

Per recent discussion on pgsql-hackers, these messages are too
chatty for most users.

12 years agoHave pg_dump in binary-upgrade mode properly drop user-created
Bruce Momjian [Wed, 4 Jul 2012 21:36:50 +0000 (17:36 -0400)]
Have pg_dump in binary-upgrade mode properly drop user-created
extensions that might exist in the new empty cluster databases, like
plpgsql.

Backpatch to 9.2.

12 years agoFix sample INSTR function to return 0 if third arg is 0.
Robert Haas [Wed, 4 Jul 2012 21:19:23 +0000 (17:19 -0400)]
Fix sample INSTR function to return 0 if third arg is 0.

Albe Laurenz, per a report by Greg Smith that our sample function
doesn't quite match Oracle's behavior.

12 years agoAdd wchar -> mb conversion routines.
Robert Haas [Wed, 4 Jul 2012 21:10:10 +0000 (17:10 -0400)]
Add wchar -> mb conversion routines.

This is infrastructure for Alexander Korotkov's work on indexing regular
expression searches.

Alexander Korotkov, with a bit of further hackery on the MULE conversion
by me

12 years agoMore doc cleanups for recent shared memory changes.
Robert Haas [Wed, 4 Jul 2012 19:57:48 +0000 (15:57 -0400)]
More doc cleanups for recent shared memory changes.

Josh Kupershmidt

12 years agoDocumentation cleanups for recent shared memory changes.
Robert Haas [Wed, 4 Jul 2012 19:56:12 +0000 (15:56 -0400)]
Documentation cleanups for recent shared memory changes.

12 years agoIncrease the maximum initdb-configured value for shared_buffers to 128MB.
Robert Haas [Wed, 4 Jul 2012 19:52:35 +0000 (15:52 -0400)]
Increase the maximum initdb-configured value for shared_buffers to 128MB.

The old value of 32MB has been around for a very long time, and in the
meantime typical system memories have become vastly larger.  Also, now
that we no longer depend on being able to fit the entirety of our
shared memory segment into the system's limit on System V shared
memory, there's a much better chance of the higher limit actually
proving productive.

Per recent discussion on pgsql-hackers.

12 years agoMake oid2name, pgbench, and vacuumlo set fallback_application_name.
Robert Haas [Wed, 4 Jul 2012 19:39:33 +0000 (15:39 -0400)]
Make oid2name, pgbench, and vacuumlo set fallback_application_name.

Amit Kapila, reviewed by Shigeru Hanada and Peter Eisentraut,
with some modifications by me.

12 years agoRemove duplicate, unnecessary, variable declaration
Magnus Hagander [Wed, 4 Jul 2012 14:16:54 +0000 (16:16 +0200)]
Remove duplicate, unnecessary, variable declaration

12 years agoSet the write location in the pg_receivexlog status messages
Magnus Hagander [Wed, 4 Jul 2012 13:13:09 +0000 (15:13 +0200)]
Set the write location in the pg_receivexlog status messages

This makes it possible for the master to track how much data has
actually been written my pg_receivexlog - and not just how much
has been sent towards it.

12 years agoAlways treat a standby returning an an invalid flush location as async
Magnus Hagander [Wed, 4 Jul 2012 13:10:46 +0000 (15:10 +0200)]
Always treat a standby returning an an invalid flush location as async

This ensures that a standby such as pg_receivexlog will not be selected
as sync standby - which would cause the master to block waiting for
a location that could never happen.

Fujii Masao

12 years agoRemove reference to default wal_buffers being 8
Magnus Hagander [Wed, 4 Jul 2012 07:22:21 +0000 (09:22 +0200)]
Remove reference to default wal_buffers being 8

This hasn't been true since 9.1, when the default was changed to -1.
Remove the reference completely, keeping the discussion of the parameter
and it's shared memory effects on the config page.

12 years agoRemove references to pgfoundry as recommended hosting platform
Magnus Hagander [Wed, 4 Jul 2012 06:59:35 +0000 (08:59 +0200)]
Remove references to pgfoundry as recommended hosting platform

pgfoundry is deprectaed and no longer accepting new projects,
so we really shouldn't be directing people there.

12 years agoRemove references to PostgreSQL bundled on Solaris
Magnus Hagander [Wed, 4 Jul 2012 06:58:31 +0000 (08:58 +0200)]
Remove references to PostgreSQL bundled on Solaris

Also remove special references to downloads off pgfoundry since they are
not correct - downloads are done through the main website.

12 years agoImprove documentation about MULE encoding.
Tom Lane [Wed, 4 Jul 2012 04:29:57 +0000 (00:29 -0400)]
Improve documentation about MULE encoding.

This commit improves the comments in pg_wchar.h and creates #define symbols
for some formerly hard-coded values.  No substantive code changes.

Tatsuo Ishii and Tom Lane

12 years agoForgot an #include in the previous patch :-(
Alvaro Herrera [Tue, 3 Jul 2012 20:40:15 +0000 (16:40 -0400)]
Forgot an #include in the previous patch :-(

12 years agoHave REASSIGN OWNED work on extensions, too
Alvaro Herrera [Tue, 3 Jul 2012 19:09:59 +0000 (15:09 -0400)]
Have REASSIGN OWNED work on extensions, too

Per bug #6593, REASSIGN OWNED fails when the affected role has created
an extension.  Even though the user related to the extension is not
nominally the owner, its OID appears on pg_shdepend and thus causes
problems when the user is to be dropped.

This commit adds code to change the "ownership" of the extension itself,
not of the contained objects.  This is fine because it's currently only
called from REASSIGN OWNED, which would also modify the ownership of the
contained objects.  However, this is not sufficient for a working ALTER
OWNER implementation extension.

Back-patch to 9.1, where extensions were introduced.

Bug #6593 reported by Emiliano Leporati.

12 years agoHave copyright tool mention that certain files should be updated in back branches.
Bruce Momjian [Tue, 3 Jul 2012 16:01:38 +0000 (12:01 -0400)]
Have copyright tool mention that certain files should be updated in back branches.

12 years agoRemove misleading hints about reducing the System V request size.
Robert Haas [Tue, 3 Jul 2012 14:07:47 +0000 (10:07 -0400)]
Remove misleading hints about reducing the System V request size.

Since the request size will now be ~48 bytes regardless of how
shared_buffers et. al. are set, much of this advice is no longer
relevant.

12 years agoFix a stupid bug I introduced into XLogFlush().
Robert Haas [Mon, 2 Jul 2012 19:33:59 +0000 (15:33 -0400)]
Fix a stupid bug I introduced into XLogFlush().

Commit f11e8be3e812cdbbc139c1b4e49141378b118dee broke this; it was right
in Peter's original patch, but I messed it up before committing.

12 years agoFix position of WalSndWakeupRequest call.
Robert Haas [Mon, 2 Jul 2012 18:43:10 +0000 (14:43 -0400)]
Fix position of WalSndWakeupRequest call.

This avoids discriminating against wal_sync_method = open_sync or
open_datasync.

Fujii Masao, reviewed by Andres Freund

12 years agoAssorted message style improvements
Peter Eisentraut [Mon, 2 Jul 2012 18:12:46 +0000 (21:12 +0300)]
Assorted message style improvements

12 years agoFix to_date's handling of year 519.
Tom Lane [Mon, 2 Jul 2012 15:35:21 +0000 (11:35 -0400)]
Fix to_date's handling of year 519.

A thinko in commit 029dfdf1157b6d837a7b7211cd35b00c6bcd767c caused the year
519 to be handled differently from either adjacent year, which was not the
intention AFAICS.  Report and diagnosis by Marc Cousin.

In passing, remove redundant re-tests of year value.

12 years agoWork a little harder on comments for walsender wakeup patch.
Robert Haas [Mon, 2 Jul 2012 15:28:53 +0000 (11:28 -0400)]
Work a little harder on comments for walsender wakeup patch.

Per gripe from Tom Lane.

12 years agoMake commit_delay much smarter.
Robert Haas [Mon, 2 Jul 2012 14:26:31 +0000 (10:26 -0400)]
Make commit_delay much smarter.

Instead of letting every backend participating in a group commit wait
independently, have the first one that becomes ready to flush WAL wait
for the configured delay, and let all the others wait just long enough
for that first process to complete its flush.  This greatly increases
the chances of being able to configure a commit_delay setting that
actually improves performance.

As a side consequence of this change, commit_delay now affects all WAL
flushes, rather than just commits.  There was some discussion on
pgsql-hackers about whether to rename the GUC to, say, wal_flush_delay,
but in the absence of consensus I am leaving it alone for now.

Peter Geoghegan, with some changes, mostly to the documentation, by me.

12 years agoMake walsender more responsive.
Robert Haas [Mon, 2 Jul 2012 13:36:34 +0000 (09:36 -0400)]
Make walsender more responsive.

Per testing by Andres Freund, this improves replication performance
and reduces replication latency and latency jitter.  I was a bit
concerned about moving more work into XLogInsert, but testing seems
to show that it's not a problem in practice.

Along the way, improve comments for WaitLatchOrSocket.

Andres Freund.  Review and stylistic cleanup by me.

12 years agoFix race condition in enum value comparisons.
Tom Lane [Sun, 1 Jul 2012 21:12:49 +0000 (17:12 -0400)]
Fix race condition in enum value comparisons.

When (re) loading the typcache comparison cache for an enum type's values,
use an up-to-date MVCC snapshot, not the transaction's existing snapshot.
This avoids problems if we encounter an enum OID that was created since our
transaction started.  Per report from Andres Freund and diagnosis by Robert
Haas.

To ensure this is safe even if enum comparison manages to get invoked
before we've set a transaction snapshot, tweak GetLatestSnapshot to
redirect to GetTransactionSnapshot instead of throwing error when
FirstSnapshotSet is false.  The existing uses of GetLatestSnapshot (in
ri_triggers.c) don't care since they couldn't be invoked except in a
transaction that's already done some work --- but it seems just conceivable
that this might not be true of enums, especially if we ever choose to use
enums in system catalogs.

Note that the comparable coding in enum_endpoint and enum_range_internal
remains GetTransactionSnapshot; this is perhaps debatable, but if we
changed it those functions would have to be marked volatile, which doesn't
seem attractive.

Back-patch to 9.1 where ALTER TYPE ADD VALUE was added.

12 years agoSuppress compiler warnings in readfuncs.c.
Tom Lane [Sun, 1 Jul 2012 02:27:49 +0000 (22:27 -0400)]
Suppress compiler warnings in readfuncs.c.

Commit 7357558fc8866e3a449aa9473c419b593d67b5b6 introduced "(void) token;"
into the READ_TEMP_LOCALS() macro, to suppress complaints from gcc 4.6
when the value of token was not used anywhere in a particular node-read
function.  However, this just moved the warning around: inspection of
buildfarm results shows that some compilers are now complaining that token
is being read before it's set.  Revert the READ_TEMP_LOCALS() macro change
and instead put "(void) token;" into READ_NODE_FIELD(), which is the
principal culprit for cases where the warning might occur.  In principle we
might need the same in READ_BITMAPSET_FIELD() and/or READ_LOCATION_FIELD(),
but it seems unlikely that a node would consist only of such fields, so
I'll leave them alone for now.

12 years agoRemove inappropriate semicolons after function definitions.
Tom Lane [Sat, 30 Jun 2012 21:29:39 +0000 (17:29 -0400)]
Remove inappropriate semicolons after function definitions.

Solaris Studio warns about this, and some compilers might think it's an
outright syntax error.

12 years agoDeclare AnonymousShmem pointer as "void *".
Tom Lane [Sat, 30 Jun 2012 21:19:46 +0000 (17:19 -0400)]
Declare AnonymousShmem pointer as "void *".

The original coding had it as "PGShmemHeader *", but that doesn't offer any
notational benefit because we don't dereference it.  And it was resulting
in compiler warnings on some platforms, notably buildfarm member
castoroides, where mmap() and munmap() are evidently declared to take and
return "char *".

12 years agoPrevent CREATE TABLE LIKE/INHERITS from (mis) copying whole-row Vars.
Tom Lane [Sat, 30 Jun 2012 20:43:50 +0000 (16:43 -0400)]
Prevent CREATE TABLE LIKE/INHERITS from (mis) copying whole-row Vars.

If a CHECK constraint or index definition contained a whole-row Var (that
is, "table.*"), an attempt to copy that definition via CREATE TABLE LIKE or
table inheritance produced incorrect results: the copied Var still claimed
to have the rowtype of the source table, rather than the created table.

For the LIKE case, it seems reasonable to just throw error for this
situation, since the point of LIKE is that the new table is not permanently
coupled to the old, so there's no reason to assume its rowtype will stay
compatible.  In the inheritance case, we should ideally allow such
constraints, but doing so will require nontrivial refactoring of CREATE
TABLE processing (because we'd need to know the OID of the new table's
rowtype before we adjust inherited CHECK constraints).  In view of the lack
of previous complaints, that doesn't seem worth the risk in a back-patched
bug fix, so just make it throw error for the inheritance case as well.

Along the way, replace change_varattnos_of_a_node() with a more robust
function map_variable_attnos(), which is capable of being extended to
handle insertion of ConvertRowtypeExpr whenever we get around to fixing
the inheritance case nicely, and in the meantime it returns a failure
indication to the caller so that a helpful message with some context can be
thrown.  Also, this code will do the right thing with subselects (if we
ever allow them in CHECK or indexes), and it range-checks varattnos before
using them to index into the map array.

Per report from Sergey Konoplev.  Back-patch to all supported branches.

12 years agoinitdb: Update check_need_password for new options
Peter Eisentraut [Sat, 30 Jun 2012 12:39:16 +0000 (15:39 +0300)]
initdb: Update check_need_password for new options

Change things so that something like initdb --auth-local=peer
--auth-host=md5 does not cause a "must specify a password" error,
like initdb -A md5 does.

12 years agoValidate xlog record header before enlarging the work area to store it.
Heikki Linnakangas [Sat, 30 Jun 2012 20:08:34 +0000 (23:08 +0300)]
Validate xlog record header before enlarging the work area to store it.

If the record header is garbled, we're now quite likely to notice it before
we try to make a bogus memory allocation and run out of memory. That can
still happen, if the xlog record is split across pages (we cannot verify
the record header until reading the next page in that scenario), but this
reduces the chances. An out-of-memory is treated as a corrupt record
anyway, so this isn't a correctness issue, just a case of giving a better
error message.

Per Amit Kapila's suggestion.

12 years agoFix confusion between "size" and "AnonymousShmemSize".
Tom Lane [Fri, 29 Jun 2012 19:12:10 +0000 (15:12 -0400)]
Fix confusion between "size" and "AnonymousShmemSize".

Noted by Andres Freund.  Also improve a couple of comments.

12 years agoInitialize shared memory copy of ckptXidEpoch correctly when not in recovery.
Heikki Linnakangas [Fri, 29 Jun 2012 16:19:29 +0000 (19:19 +0300)]
Initialize shared memory copy of ckptXidEpoch correctly when not in recovery.

This bug was introduced by commit 20d98ab6e4110087d1816cd105a40fcc8ce0a307,
so backpatch this to 9.0-9.2 like that one.

This fixes bug #6710, reported by Tarvi Pillessaar

12 years agoMake the pg_upgrade log files contain actual commands
Alvaro Herrera [Fri, 29 Jun 2012 03:27:00 +0000 (23:27 -0400)]
Make the pg_upgrade log files contain actual commands

Now the log file not only contains the output from commands executed by
system(), but also what command it was in the first place.  This
arrangement makes debugging a lot simpler.

12 years agoMake init-po and update-po recursive make targets
Peter Eisentraut [Fri, 29 Jun 2012 11:01:54 +0000 (14:01 +0300)]
Make init-po and update-po recursive make targets

This is for convenience, now that adding recursive targets is much
easier than it used to be when the NLS stuff was initially added.

12 years agoFix NOTIFY to cope with I/O problems, such as out-of-disk-space.
Tom Lane [Fri, 29 Jun 2012 04:51:34 +0000 (00:51 -0400)]
Fix NOTIFY to cope with I/O problems, such as out-of-disk-space.

The LISTEN/NOTIFY subsystem got confused if SimpleLruZeroPage failed,
which would typically happen as a result of a write() failure while
attempting to dump a dirty pg_notify page out of memory.  Subsequently,
all attempts to send more NOTIFY messages would fail with messages like
"Could not read from file "pg_notify/nnnn" at offset nnnnn: Success".
Only restarting the server would clear this condition.  Per reports from
Kevin Grittner and Christoph Berg.

Back-patch to 9.0, where the problem was introduced during the
LISTEN/NOTIFY rewrite.

12 years agopg_upgrade: fix off-by-one mistake in snprintf
Alvaro Herrera [Fri, 29 Jun 2012 03:37:27 +0000 (23:37 -0400)]
pg_upgrade: fix off-by-one mistake in snprintf

snprintf counts trailing NUL towards the char limit.  Failing to account
for that was causing an invalid value to be passed to pg_resetxlog -l,
aborting the upgrade process.

12 years agoProvide MAP_FAILED if sys/mman.h doesn't.
Tom Lane [Thu, 28 Jun 2012 18:18:31 +0000 (14:18 -0400)]
Provide MAP_FAILED if sys/mman.h doesn't.

On old HPUX this has to be #defined to -1.  It might be that other values
are required on other dinosaur systems, but we'll worry about that when
and if we get reports.

12 years agoUpdate outdated commit; xlp_rem_len field is in page header now.
Heikki Linnakangas [Thu, 28 Jun 2012 17:32:31 +0000 (20:32 +0300)]
Update outdated commit; xlp_rem_len field is in page header now.

Spotted by Amit Kapila

12 years agoFurther fix install program detection
Peter Eisentraut [Thu, 28 Jun 2012 17:05:36 +0000 (20:05 +0300)]
Further fix install program detection

The $(or) make function was introduced in GNU make 3.81, so the
previous coding didn't work in 3.80.  Write it differently, and
improve the variable naming to make more sense in the new coding.

12 years agoFix broken mmap failure-detection code, and improve error message.
Robert Haas [Thu, 28 Jun 2012 16:57:22 +0000 (12:57 -0400)]
Fix broken mmap failure-detection code, and improve error message.

Per an observation by Thom Brown that my previous commit made an
overly large shmem allocation crash the server, on Linux.

12 years agoDramatically reduce System V shared memory consumption.
Robert Haas [Thu, 28 Jun 2012 15:05:16 +0000 (11:05 -0400)]
Dramatically reduce System V shared memory consumption.

Except when compiling with EXEC_BACKEND, we'll now allocate only a tiny
amount of System V shared memory (as an interlock to protect the data
directory) and allocate the rest as anonymous shared memory via mmap.
This will hopefully spare most users the hassle of adjusting operating
system parameters before being able to start PostgreSQL with a
reasonable value for shared_buffers.

There are a bunch of documentation updates needed here, and we might
need to adjust some of the HINT messages related to shared memory as
well.  But it's not 100% clear how portable this is, so before we
write the documentation, let's give it a spin on the buildfarm and
see what turns red.

12 years agoAdd missing space in event_source GUC description.
Robert Haas [Thu, 28 Jun 2012 12:15:08 +0000 (08:15 -0400)]
Add missing space in event_source GUC description.

This has apparently been wrong since event_source was added.

Alexander Lakhin

12 years agoMake UtilityContainsQuery recurse until it finds a non-utility Query.
Tom Lane [Thu, 28 Jun 2012 03:18:30 +0000 (23:18 -0400)]
Make UtilityContainsQuery recurse until it finds a non-utility Query.

The callers of UtilityContainsQuery want it to return a non-utility Query
if it returns anything at all.  However, since we made CREATE TABLE
AS/SELECT INTO into a utility command instead of a variant of SELECT,
a command like "EXPLAIN SELECT INTO" results in two nested utility
statements.  So what we need UtilityContainsQuery to do is drill down
to the bottom non-utility Query.

I had thought of this possibility in setrefs.c, and fixed it there by
looping around the UtilityContainsQuery call; but overlooked that the call
sites in plancache.c have a similar issue.  In those cases it's
notationally inconvenient to provide an external loop, so let's redefine
UtilityContainsQuery as recursing down to a non-utility Query instead.

Noted by Rushabh Lathia.  This is a somewhat cleaned-up version of his
proposed patch.

12 years agoFix install program detection
Peter Eisentraut [Wed, 27 Jun 2012 18:21:18 +0000 (21:21 +0300)]
Fix install program detection

configure handles INSTALL as a substitution variable specially, and
apparently it gets confused when it's set to empty.  Use INSTALL_
instead as a workaround to avoid the issue.

12 years agoFix two more neglected comments, still referring to log/seg.
Heikki Linnakangas [Wed, 27 Jun 2012 16:11:26 +0000 (19:11 +0300)]
Fix two more neglected comments, still referring to log/seg.

Fujii Masao

12 years agoI neglected many comments in the log+seg -> 64-bit segno patch. Fix.
Heikki Linnakangas [Wed, 27 Jun 2012 14:53:53 +0000 (17:53 +0300)]
I neglected many comments in the log+seg -> 64-bit segno patch. Fix.

Reported by Amit Kapila.

12 years agoUpdate release notes for pg_terminate_backend changes.
Robert Haas [Wed, 27 Jun 2012 12:44:50 +0000 (08:44 -0400)]
Update release notes for pg_terminate_backend changes.

12 years agoUse system install program when available and usable
Peter Eisentraut [Wed, 27 Jun 2012 10:40:51 +0000 (13:40 +0300)]
Use system install program when available and usable

In a3176dac22c4cd14971e35119e245abee7649cb9 we switched to using
install-sh unconditionally, because the configure check
AC_PROG_INSTALL would pick up any random program named install, which
has caused failure reports
(http://archives.postgresql.org/pgsql-hackers/2001-03/msg00312.php).
Now the configure check is much improved and should avoid false
positives.  It has also been shown that using a system install program
can significantly reduce "make install" times, so it's worth trying.

12 years agoAllow pg_terminate_backend() to be used on backends with matching role.
Robert Haas [Tue, 26 Jun 2012 20:16:52 +0000 (16:16 -0400)]
Allow pg_terminate_backend() to be used on backends with matching role.

A similar change was made previously for pg_cancel_backend, so now it
all matches again.

Dan Farina, reviewed by Fujii Masao, Noah Misch, and Jeff Davis,
with slight kibitzing on the doc changes by me.

12 years agoWhen LWLOCK_STATS is defined, count spindelays.
Robert Haas [Tue, 26 Jun 2012 20:02:55 +0000 (16:02 -0400)]
When LWLOCK_STATS is defined, count spindelays.

When LWLOCK_STATS is *not* defined, the only change is that
SpinLockAcquire now returns the number of delays.

Patch by me, review by Jeff Janes.

12 years agoCope with smaller-than-normal BLCKSZ setting in SPGiST indexes on text.
Tom Lane [Tue, 26 Jun 2012 18:36:25 +0000 (14:36 -0400)]
Cope with smaller-than-normal BLCKSZ setting in SPGiST indexes on text.

The original coding failed miserably for BLCKSZ of 4K or less, as reported
by Josh Kupershmidt.  With the present design for text indexes, a given
inner tuple could have up to 256 labels (requiring either 3K or 4K bytes
depending on MAXALIGN), which means that we can't positively guarantee no
failures for smaller blocksizes.  But we can at least make it behave sanely
so long as there are few enough labels to fit on a page.  Considering that
btree is also more prone to "index tuple too large" failures when BLCKSZ is
small, it's not clear that we should expend more work than this on this
case.

12 years agoMake DROP FUNCTION hint more informative.
Robert Haas [Tue, 26 Jun 2012 17:33:23 +0000 (13:33 -0400)]
Make DROP FUNCTION hint more informative.

If you decide you want to take the hint, this gives you something you
can paste right back to the server.

Dean Rasheed

12 years agoReduce use of heavyweight locking inside hash AM.
Robert Haas [Tue, 26 Jun 2012 10:56:10 +0000 (06:56 -0400)]
Reduce use of heavyweight locking inside hash AM.

Avoid using LockPage(rel, 0, lockmode) to protect against changes to
the bucket mapping.  Instead, an exclusive buffer content lock is now
viewed as sufficient permission to modify the metapage, and a shared
buffer content lock is used when such modifications need to be
prevented.  This more relaxed locking regimen makes it possible that,
when we're busy getting a heavyweight bucket on the bucket we intend
to search or insert into, a bucket split might occur underneath us.
To compenate for that possibility, we use a loop-and-retry system:
release the metapage content lock, acquire the heavyweight lock on the
target bucket, and then reacquire the metapage content lock and check
that the bucket mapping has not changed.   Normally it hasn't, and
we're done.  But if by chance it has, we simply unlock the metapage,
release the heavyweight lock we acquired previously, lock the new
bucket, and loop around again.  Even in the worst case we cannot loop
very many times here, since we don't split the same bucket again until
we've split all the other buckets, and 2^N gets big pretty fast.

This results in greatly improved concurrency, because we're
effectively replacing two lwlock acquire-and-release cycles in
exclusive mode (on one of the lock manager locks) with a single
acquire-and-release cycle in shared mode (on the metapage buffer
content lock).  Testing shows that it's still not quite as good as
btree; for that, we'd probably have to find some way of getting rid
of the heavyweight bucket locks as well, which does not appear
straightforward.

Patch by me, review by Jeff Janes.

12 years agoFix pg_upgrade, broken by the xlogid/segno -> 64-bit int refactoring.
Heikki Linnakangas [Tue, 26 Jun 2012 04:35:57 +0000 (07:35 +0300)]
Fix pg_upgrade, broken by the xlogid/segno -> 64-bit int refactoring.

The xlogid + segno representation of a particular WAL segment doesn't make
much sense in pg_resetxlog anymore, now that we don't use that anywhere
else. Use the WAL filename instead, since that's a convenient way to name a
particular WAL segment.

I did this partially for pg_resetxlog in the original xlogid/segno -> uint64
patch, but I neglected pg_upgrade and the docs. This should now be more
complete.

12 years agoMake pg_dump emit more accurate dependency information.
Tom Lane [Tue, 26 Jun 2012 01:20:24 +0000 (21:20 -0400)]
Make pg_dump emit more accurate dependency information.

While pg_dump has included dependency information in archive-format output
ever since 7.3, it never made any large effort to ensure that that
information was actually useful.  In particular, in common situations where
dependency chains include objects that aren't separately emitted in the
dump, the dependencies shown for objects that were emitted would reference
the dump IDs of these un-dumped objects, leaving no clue about which other
objects the visible objects indirectly depend on.  So far, parallel
pg_restore has managed to avoid tripping over this misfeature, but only
by dint of some crude hacks like not trusting dependency information in
the pre-data section of the archive.

It seems prudent to do something about this before it rises up to bite us,
so instead of emitting the "raw" dependencies of each dumped object,
recursively search for its actual dependencies among the subset of objects
that are being dumped.

Back-patch to 9.2, since that code hasn't yet diverged materially from
HEAD.  At some point we might need to back-patch further, but right now
there are no known cases where this is actively necessary.  (The one known
case, bug #6699, is fixed in a different way by my previous patch.)  Since
this patch depends on 9.2 changes that made TOC entries be marked before
output commences as to whether they'll be dumped, back-patching further
would require additional surgery; and as of now there's no evidence that
it's worth the risk.

12 years agoImprove pg_dump's dependency-sorting logic to enforce section dump order.
Tom Lane [Tue, 26 Jun 2012 01:19:10 +0000 (21:19 -0400)]
Improve pg_dump's dependency-sorting logic to enforce section dump order.

As of 9.2, with the --section option, it is very important that the concept
of "pre data", "data", and "post data" sections of the output be honored
strictly; else a dump divided into separate sectional files might be
unrestorable.  However, the dependency-sorting logic knew nothing of
sections and would happily select output orderings that didn't fit that
structure.  Doing so was mostly harmless before 9.2, but now we need to be
sure it doesn't do that.  To fix, create dummy objects representing the
section boundaries and add dependencies between them and all the normal
objects.  (This might sound expensive but it seems to only add a percent or
two to pg_dump's runtime.)

This also fixes a problem introduced in 9.1 by the feature that allows
incomplete GROUP BY lists when a primary key is given in GROUP BY.
That means that views can depend on primary key constraints.  Previously,
pg_dump would deal with that by simply emitting the primary key constraint
before the view definition (and hence before the data section of the
output).  That's bad enough for simple serial restores, where creating an
index before the data is loaded works, but is undesirable for speed
reasons.  But it could lead to outright failure of parallel restores, as
seen in bug #6699 from Joe Van Dyk.  That happened because pg_restore would
switch into parallel mode as soon as it reached the constraint, and then
very possibly would try to emit the view definition before the primary key
was committed (as a consequence of another bug that causes the view not to
be correctly marked as depending on the constraint).  Adding the section
boundary constraints forces the dependency-sorting code to break the view
into separate table and rule declarations, allowing the rule, and hence the
primary key constraint it depends on, to revert to their intended location
in the post-data section.  This also somewhat accidentally works around the
bogus-dependency-marking problem, because the rule will be correctly shown
as depending on the constraint, so parallel pg_restore will now do the
right thing.  (We will fix the bogus-dependency problem for real in a
separate patch, but that patch is not easily back-portable to 9.1, so the
fact that this patch is enough to dodge the only known symptom is
fortunate.)

Back-patch to 9.1, except for the hunk that adds verification that the
finished archive TOC list is in correct section order; the place where
it was convenient to add that doesn't exist in 9.1.

12 years agoTighten up includes in sinvaladt.h, twophase.h, proc.h
Alvaro Herrera [Mon, 25 Jun 2012 21:45:15 +0000 (17:45 -0400)]
Tighten up includes in sinvaladt.h, twophase.h, proc.h

Remove proc.h from sinvaladt.h and twophase.h; also replace xlog.h in
proc.h with xlogdefs.h.

12 years agoUnify calling conventions for postgres/postmaster sub-main functions
Peter Eisentraut [Mon, 25 Jun 2012 18:25:26 +0000 (21:25 +0300)]
Unify calling conventions for postgres/postmaster sub-main functions

There was a wild mix of calling conventions: Some were declared to
return void and didn't return, some returned an int exit code, some
claimed to return an exit code, which the callers checked, but
actually never returned, and so on.

Now all of these functions are declared to return void and decorated
with attribute noreturn and don't return.  That's easiest, and most
code already worked that way.