Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Commits on Jul 3, 2015
  1. Add documentation and regression tests concerning rounding of numerics.

    Tom Lane authored
    Michael Paquier, reviewed by Fabien Coelho
  2. Add psql \ev and \sv commands for editing and showing view definitions.

    Tom Lane authored
    These are basically just like the \ef and \sf commands for functions.
    
    Petr Korobeinikov, reviewed by Jeevan Chalke, some changes by me
  3. @hlinnaka

    Remove thread-emulation support from pgbench.

    hlinnaka authored
    You can no longer use pgbench with multiple threads when compiled without
    --enable-thread-safety. That's an acceptable limitation these days; it
    still works fine with -j1, and all modern platforms support threads anyway.
    This makes future maintenance and development of the code easier.
    
    Fabien Coelho
  4. @hlinnaka

    Fix pgbench progress report behaviour when pgbench or a query gets st…

    hlinnaka authored
    …uck.
    
    There were two issues here. First, if a query got stuck so that it took
    e.g. 5 seconds, and progress interval was 1 second, no progress reports were
    printed until the query returned. Fix so that we wake up specifically to
    print the progress report. Secondly, if pgbench got stuck so that it would
    nevertheless not print a progress report on time, and enough time passes
    that it's already time to print the next progress report, just skip the one
    that was missed. Before this patch, it would print the missed one with 0 TPS
    immediately after the previous one.
    
    Fabien Coelho. Backpatch to 9.4, where progress reports were added.
  5. @hlinnaka
  6. Make WAL-related utilities handle .partial WAL files properly.

    Fujii Masao authored
    Commit de76884 changed an archive recovery so that the last WAL
    segment with old timeline was renamed with suffix .partial. It should
    have updated WAL-related utilities so that they can handle such
    .paritial WAL files, but we forgot that.
    
    This patch changes pg_archivecleanup so that it can clean up even
    archived WAL files with .partial suffix. Also it allows us to specify
    .partial WAL file name as the command-line argument "oldestkeptwalfile".
    
    This patch also changes pg_resetxlog so that it can remove .partial
    WAL files in pg_xlog directory.
    
    pg_xlogdump cannot handle .partial WAL files. Per discussion,
    we decided only to document that limitation instead of adding the fix.
    Because a user can easily work around the limitation (i.e., just remove
    .partial suffix from the file name) and the fix seems complicated for
    very narrow use case.
    
    Back-patch to 9.5 where the problem existed.
    
    Review by Michael Paquier.
    Discussion: http://www.postgresql.org/message-id/CAHGQGwGxMKnVHGgTfiig2Bt_2djec0in3-DLJmtg7+nEiidFdQ@mail.gmail.com
Commits on Jul 2, 2015
  1. Improve pg_restore's -t switch to match all types of relations.

    Tom Lane authored
    -t will now match views, foreign tables, materialized views, and sequences,
    not only plain tables.  This is more useful, and also more consistent with
    the behavior of pg_dump's -t switch, which has always matched all relation
    types.
    
    We're still not there on matching pg_dump's behavior entirely, so mention
    that in the docs.
    
    Craig Ringer, reviewed by Pavel Stehule
  2. Make numeric form of PG version number readily available in Makefiles.

    Tom Lane authored
    Expose PG_VERSION_NUM (e.g., "90600") as a Make variable; but for
    consistency with the other Make variables holding similar info,
    call the variable just VERSION_NUM not PG_VERSION_NUM.
    
    There was some discussion of making this value available as a pg_config
    value as well.  However, that would entail substantially more work than
    this two-line patch.  Given that there was not exactly universal consensus
    that we need this at all, let's just do a minimal amount of work for now.
    
    Michael Paquier, reviewed by Pavel Stehule
  3. Fix misuse of TextDatumGetCString().

    Tom Lane authored
    "TextDatumGetCString(PG_GETARG_TEXT_P(x))" is formally wrong: a text*
    is not a Datum.  Although this coding will accidentally fail to fail on
    all known platforms, it risks leaking memory if a detoast step is needed,
    unlike "TextDatumGetCString(PG_GETARG_DATUM(x))" which is what's used
    elsewhere.  Make pg_get_object_address() fall in line with other uses.
    
    Noted while reviewing two-arg current_setting() patch.
  4. Add an optional missing_ok argument to SQL function current_setting().

    Tom Lane authored
    This allows convenient checking for existence of a GUC from SQL, which is
    particularly useful when dealing with custom variables.
    
    David Christensen, reviewed by Jeevan Chalke
  5. @hlinnaka

    Remove obsolete heap_formtuple/modifytuple/deformtuple functions.

    hlinnaka authored
    These variants used the old-style 'n'/' ' NULL indicators. The new-style
    functions have been available since version 8.1. That should be long enough
    that if there is still any old external code using these functions, they
    can just switch to the new functions without worrying about backwards
    compatibility
    
    Peter Geoghegan
  6. @hlinnaka

    Remove "const" from convertTSFunction()'s return type.

    hlinnaka authored
    There's no particular reason to mark it as such. The other convert*
    functions have no const either.
  7. @hlinnaka

    Plug some trivial memory leaks in pg_dump and pg_upgrade.

    hlinnaka authored
    There's no point in trying to free every small allocation in these
    programs that are used in a one-shot fashion, but these ones seems like
    an improvement on readability grounds.
    
    Michael Paquier, per Coverity report.
  8. @jconway
  9. @hlinnaka

    Don't emit a spurious space at end of line in pg_dump of event triggers.

    hlinnaka authored
    Backpatch to 9.3 and above, where event triggers were added.
  10. @hlinnaka

    Use appendStringInfoString/Char et al where appropriate.

    hlinnaka authored
    Patch by David Rowley. Backpatch to 9.5, as some of the calls were new in
    9.5, and keeping the code in sync with master makes future backpatching
    easier.
  11. @hlinnaka

    Fix name of argument to pg_stat_file.

    hlinnaka authored
    It's called "missing_ok" in the docs and in the C code.
    
    I refrained from doing a catversion bump for this, because the name of an
    input argument is just documentation, it has no effect on any callers.
    
    Michael Paquier
  12. @adunstan

    Allow MSVC's contribcheck and modulescheck to run independently.

    adunstan authored
    These require a temp install to have been done, so we now make sure it
    is done before proceeding.
    
    Michael Paquier.
  13. Make use of xlog_internal.h's macros in WAL-related utilities.

    Fujii Masao authored
    Commit 179cdd0 added macros to check if a filename is a WAL segment
    or other such file. However there were still some instances of the
    strlen + strspn combination to check for that in WAL-related utilities
    like pg_archivecleanup. Those checks can be replaced with the macros.
    
    This patch makes use of the macros in those utilities and
    which would make the code a bit easier to read.
    
    Back-patch to 9.5.
    
    Michael Paquier
