Skip to content
Snippets Groups Projects
  1. Oct 28, 2014
    • Tom Lane's avatar
      Remove obsolete commentary. · a00d468e
      Tom Lane authored
      Since we got rid of non-MVCC catalog scans, the fourth reason given for
      using a non-transactional update in index_update_stats() is obsolete.
      The other three are still good, so we're not going to change the code,
      but fix the comment.
      a00d468e
    • Heikki Linnakangas's avatar
      Remove unnecessary assignment. · 18f158ef
      Heikki Linnakangas authored
      Reported by MauMau.
      18f158ef
    • Noah Misch's avatar
      MinGW: Include .dll extension in .def file LIBRARY commands. · c0e19036
      Noah Misch authored
      Newer toolchains append the extension implicitly if missing, but
      buildfarm member narwhal (gcc 3.4.2, ld 2.15.91 20040904) does not.
      This affects most core libraries having an exports.txt file, namely
      libpq and the ECPG support libraries.  On Windows Server 2003, Windows
      API functions that load and unload DLLs internally will mistakenly
      unload a libpq whose DLL header reports "LIBPQ" instead of "LIBPQ.dll".
      When, subsequently, control would return to libpq, the backend crashes.
      Back-patch to 9.4, like commit 846e91e0.
      Before that commit, we used a different linking technique that yielded
      "libpq.dll" in the DLL header.
      
      Commit 53566fc0 worked around this by
      eliminating a call to a function that loads and unloads DLLs internally.
      That commit is no longer necessary for correctness, but its improving
      consistency with the MSVC build remains valid.
      c0e19036
  2. Oct 27, 2014
    • Robert Haas's avatar
      Add missing equals signs to pg_recvlogical documentation. · 7f609a10
      Robert Haas authored
      Michael Paquier
      7f609a10
    • Heikki Linnakangas's avatar
      Fix two bugs in tsquery @> operator. · 22926e00
      Heikki Linnakangas authored
      1. The comparison for matching terms used only the CRC to decide if there's
      a match. Two different terms with the same CRC gave a match.
      
      2. It assumed that if the second operand has more terms than the first, it's
      never a match. That assumption is bogus, because there can be duplicate
      terms in either operand.
      
      Rewrite the implementation in a way that doesn't have those bugs.
      
      Backpatch to all supported versions.
      22926e00
    • Bruce Momjian's avatar
      Add variable names to two LWLock C prototypes · a4da35a0
      Bruce Momjian authored
      Previously only the variable types appeared.
      a4da35a0
    • Tom Lane's avatar
      Avoid unportable strftime() behavior in pg_dump/pg_dumpall. · f455fcfd
      Tom Lane authored
      Commit ad5d46a4 thought that we could
      get around the known portability issues of strftime's %Z specifier by
      using %z instead.  However, that idea seems to have been innocent of
      any actual research, as it certainly missed the facts that
      (1) %z is not portable to pre-C99 systems, and
      (2) %z doesn't actually act differently from %Z on Windows anyway.
      
      Per failures on buildfarm member hamerkop.
      
      While at it, centralize the code defining what strftime format we
      want to use in pg_dump; three copies of that string seems a bit much.
      f455fcfd
    • Tom Lane's avatar
      Fix undersized result buffer in pset_quoted_string(). · 9711fa06
      Tom Lane authored
      The malloc request was 1 byte too small for the worst-case output.
      This seems relatively unlikely to cause any problems in practice,
      as the worst case only occurs if the input string contains no
      characters other than single-quote or newline, and even then
      malloc alignment padding would probably save the day.  But it's
      definitely a bug.
      
      David Rowley
      9711fa06
  3. Oct 26, 2014
    • Tom Lane's avatar
      Improve planning of btree index scans using ScalarArrayOpExpr quals. · a4523c5a
      Tom Lane authored
      Since we taught btree to handle ScalarArrayOpExpr quals natively (commit
      9e8da0f7), the planner has always included
      ScalarArrayOpExpr quals in index conditions if possible.  However, if the
      qual is for a non-first index column, this could result in an inferior plan
      because we can no longer take advantage of index ordering (cf. commit
      807a40c5).  It can be better to omit the
      ScalarArrayOpExpr qual from the index condition and let it be done as a
      filter, so that the output doesn't need to get sorted.  Indeed, this is
      true for the query introduced as a test case by the latter commit.
      
      To fix, restructure get_index_paths and build_index_paths so that we
      consider paths both with and without ScalarArrayOpExpr quals in non-first
      index columns.  Redesign the API of build_index_paths so that it reports
      what it found, saving useless second or third calls.
      
      Report and patch by Andrew Gierth (though rather heavily modified by me).
      Back-patch to 9.2 where this code was introduced, since the issue can
      result in significant performance regressions compared to plans produced
      by 9.1 and earlier.
      a4523c5a
    • Peter Eisentraut's avatar
      Fix TAP tests with Perl 5.12 · 17009fb9
      Peter Eisentraut authored
      Perl 5.12 ships with a somewhat broken version of Test::Simple, so skip
      the tests if that is found.
      
      The relevant fix is
      
          0.98  Wed, 23 Feb 2011 14:38:02 +1100
              Bug Fixes
              * subtest() should not fail if $? is non-zero. (Aaron Crane)
      17009fb9
    • Peter Eisentraut's avatar
      Fix TAP tests with Perl 5.8 · 5c3d830e
      Peter Eisentraut authored
      The prove program included in Perl 5.8 does not support the --ext
      option, so don't use that and use wildcards on the command line instead.
      
      Note that the tests will still all be skipped, because, for instance,
      the version of Test::More is too old, but at least the regular
      mechanisms for handling that will apply, instead of failing to call
      prove altogether.
      5c3d830e
  4. Oct 25, 2014
  5. Oct 24, 2014
  6. Oct 23, 2014
    • Tom Lane's avatar
      In type_sanity, check I/O functions of built-in types are not volatile. · 43ac12c6
      Tom Lane authored
      We have a project policy that I/O functions must not be volatile, as per
      commit aab353a6, but we weren't doing
      anything to enforce that.  In most usage the marking of the function
      doesn't matter as long as its behavior is sane --- but I/O casts can
      expose the marking as user-visible behavior, as per today's complaint
      from Joe Van Dyk about contrib/ltree.
      
      This test as such will only protect us against future errors in built-in
      data types.  To catch the same error in contrib or third-party types,
      perhaps we should make CREATE TYPE complain?  But that's a separate
      issue from enforcing the policy for built-in types.
      43ac12c6
    • Tom Lane's avatar
      Improve ispell dictionary's defenses against bad affix files. · b34d6f03
      Tom Lane authored
      Don't crash if an ispell dictionary definition contains flags but not
      any compound affixes.  (This isn't a security issue since only superusers
      can install affix files, but still it's a bad thing.)
      
      Also, be more careful about detecting whether an affix-file FLAG command
      is old-format (ispell) or new-format (myspell/hunspell).  And change the
      error message about mixed old-format and new-format commands into something
      intelligible.
      
      Per bug #11770 from Emre Hasegeli.  Back-patch to all supported branches.
      b34d6f03
    • Robert Haas's avatar
      Perform less setup work for AFTER triggers at transaction start. · 2781b4be
      Robert Haas authored
      Testing reveals that the memory allocation we do at transaction start
      has small but measurable overhead on simple transactions.  To cut
      down on that overhead, defer some of that work to the point when
      AFTER triggers are first used, thus avoiding it altogether if they
      never are.
      
      Patch by me.  Review by Andres Freund.
      2781b4be
    • Fujii Masao's avatar
      Remove the unused argument of PSQLexec(). · efbbbbc8
      Fujii Masao authored
      This commit simply removes the second argument of PSQLexec that was
      set to the same value everywhere. Comments and code blocks related
      to this parameter are removed.
      
      Noticed by Heikki Linnakangas, reviewed by Michael Paquier
      efbbbbc8
    • Robert Haas's avatar
      Add a function to get the authenticated user ID. · 5ac372fc
      Robert Haas authored
      Previously, this was not exposed outside of miscinit.c.  It is needed
      for the pending pg_background patch, and will also be needed for
      parallelism.  Without it, there's no way for a background worker to
      re-create the exact authentication environment that was present in the
      process that started it, which could lead to security exposures.
      5ac372fc
    • Fujii Masao's avatar
      Prevent the already-archived WAL file from being archived again. · c7371c4a
      Fujii Masao authored
      Previously the archive recovery always created .ready file for
      the last WAL file of the old timeline at the end of recovery even when
      it's restored from the archive and has .done file. That is, there was
      the case where the WAL file had both .ready and .done files.
      This caused the already-archived WAL file to be archived again.
      
      This commit prevents the archive recovery from creating .ready file
      for the last WAL file if it has .done file, in order to prevent it from
      being archived again.
      
      This bug was added when cascading replication feature was introduced,
      i.e., the commit 52861058.
      So, back-patch to 9.2, where cascading replication was added.
      
      Reviewed by Michael Paquier
      c7371c4a
    • Peter Eisentraut's avatar
      Minimize calls of pg_class_aclcheck to minimum necessary · e64d3c56
      Peter Eisentraut authored
      
      In a couple of code paths, pg_class_aclcheck is called in succession
      with multiple different modes set.  This patch combines those modes to
      have a single call of this function and reduce a bit process overhead
      for permission checking.
      
      Author: Michael Paquier <michael@otacoo.com>
      Reviewed-by: default avatarFabrízio de Royes Mello <fabriziomello@gmail.com>
      e64d3c56
    • Peter Eisentraut's avatar
      Add tests for sequence privileges · a5f7d581
      Peter Eisentraut authored
      a5f7d581
    • Tom Lane's avatar
      Ensure libpq reports a suitable error message on unexpected socket EOF. · 69fed5b2
      Tom Lane authored
      The EOF-detection logic in pqReadData was a bit confused about who should
      set up the error message in case the kernel gives us read-ready-but-no-data
      rather than ECONNRESET or some other explicit error condition.  Since the
      whole point of this situation is that the lower-level functions don't know
      there's anything wrong, pqReadData itself must set up the message.  But
      keep the assumption that if an errno was reported, a message was set up at
      lower levels.
      
      Per bug #11712 from Marko Tiikkaja.  It's been like this for a very long
      time, so back-patch to all supported branches.
      69fed5b2
  7. Oct 22, 2014
    • Michael Meskes's avatar
      Small code cleanup. · 2ae7811d
      Michael Meskes authored
      Declare static variable as static and external as extern.
      2ae7811d
    • Heikki Linnakangas's avatar
      Update comment. · 98b37437
      Heikki Linnakangas authored
      The _bt_tuplecompare() function mentioned in comment hasn't existed for a
      long time.
      
      Peter Geoghegan
      98b37437
    • Noah Misch's avatar
      MinGW: Use -static-libgcc when linking a DLL. · 284590e4
      Noah Misch authored
      When commit 846e91e0 switched the linker
      driver from dlltool/dllwrap to gcc, it became possible for linking to
      choose shared libgcc.  Backends having loaded a module dynamically
      linked to libgcc can exit abnormally, which the postmaster treats like a
      crash.  Resume use of static libgcc exclusively, like 9.3 and earlier.
      Back-patch to 9.4.
      284590e4
    • Noah Misch's avatar
      MinGW: Link with shell32.dll instead of shfolder.dll. · 53566fc0
      Noah Misch authored
      This improves consistency with the MSVC build.  On buildfarm member
      narwhal, since commit 846e91e0,
      shfolder.dll:SHGetFolderPath() crashes when dblink calls it by way of
      pqGetHomeDirectory().  Back-patch to 9.4, where that commit first
      appeared.  How it caused this regression remains a mystery.  This is a
      partial revert of commit 889f0381, which
      adopted shfolder.dll for Windows NT 4.0 compatibility.  PostgreSQL 8.2
      dropped support for that operating system.
      53566fc0
    • Tom Lane's avatar
      Update expected/sequence_1.out. · 31dd7fcd
      Tom Lane authored
      The last three updates to the sequence regression test have all forgotten
      to touch the alternate expected-output file.  Sigh.
      
      Michael Paquier
      31dd7fcd
  8. Oct 21, 2014
    • Peter Eisentraut's avatar
      Allow input format xxxx-xxxx-xxxx for macaddr type · 6f04368c
      Peter Eisentraut authored
      
      Author: Herwin Weststrate <herwin@quarantainenet.nl>
      Reviewed-by: default avatarAli Akbar <the.apaan@gmail.com>
      6f04368c
    • Peter Eisentraut's avatar
      doc: Check DocBook XML validity during the build · 5d93ce2d
      Peter Eisentraut authored
      
      Building the documentation with XSLT does not check the DTD, like a
      DSSSL build would.  One can often get away with having invalid XML, but
      the stylesheets might then create incorrect output, as they are not
      designed to handle that.  Therefore, check the validity of the XML
      against the DTD, using xmllint, during the build.
      
      Add xmllint detection to configure, and add some documentation.
      
      xmllint comes with libxml2, which is already in use, but it might be in
      a separate package, such as libxml2-utils on Debian.
      
      Reviewed-by: default avatarFabien COELHO <coelho@cri.ensmp.fr>
      5d93ce2d
    • Peter Eisentraut's avatar
      doc: Update Red Hat documentation tools information · f43afbca
      Peter Eisentraut authored
      The old text was written in ancient times when RPM packages could be
      shared more or less freely across a plethora of RPM-based Linux
      distributions.  This isn't really the case anymore, so just make this
      information more concrete for the Red Hat family.
      f43afbca
    • Peter Eisentraut's avatar
      doc: Update FreeBSD documentation tools information · f048e500
      Peter Eisentraut authored
      based on patch from Dag-Erling Smørgrav <des@des.no>
      f048e500
    • Andres Freund's avatar
      Don't duplicate log_checkpoint messages for both of restart and checkpoints. · 5e5b65f3
      Andres Freund authored
      The duplication originated in cdd46c76, where restartpoints were
      introduced.
      
      In LogCheckpointStart's case the duplication actually lead to the
      compiler's format string checking not to be effective because the
      format string wasn't constant.
      
      Arguably these messages shouldn't be elog(), but ereport() style
      messages. That'd even allow to translate the messages... But as
      there's more mistakes of that kind in surrounding code, it seems
      better to change that separately.
      5e5b65f3
    • Andres Freund's avatar
      Renumber CHECKPOINT_* flags. · 11abd6c9
      Andres Freund authored
      Commit 7dbb6069 added a new CHECKPOINT_FLUSH_ALL flag. As that
      commit needed to be backpatched I didn't change the numeric values of
      the existing flags as that could lead to nastly problems if any
      external code issued checkpoints. That's not a concern on master, so
      renumber them there.
      
      Also add a comment about CHECKPOINT_FLUSH_ALL above
      CreateCheckPoint().
      11abd6c9
  9. Oct 20, 2014
    • Andres Freund's avatar
      Flush unlogged table's buffers when copying or moving databases. · 7dbb6069
      Andres Freund authored
      CREATE DATABASE and ALTER DATABASE .. SET TABLESPACE copy the source
      database directory on the filesystem level. To ensure the on disk
      state is consistent they block out users of the affected database and
      force a checkpoint to flush out all data to disk. Unfortunately, up to
      now, that checkpoint didn't flush out dirty buffers from unlogged
      relations.
      
      That bug means there could be leftover dirty buffers in either the
      template database, or the database in its old location. Leading to
      problems when accessing relations in an inconsistent state; and to
      possible problems during shutdown in the SET TABLESPACE case because
      buffers belonging files that don't exist anymore are flushed.
      
      This was reported in bug #10675 by Maxim Boguk.
      
      Fix by Pavan Deolasee, modified somewhat by me. Reviewed by MauMau and
      Fujii Masao.
      
      Backpatch to 9.1 where unlogged tables were introduced.
      7dbb6069
Loading