1. 31 Mar, 2017 4 commits
  2. 30 Mar, 2017 8 commits
    • Tom Lane's avatar
      Fix broken markup. · ab1e6440
      Tom Lane authored
      Per buildfarm.
      ab1e6440
    • Simon Riggs's avatar
      Fix pgrowlocks minor coding oversight · ceb3158a
      Simon Riggs authored
      ceb3158a
    • Simon Riggs's avatar
      Default monitoring roles · 25fff407
      Simon Riggs authored
      Three nologin roles with non-overlapping privs are created by default
      * pg_read_all_settings - read all GUCs.
      * pg_read_all_stats - pg_stat_*, pg_database_size(), pg_tablespace_size()
      * pg_stat_scan_tables - may lock/scan tables
      
      Top level role - pg_monitor includes all of the above by default, plus others
      
      Author: Dave Page
      Reviewed-by: Stephen Frost, Robert Haas, Peter Eisentraut, Simon Riggs
      25fff407
    • Tom Lane's avatar
      Support \if ... \elif ... \else ... \endif in psql scripting. · e984ef58
      Tom Lane authored
      This patch adds nestable conditional blocks to psql.  The control
      structure feature per se is complete, but the boolean expressions
      understood by \if and \elif are pretty primitive; basically, after
      variable substitution and backtick expansion, the result has to be
      "true" or "false" or one of the other standard spellings of a boolean
      value.  But that's enough for many purposes, since you can always
      do the heavy lifting on the server side; and we can extend it later.
      
      Along the way, pay down some of the technical debt that had built up
      around psql/command.c:
      * Refactor exec_command() into a function per command, instead of
      being a 1500-line monstrosity.  This makes the file noticeably longer
      because of repetitive function header/trailer overhead, but it seems
      much more readable.
      * Teach psql_get_variable() and psqlscanslash.l to suppress variable
      substitution and backtick expansion on the basis of the conditional
      stack state, thereby allowing removal of the OT_NO_EVAL kluge.
      * Fix the no-doubt-once-expedient hack of sometimes silently substituting
      mainloop.c's previous_buf for query_buf when calling HandleSlashCmds.
      (It's a bit remarkable that commands like \r worked at all with that.)
      Recall of a previous query is now done explicitly in the slash commands
      where that should happen.
      
      Corey Huinker, reviewed by Fabien Coelho, further hacking by me
      
      Discussion: https://postgr.es/m/CADkLM=c94OSRTnat=LX0ivNq4pxDNeoomFfYvBKM5N_xfmLtAA@mail.gmail.com
      e984ef58
    • Andres Freund's avatar
      Try to fix xml docs build broken in 5ded4bd2. · ffae6733
      Andres Freund authored
      Apparently the sgml to xml conversion treats non-closed <para>s
      differently than jade does.
      ffae6733
    • Fujii Masao's avatar
      Simplify the example of VACUUM in documentation. · ec196930
      Fujii Masao authored
      Previously a detailed activity report by VACUUM VERBOSE ANALYZE was
      described as an example of VACUUM in docs. But it had been obsolete
      for a long time. For example, commit feb4f44d
      updated the content of that activity report in 2003, but we had
      forgotten to update the example.
      
      So basically we need to update the example. But since no one cared
      about the details of VACUUM output and complained about that mistake
      for such long time, per discussion on hackers, we decided to get rid
      of the detailed activity report from the example and simplify it.
      
      Back-patch to all supported versions.
      
      Reported by Masahiko Sawada, patch by me.
      Discussion: https://postgr.es/m/CAD21AoAGA2pB3p-CWmTkxBsbkZS1bcDGBLcYVcvcDxspG_XAfA@mail.gmail.com
      ec196930
    • Andres Freund's avatar
      Remove support for version-0 calling conventions. · 5ded4bd2
      Andres Freund authored
      The V0 convention is failure prone because we've so far assumed that a
      function is V0 if PG_FUNCTION_INFO_V1 is missing, leading to crashes
      if a function was coded against the V1 interface.  V0 doesn't allow
      proper NULL, SRF and toast handling.  V0 doesn't offer features that
      V1 doesn't.
      
      Thus remove V0 support and obsolete fmgr README contents relating to
      it.
      
      Author: Andres Freund, with contributions by Peter Eisentraut & Craig Ringer
      Reviewed-By: Peter Eisentraut, Craig Ringer
      Discussion: https://postgr.es/m/20161208213441.k3mbno4twhg2qf7g@alap3.anarazel.de
      5ded4bd2
    • Andres Freund's avatar
      Move contrib/seg to only use V1 calling conventions. · 389bb281
      Andres Freund authored
      A later commit will remove V0 support.
      
      Author: Andres Freund, with contributions by Craig Ringer
      Reviewed-By: Peter Eisentraut, Craig Ringer
      Discussion: https://postgr.es/m/20161208213441.k3mbno4twhg2qf7g@alap3.anarazel.de
      389bb281
  3. 29 Mar, 2017 12 commits
  4. 28 Mar, 2017 11 commits
    • Alvaro Herrera's avatar
      Allow DSM segments to be created as pinned · 767bc028
      Alvaro Herrera authored
      dsm_create and dsm_attach assumed that a current resource owner was
      always in place.  Exploration with the API show that this is
      inconvenient: sometimes one must create a dummy resowner, create/attach
      the DSM, only to pin the mapping later, which is wasteful.  Change
      create/attach so that if there is no current resowner, the dsm is
      effectively pinned right from the start.
      
      Discussion: https://postgr.es/m/20170324232710.32acsfsvjqfgc6ud@alvherre.pgsql
      Reviewed by Thomas Munro.
      767bc028
    • Tom Lane's avatar
      Make new expression eval code reject references to dropped columns. · 2c4debbd
      Tom Lane authored
      Formerly, a Var referencing an already-dropped column was allowed and would
      always produce a NULL value.  However, that behavior was implemented in
      slot_getattr which the new expression code doesn't use; thus there is now a
      risk of returning theoretically-deleted data.  We had regression test cases
      that purported to exercise this, but they failed to expose any problem,
      apparently because plpgsql filters the dropped column and produces an
      output tuple that has a NULL there already.
      
      Ideally the DROP or ALTER attempt in these test cases would get rejected
      due to dependency checks; but until that happens, let's modify the behavior
      so that we fail the query during executor start.  This was already true for
      the related case of a column having changed type underneath us, and there's
      no obvious reason why we need to be laxer for dropped columns.
      
      In passing, adjust the error messages in CheckVarSlotCompatibility to
      include the composite type name.  In the cases shown in the regression
      tests this is always just "record", but it should be more useful in
      actual stale-plan cases, where the slot tupdesc would be a table's
      tupdesc directly.
      
      Discussion: https://postgr.es/m/16803.1490723570@sss.pgh.pa.us
      2c4debbd
    • Alvaro Herrera's avatar
      Remove direct uses of ItemPointer.{ip_blkid,ip_posid} · ce96ce60
      Alvaro Herrera authored
      There are no functional changes here; this simply encapsulates knowledge
      of the ItemPointerData struct so that a future patch can change things
      without more breakage.
      
      All direct users of ip_blkid and ip_posid are changed to use existing
      macros ItemPointerGetBlockNumber and ItemPointerGetOffsetNumber
      respectively.  For callers where that's inappropriate (because they
      Assert that the itempointer is is valid-looking), add
      ItemPointerGetBlockNumberNoCheck and ItemPointerGetOffsetNumberNoCheck,
      which lack the assertion but are otherwise identical.
      
      Author: Pavan Deolasee
      Discussion: https://postgr.es/m/CABOikdNnFon4cJiL=h1mZH3bgUeU+sWHuU4Yr8AB=j3A2p1GiA@mail.gmail.com
      ce96ce60
    • Simon Riggs's avatar
      Correct grammar in error message · a99f7702
      Simon Riggs authored
      "could not generate" rather than "could not generation"
      from commit 818fd4a6
      a99f7702
    • Peter Eisentraut's avatar
      Fix ssl tests · 967a4b01
      Peter Eisentraut authored
      facde2a9 introduced a typo during
      rebasing.
      967a4b01
    • Tom Lane's avatar
      Suppress implicit-conversion warnings seen with newer clang versions. · 8cfeaecf
      Tom Lane authored
      We were assigning values near 255 through "char *" pointers.  On machines
      where char is signed, that's not entirely kosher, and it's reasonable
      for compilers to warn about it.
      
      A better solution would be to change the pointer type to "unsigned char *",
      but that would be vastly more invasive.  For the moment, let's just apply
      this simple backpatchable solution.
      
      Aleksander Alekseev
      
      Discussion: https://postgr.es/m/20170220141239.GD12278@e733.localdomain
      Discussion: https://postgr.es/m/2839.1490714708@sss.pgh.pa.us
      8cfeaecf
    • Teodor Sigaev's avatar
      Altering default privileges on schemas · ab89e465
      Teodor Sigaev authored
      Extend ALTER DEFAULT PRIVILEGES command to schemas.
      
      Author: Matheus Oliveira
      Reviewed-by: Petr Jelínek, Ashutosh Sharma
      
      https://commitfest.postgresql.org/13/887/
      ab89e465
    • Peter Eisentraut's avatar
      dblink: Fix error reporting · 85163641
      Peter Eisentraut authored
      The conname variable was not initialized in some code paths, resulting
      in error reports referring to the "unnamed" connection rather than the
      correct connection name.
      
      Author: Rushabh Lathia <rushabh.lathia@gmail.com>
      85163641
    • Simon Riggs's avatar
      Cleanup slots during drop database · ff539da3
      Simon Riggs authored
      Automatically drop all logical replication slots associated with a
      database when the database is dropped. Previously we threw an ERROR
      if a slot existed. Now we throw ERROR only if a slot is active in
      the database being dropped.
      
      Craig Ringer
      ff539da3
    • Peter Eisentraut's avatar
      Fix Perl code which had broken the Windows build · 4d33a7f2
      Peter Eisentraut authored
      The previous change wanted to avoid modifying $_ in grep, but the code
      just made the change in a local variable and then lost it.  Rewrite the
      code using a separate map and grep, which is clearer anyway.
      
      Author: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
      4d33a7f2
    • Tom Lane's avatar
      Show ignored constants as "$N" rather than "?" in pg_stat_statements. · a6f22e83
      Tom Lane authored
      The trouble with the original choice here is that "?" is a valid (and
      indeed used) operator name, so that you could end up with ambiguous
      statement texts like "SELECT ? ? ?".  With this patch, you instead
      see "SELECT $1 ? $2", which seems significantly more readable.
      The numbers used for this purpose begin after the last actual $N parameter
      in the particular query.  The conflict with external parameters has its own
      potential for confusion of course, but it was agreed to be an improvement
      over the previous behavior.
      
      Lukas Fittl
      
      Discussion: https://postgr.es/m/CAP53PkxeaCuwYmF-A4J5z2-qk5fYFo5_NH3gpXGJJBxv1DMwEw@mail.gmail.com
      a6f22e83
  5. 27 Mar, 2017 5 commits
    • Alvaro Herrera's avatar
      Fix uninitialized memory propagation mistakes · 6462238f
      Alvaro Herrera authored
      Valgrind complains that some uninitialized bytes are being passed around
      by the extended statistics code since commit 7b504eb2, as reported
      by Andres Freund.  Silence it.
      
      Tomas Vondra submitted a patch which he verified to fix the complaints
      in his machine; however I messed with it a bit before pushing, so any
      remaining problems are likely my (Álvaro's) fault.
      
      Author: Tomas Vondra
      Discussion: https://postgr.es/m/20170325211031.4xxoptigqxm2emn2@alap3.anarazel.de
      6462238f
    • Peter Eisentraut's avatar
      doc: Improve rendering of notes/cautions using XSL-FO · 6e31c3e1
      Peter Eisentraut authored
      Center title and put a border around it, like the output that the DSSSL
      version gave.
      6e31c3e1
    • Robert Haas's avatar
      Still more code review for single-page hash vacuuming. · c4c51541
      Robert Haas authored
      Most seriously, fix use of incorrect block ID, per a report from
      Jeff Janes that it causes a crash and a diagnosis from Amit Kapila.
      
      Improve consistency between the hash and btree versions of this
      code by adding back a PANIC that btree has, and by registering
      data in the xlog record in the same way, per complaints from
      Jeff Janes and Amit Kapila.
      
      Tidy up some minor cosmetic points, per complaints from Amit
      Kapila.
      
      Patch by Ashutosh Sharma, reviewed by Amit Kapila, and tested by
      Jeff Janes.
      
      Discussion: http://postgr.es/m/CAMkU=1w-9Qe=Ff1o6bSaXpNO9wqpo7_9GL8_CVhw4BoVVHasqg@mail.gmail.com
      c4c51541
    • Teodor Sigaev's avatar
      Fsync directory after creating or unlinking file. · 1b02be21
      Teodor Sigaev authored
      If file was created/deleted just before powerloss it's possible that
      file system will miss that. To prevent it, call fsync() where creating/
      unlinkg file is critical.
      
      Author: Michael Paquier
      Reviewed-by: Ashutosh Bapat, Takayuki Tsunakawa, me
      1b02be21
    • Alvaro Herrera's avatar
      Fix thinko in estimate_num_groups · 1f171a18
      Alvaro Herrera authored
      The code for the reworked n-distinct estimation on commit 7b504eb2 was
      written differently in a previous version of the patch, prior to commit;
      on rewriting it, we missed updating an initializer.  This caused the
      code to (mistakenly) apply a fudge factor even in the case where a
      single value is applied, leading to incorrect results.
      
      This means that the 'relvarcount' variable name is now wrong.  Add a
      comment to try and make the situation clearer, and remove an incorrect
      comment I added.
      
      Problem noticed, and code patch, by Tomas Vondra.  Additional commentary
      by Álvaro.
      1f171a18