Commits on Jul 1, 2015
  1. Don't leave pg_hba and pg_ident data lying around in running backends.

    Tom Lane authored
    Free the contexts holding this data after we're done using it, by the
    expedient of attaching them to the PostmasterContext which we were
    already taking care to delete (and where, indeed, this data used to live
    before commits e5e2fc8 and 7c45e3a).  This saves a
    probably-usually-negligible amount of space per running backend.  It also
    avoids leaving potentially-security-sensitive data lying around in memory
    in processes that don't need it.  You'd have to be unusually paranoid to
    think that that amounts to a live security bug, so I've not gone so far as
    to forcibly zero the memory; but there surely isn't a good reason to keep
    this data around.
    
    Arguably this is a memory management bug in the aforementioned commits,
    but it doesn't seem important enough to back-patch.
  2. Make sampler_random_fract() actually obey its API contract.

    Tom Lane authored
    This function is documented to return a value in the range (0,1),
    which is what its predecessor anl_random_fract() did.  However, the
    new version depends on pg_erand48() which returns a value in [0,1).
    The possibility of returning zero creates hazards of division by zero
    or trying to compute log(0) at some call sites, and it might well
    break third-party modules using anl_random_fract() too.  So let's
    change it to never return zero.  Spotted by Coverity.
    
    Michael Paquier, cosmetically adjusted by me
  3. Make XLogFileCopy() look the same as in 9.4.

    Fujii Masao authored
    XLogFileCopy() was changed heavily in commit de76884. However it was
    partially reverted in commit 7abc685 and most of those changes to
    XLogFileCopy() were no longer needed. Then commit 7cbee7c removed
    those unnecessary code, but XLogFileCopy() looked different in master
    and 9.4 though the contents are almost the same.
    
    This patch makes XLogFileCopy() look the same in master and back-branches,
    which makes back-patching easier, per discussion on pgsql-hackers.
    Back-patch to 9.5.
    
    Discussion: 55760844.7090703@iki.fi
    
    Michael Paquier
Commits on Jun 30, 2015
  1. Stamp HEAD as 9.6devel.

    Tom Lane authored
    Let the hacking begin ...
  2. Remove useless check for NULL subexpression.

    Tom Lane authored
    Coverity rightly gripes that it's silly to have a test here when
    the adjacent ExecEvalExpr() would choke on a NULL expression pointer.
    
    Petr Jelinek
  3. @hlinnaka

    Add assertion to check the special size is sane before dereferencing it.

    hlinnaka authored
    This seems useful to catch errors of the sort I just fixed, where
    PageGetSpecialPointer is called before initializing the page.
  4. @hlinnaka

    Don't call PageGetSpecialPointer() on page until it's been initialized.

    hlinnaka authored
    After calling XLogInitBufferForRedo(), the page might be all-zeros if it was
    not in page cache already. btree_xlog_unlink_page initialized the page
    correctly, but it called PageGetSpecialPointer before initializing it, which
    would lead to a corrupt page at WAL replay, if the unlinked page is not in
    page cache.
    
    Backpatch to 9.4, the bug came with the rewrite of B-tree page deletion.
  5. In bttext_abbrev_convert, move pfree to the right place.

    Robert Haas authored
    Without this, we might access memory that's already been freed, or
    leak memory if in the C locale.
    
    Peter Geoghegan
