1. 27 Jul, 2019 2 commits
  2. 26 Jul, 2019 8 commits
    • Alvaro Herrera's avatar
    • Tom Lane's avatar
      Tweak our special-case logic for the IANA "Factory" timezone. · 8ab66081
      Tom Lane authored
      pg_timezone_names() tries to avoid showing the "Factory" zone in
      the view, mainly because that has traditionally had a very long
      "abbreviation" such as "Local time zone must be set--see zic manual page",
      so that showing it messes up psql's formatting of the whole view.
      Since tzdb version 2016g, IANA instead uses the abbreviation "-00",
      which is sane enough that there's no reason to discriminate against it.
      
      On the other hand, it emerges that FreeBSD and possibly other packagers
      are so wedded to backwards compatibility that they hack the IANA data
      to keep the old spelling --- and not just that old spelling, but even
      older spellings that IANA used back in the stone age.  This caused the
      filter logic to fail to suppress "Factory" at all on such platforms,
      though the formatting problem is definitely real in that case.
      
      To solve both problems, get rid of the hard-wired assumption about
      exactly what Factory's abbreviation is, and instead reject abbreviations
      exceeding 31 characters.  This will allow Factory to appear in the view
      if and only if it's using the modern abbreviation.
      
      In passing, simplify the code we add to zic.c to support "zic -P"
      to remove its now-obsolete hacks to not print the Factory zone's
      abbreviation.  Unlike pg_timezone_names(), there's no reason for
      that code to support old/nonstandard timezone data.
      
      Since we generally prefer to keep timezone-related behavior the
      same in all branches, and since this is arguably a bug fix,
      back-patch to all supported branches.
      
      Discussion: https://postgr.es/m/3961.1564086915@sss.pgh.pa.us
      8ab66081
    • Tom Lane's avatar
      Avoid choosing "localtime" or "posixrules" as TimeZone during initdb. · 3754113f
      Tom Lane authored
      Some platforms create a file named "localtime" in the system
      timezone directory, making it a copy or link to the active time
      zone file.  If Postgres is built with --with-system-tzdata, initdb
      will see that file as an exact match to localtime(3)'s behavior,
      and it may decide that "localtime" is the most preferred spelling of
      the active zone.  That's a very bad choice though, because it's
      neither informative, nor portable, nor stable if someone changes
      the system timezone setting.  Extend the preference logic added by
      commit e3846a00 so that we will prefer any other zone file that
      matches localtime's behavior over "localtime".
      
      On the same logic, also discriminate against "posixrules", which
      is another not-really-a-zone file that is often present in the
      timezone directory.  (Since we install "posixrules" but not
      "localtime", this change can affect the behavior of Postgres
      with or without --with-system-tzdata.)
      
      Note that this change doesn't prevent anyone from choosing these
      pseudo-zones if they really want to (i.e., by setting TZ for initdb,
      or modifying the timezone GUC later on).  It just prevents initdb
      from preferring these zone names when there are multiple matches to
      localtime's behavior.
      
      Since we generally prefer to keep timezone-related behavior the
      same in all branches, and since this is arguably a bug fix,
      back-patch to all supported branches.
      
      Discussion: https://postgr.es/m/CADT4RqCCnj6FKLisvT8tTPfTP4azPhhDFJqDF1JfBbOH5w4oyQ@mail.gmail.com
      Discussion: https://postgr.es/m/27991.1560984458@sss.pgh.pa.us
      3754113f
    • Tom Lane's avatar
      Fix loss of fractional digits for large values in cash_numeric(). · b9d2c5c7
      Tom Lane authored
      Money values exceeding about 18 digits (depending on lc_monetary)
      could be inaccurately converted to numeric, due to select_div_scale()
      deciding it didn't need to compute any fractional digits.  Force
      its hand by setting the dscale of one division input to equal the
      number of fractional digits we need.
      
      In passing, rearrange the logic to not do useless work in locales
      where money values are considered integral.
      
      Per bug #15925 from Slawomir Chodnicki.  Back-patch to all supported
      branches.
      
      Discussion: https://postgr.es/m/15925-da9953e2674bb5c8@postgresql.org
      b9d2c5c7
    • Peter Eisentraut's avatar
      doc: Make libpq documentation navigable between functions · e829337d
      Peter Eisentraut authored
      Turn most mentions of libpq functions into links.  At id attributes to
      most libpq functions, where not existing yet, so that they can be
      linked to.  (In a handful of cases there were problems with the PDF
      processing toolchain, so those instances were not changed.)
      
      Author: Fabien COELHO <coelho@cri.ensmp.fr>
      Reviewed-by: default avatarPeter Eisentraut <peter.eisentraut@2ndquadrant.com>
      Discussion: https://www.postgresql.org/message-id/flat/alpine.DEB.2.21.1905121032330.27203@lancre
      e829337d
    • Peter Eisentraut's avatar
      doc: Fix some markup whitespace issues · f4100839
      Peter Eisentraut authored
      When making an xref to a varlistentry, the stylesheets use the first
      <term> as the link text.  In the cases fixed here, the <term> element
      contained extra whitespace that ended up being part of the link text,
      which looked strange in the output in some cases.  This whitespace is
      significant, so remove it since we don't want it.
      f4100839
    • Peter Eisentraut's avatar
    • Peter Eisentraut's avatar
      doc: Change libpq function ids to mixed case · d0f5d25b
      Peter Eisentraut authored
      The ids for linking to libpq functions were previously all lower-case.
      Change to mixed-case, matching the actual function name, for easier
      readability in the source.  The output isn't changed in a significant
      way, since the ids are converted to lower or upper case for file names
      and anchors.
      d0f5d25b
  3. 25 Jul, 2019 9 commits
    • Thomas Munro's avatar
      Fix LDAP test instability. · 27cd521e
      Thomas Munro authored
      After starting slapd, wait until it can accept a connection before
      beginning the real test work.  This avoids occasional test failures.
      Back-patch to 11, where the LDAP tests arrived.
      
      Author: Thomas Munro
      Reviewed-by: Michael Paquier
      Discussion: https://postgr.es/m/20190719033013.GI1859%40paquier.xyz
      27cd521e
    • Andres Freund's avatar
      Add missing (COSTS OFF) to EXPLAIN added in previous commit. · f63d9e68
      Andres Freund authored
      Backpatch: 12-, like the previous commit
      f63d9e68
    • Andres Freund's avatar
      Fix slot type handling for Agg nodes performing internal sorts. · af3deff3
      Andres Freund authored
      Since 15d8f831 we assert that - and since 7ef04e4d, 4da597ed
      rely on - the slot type for an expression's
      ecxt_{outer,inner,scan}tuple not changing, unless explicitly flagged
      as such. That allows to either skip deforming (for a virtual tuple
      slot) or optimize the code for JIT accelerated deforming
      appropriately (for other known slot types).
      
      This assumption was sometimes violated for grouping sets, when
      nodeAgg.c internally uses tuplesorts, and the child node doesn't
      return a TTSOpsMinimalTuple type slot. Detect that case, and flag that
      the outer slot might not be "fixed".
      
      It's probably worthwhile to optimize this further in the future, and
      more granularly determine whether the slot is fixed. As we already
      instantiate per-phase transition and equal expressions, we could
      cheaply set the slot type appropriately for each phase.  But that's a
      separate change from this bugfix.
      
      This commit does include a very minor optimization by avoiding to
      create a slot for handling tuplesorts, if no such sorts are
      performed. Previously we created that slot unnecessarily in the common
      case of computing all grouping sets via hashing. The code looked too
      confusing without that, as the conditions for needing a sort slot and
      flagging that the slot type isn't fixed, are the same.
      
      Reported-By: Ashutosh Sharma
      Author: Andres Freund
      Discussion: https://postgr.es/m/CAE9k0PmNaMD2oHTEAhRyxnxpaDaYkuBYkLa1dpOpn=RS0iS2AQ@mail.gmail.com
      Backpatch: 12-, where the bug was introduced in 15d8f831
      af3deff3
    • Tom Lane's avatar
      Fix syntax error in commit 20e99cdd. · cb9bb157
      Tom Lane authored
      Per buildfarm.
      cb9bb157
    • Tom Lane's avatar
      Fix failures to ignore \r when reading Windows-style newlines. · b654714f
      Tom Lane authored
      libpq failed to ignore Windows-style newlines in connection service files.
      This normally wasn't a problem on Windows itself, because fgets() would
      convert \r\n to just \n.  But if libpq were running inside a program that
      changes the default fopen mode to binary, it would see the \r's and think
      they were data.  In any case, it's project policy to ignore \r in text
      files unconditionally, because people sometimes try to use files with
      DOS-style newlines on Unix machines, where the C library won't hide that
      from us.
      
      Hence, adjust parseServiceFile() to ignore \r as well as \n at the end of
      the line.  In HEAD, go a little further and make it ignore all trailing
      whitespace, to match what it's always done with leading whitespace.
      
      In HEAD, also run around and fix up everyplace where we have
      newline-chomping code to make all those places look consistent and
      uniformly drop \r.  It is not clear whether any of those changes are
      fixing live bugs.  Most of the non-cosmetic changes are in places that
      are reading popen output, and the jury is still out as to whether popen
      on Windows can return \r\n.  (The Windows-specific code in pipe_read_line
      seems to think so, but our lack of support for this elsewhere suggests
      maybe it's not a problem in practice.)  Hence, I desisted from applying
      those changes to back branches, except in run_ssl_passphrase_command()
      which is new enough and little-tested enough that we'd probably not have
      heard about any problems there.
      
      Tom Lane and Michael Paquier, per bug #15827 from Jorge Gustavo Rocha.
      Back-patch the parseServiceFile() change to all supported branches,
      and the run_ssl_passphrase_command() change to v11 where that was added.
      
      Discussion: https://postgr.es/m/15827-e6ba53a3a7ed543c@postgresql.org
      b654714f
    • Andrew Dunstan's avatar
      Honor MSVC WindowsSDKVersion if set · 20e99cdd
      Andrew Dunstan authored
      Add a line to the project file setting the target SDK. Otherwise, in for
      example VS2017, if the default but optional 8.1 SDK is not installed the
      build will fail.
      
      Patch from Peifeng Qiu, slightly edited by me.
      
      Discussion: https://postgr.es/m/CABmtVJhw1boP_bd4=b3Qv5YnqEdL696NtHFi2ruiyQ6mFHkeQQ@mail.gmail.com
      
      Backpatch to all live branches.
      20e99cdd
    • Tom Lane's avatar
      Fix contrib/sepgsql test policy to work with latest SELinux releases. · f5a4ab23
      Tom Lane authored
      As of Fedora 30, it seems that the system-provided macros for setting
      up user privileges in SELinux policies don't grant the ability to read
      /etc/passwd, as they formerly did.  This restriction breaks psql
      (which tries to use getpwuid() to obtain the user name it's running
      under) and thereby the contrib/sepgsql regression test.  Add explicit
      specifications that we need the right to read /etc/passwd.
      
      Mike Palmiotto, per a report from me.  Back-patch to all supported
      branches.
      
      Discussion: https://postgr.es/m/23856.1563381159@sss.pgh.pa.us
      f5a4ab23
    • Peter Eisentraut's avatar
      doc: Fix typo · 35a34e62
      Peter Eisentraut authored
      35a34e62
    • Andres Freund's avatar
      Fix system column accesses in ON CONFLICT ... RETURNING. · ecbdd009
      Andres Freund authored
      After 277cb789 ON CONFLICT ... SET ... RETURNING failed with
      ERROR:  virtual tuple table slot does not have system attributes
      when taking the update path, as the slot used to insert into the
      table (and then process RETURNING) was defined to be a virtual slot in
      that commit. Virtual slots don't support system columns except for
      tableoid and ctid, as the other system columns are AM dependent.
      
      Fix that by using a slot of the table's type. Add tests for system
      column accesses in ON CONFLICT ...  RETURNING.
      
      Reported-By: Roby, bisected to the relevant commit by Jeff Janes
      Author: Andres Freund
      Discussion: https://postgr.es/m/73436355-6432-49B1-92ED-1FE4F7E7E100@finefun.com.au
      Backpatch: 12-, where the bug was introduced in 277cb789
      ecbdd009
  4. 24 Jul, 2019 7 commits
  5. 23 Jul, 2019 5 commits
  6. 22 Jul, 2019 7 commits
  7. 21 Jul, 2019 2 commits
    • David Rowley's avatar
      Adjust overly strict Assert · e1a0f6a9
      David Rowley authored
      3373c715 changed how we determine EquivalenceClasses for relations and
      added an Assert to ensure all relations mentioned in each EC's ec_relids
      was a RELOPT_BASEREL.  However, the join removal code may remove a LEFT
      JOIN and since it does not clean up EC members belonging to the removed
      relations it can leave RELOPT_DEADREL rels in ec_relids.
      
      Fix this by adjusting the Assert to allow RELOPT_DEADREL rels too.
      
      Reported-by: sqlsmith via Andreas Seltenreich
      Discussion: https://postgr.es/m/87y30r8sls.fsf@ansel.ydns.eu
      e1a0f6a9
    • Tom Lane's avatar
      Remove no-longer-helpful reliance on fixed-size local array. · 330cafdf
      Tom Lane authored
      Coverity complained about this code, apparently because it uses a local
      array of size FUNC_MAX_ARGS without a guard that the input argument list
      is no longer than that.  (Not sure why it complained today, since this
      code's been the same for a long time; possibly it re-analyzed everything
      the List API change touched?)
      
      Rather than add a guard, though, let's just get rid of the local array
      altogether.  It was only there to avoid list_nth() calls, and those are
      no longer expensive.
      330cafdf