1. 01 Apr, 2017 7 commits
    • Kevin Grittner's avatar
      Add infrastructure to support EphemeralNamedRelation references. · 18ce3a4a
      Kevin Grittner authored
      A QueryEnvironment concept is added, which allows new types of
      objects to be passed into queries from parsing on through
      execution.  At this point, the only thing implemented is a
      collection of EphemeralNamedRelation objects -- relations which
      can be referenced by name in queries, but do not exist in the
      catalogs.  The only type of ENR implemented is NamedTuplestore, but
      provision is made to add more types fairly easily.
      
      An ENR can carry its own TupleDesc or reference a relation in the
      catalogs by relid.
      
      Although these features can be used without SPI, convenience
      functions are added to SPI so that ENRs can easily be used by code
      run through SPI.
      
      The initial use of all this is going to be transition tables in
      AFTER triggers, but that will be added to each PL as a separate
      commit.
      
      An incidental effect of this patch is to produce a more informative
      error message if an attempt is made to modify the contents of a CTE
      from a referencing DML statement.  No tests previously covered that
      possibility, so one is added.
      
      Kevin Grittner and Thomas Munro
      Reviewed by Heikki Linnakangas, David Fetter, and Thomas Munro
      with valuable comments and suggestions from many others
      18ce3a4a
    • Robert Haas's avatar
      Avoid GatherMerge crash when there are no workers. · 25dc142a
      Robert Haas authored
      It's unnecessary to return an actual slot when we have no tuple.
      We can just return NULL, which avoids the risk of indexing into an
      array that might not contain any elements.
      
      Rushabh Lathia, per a report from Tomas Vondra
      
      Discussion: http://postgr.es/m/6ecd6f17-0dcf-1de7-ded8-0de7db1ddc88@2ndquadrant.com
      25dc142a
    • Robert Haas's avatar
      Fix parallel query so it doesn't spoil row estimates above Gather. · 7d8f6986
      Robert Haas authored
      Commit 45be99f8 removed GatherPath's
      num_workers field, but this is entirely bogus.  Normally, a path's
      parallel_workers flag is supposed to indicate the number of workers
      that it wants, and should be 0 for a non-partial path.  In that
      commit, I mistakenly thought that GatherPath could also use that field
      to indicate the number of workers that it would try to start, but
      that's disastrous, because then it can propagate up to higher nodes in
      the plan tree, which will then get incorrect rowcounts because the
      parallel_workers flag is involved in computing those values.  Repair
      by putting the separate field back.
      
      Report by Tomas Vondra.  Patch by me, reviewed by Amit Kapila.
      
      Discussion: http://postgr.es/m/f91b4a44-f739-04bd-c4b6-f135bd643669@2ndquadrant.com
      7d8f6986
    • Robert Haas's avatar
      Don't use bgw_main even to specify in-core bgworker entrypoints. · 2113ac4c
      Robert Haas authored
      On EXEC_BACKEND builds, this can fail if ASLR is in use.
      
      Backpatch to 9.5.  On master, completely remove the bgw_main field
      completely, since there is no situation in which it is safe for an
      EXEC_BACKEND build.  On 9.6 and 9.5, leave the field intact to avoid
      breaking things for third-party code that doesn't care about working
      under EXEC_BACKEND.  Prior to 9.5, there are no in-core bgworker
      entrypoints.
      
      Petr Jelinek, reviewed by me.
      
      Discussion: http://postgr.es/m/09d8ad33-4287-a09b-a77f-77f8761adb5e@2ndquadrant.com
      2113ac4c
    • Tom Lane's avatar
      Fix unstable regression test result. · c281cd5f
      Tom Lane authored
      Whoops, missed that same test was made for json as well as jsonb.
      c281cd5f
    • Tom Lane's avatar
      Fix unstable regression test result. · f1a285e2
      Tom Lane authored
      Commit e306df7f added a test case that depends on "the" being a
      stop word, which it is not in non-English locales.  Since the
      point of the test is to check stopword behavior, fix by forcibly
      selecting the 'english' configuration.
      
      Per buildfarm.
      f1a285e2
    • Robert Haas's avatar
      Fix typos. · 9a12ad04
      Robert Haas authored
      Brandur Leach
      9a12ad04
  2. 31 Mar, 2017 8 commits
  3. 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
  4. 29 Mar, 2017 12 commits
  5. 28 Mar, 2017 5 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