Commits on Jun 29, 2015
  1. @hlinnaka

    Initialize GIN metapage correctly when replaying metapage-update WAL …

    hlinnaka authored
    …record.
    
    I broke this with my WAL format refactoring patch. Before that, the metapage
    was read from disk, and modified in-place regardless of the LSN. That was
    always a bit silly, as there's no need to read the old page version from
    disk disk when we're overwriting it anyway. So that was changed in 9.5, but
    I failed to add a GinInitPage call to initialize the page-headers correctly.
    Usually you wouldn't notice, because the metapage is already in the page
    cache and is not zeroed.
    
    One way to reproduce this is to perform a VACUUM on an already vacuumed
    table (so that the vacuum has no real work to do), immediately after a
    checkpoint, and then perform an immediate shutdown. After recovery, the
    page headers of the metapage will be incorrectly all-zeroes.
    
    Reported by Jeff Janes
  2. Stamp 9.5alpha1.

    Tom Lane authored
  3. Code + docs review for escaping of option values (commit 11a020e).

    Tom Lane authored
    Avoid memory leak from incorrect choice of how to free a StringInfo
    (resetStringInfo doesn't do it).  Now that pg_split_opts doesn't scribble
    on the optstr, mark that as "const" for clarity.  Attach the commentary in
    protocol.sgml to the right place, and add documentation about the
    user-visible effects of this change on postgres' -o option and libpq's
    PGOPTIONS option.
  4. @anarazel

    Replace ia64 S_UNLOCK compiler barrier with a full memory barrier.

    anarazel authored
    _Asm_sched_fence() is just a compiler barrier, not a memory barrier. But
    spinlock release on IA64 needs, at the very least, release
    semantics. Use a full barrier instead.
    
    This might be the cause for the occasional failures on buildfarm member
    anole.
    
    Discussion: 20150629101108.GB17640@alap3.anarazel.de
  5. @petere

    Translation updates

    petere authored
    Source-Git-URL: git://git.postgresql.org/git/pgtranslation/messages.git
    Source-Git-Hash: fb7e72f46cfafa1b5bfe4564d9686d63a1e6383f
  6. Run the C portions of guc-file.l through pgindent.

    Tom Lane authored
    Yeah, I know, pretty anal-retentive of me.  But we oughta find some
    way to automate this for the .y and .l files.
Commits on Jun 28, 2015
  1. Improve design and implementation of pg_file_settings view.

    Tom Lane authored
    As first committed, this view reported on the file contents as they were
    at the last SIGHUP event.  That's not as useful as reporting on the current
    contents, and what's more, it didn't work right on Windows unless the
    current session had serviced at least one SIGHUP.  Therefore, arrange to
    re-read the files when pg_show_all_settings() is called.  This requires
    only minor refactoring so that we can pass changeVal = false to
    set_config_option() so that it won't actually apply any changes locally.
    
    In addition, add error reporting so that errors that would prevent the
    configuration files from being loaded, or would prevent individual settings
    from being applied, are visible directly in the view.  This makes the view
    usable for pre-testing whether edits made in the config files will have the
    desired effect, before one actually issues a SIGHUP.
    
    I also added an "applied" column so that it's easy to identify entries that
    are superseded by later entries; this was the main use-case for the original
    design, but it seemed unnecessarily hard to use for that.
    
    Also fix a 9.4.1 regression that allowed multiple entries for a
    PGC_POSTMASTER variable to cause bogus complaints in the postmaster log.
    (The issue here was that commit bf007a2 unintentionally reverted
    3e3f659, which suppressed any duplicate entries within
    ParseConfigFp.  However, since the original coding of the pg_file_settings
    view depended on such suppression *not* happening, we couldn't have fixed
    this issue now without first doing something with pg_file_settings.
    Now we suppress duplicates by marking them "ignored" within
    ProcessConfigFileInternal, which doesn't hide them in the view.)
    
    Lesser changes include:
    
    Drive the view directly off the ConfigVariable list, instead of making a
    basically-equivalent second copy of the data.  There's no longer any need
    to hang onto the data permanently, anyway.
    
    Convert show_all_file_settings() to do its work in one call and return a
    tuplestore; this avoids risks associated with assuming that the GUC state
    will hold still over the course of query execution.  (I think there were
    probably latent bugs here, though you might need something like a cursor
    on the view to expose them.)
    
    Arrange to run SIGHUP processing in a short-lived memory context, to
    forestall process-lifespan memory leaks.  (There is one known leak in this
    code, in ProcessConfigDirectory; it seems minor enough to not be worth
    back-patching a specific fix for.)
    
    Remove mistaken assignment to ConfigFileLineno that caused line counting
    after an include_dir directive to be completely wrong.
    
    Add missed failure check in AlterSystemSetConfigFile().  We don't really
    expect ParseConfigFp() to fail, but that's not an excuse for not checking.
Something went wrong with that request. Please try again.