1. 16 Sep, 2017 3 commits
    • Tom Lane's avatar
      Fix SQL-spec incompatibilities in new transition table feature. · 0f79440f
      Tom Lane authored
      The standard says that all changes of the same kind (insert, update, or
      delete) caused in one table by a single SQL statement should be reported
      in a single transition table; and by that, they mean to include foreign key
      enforcement actions cascading from the statement's direct effects.  It's
      also reasonable to conclude that if the standard had wCTEs, they would say
      that effects of wCTEs applying to the same table as each other or the outer
      statement should be merged into one transition table.  We weren't doing it
      like that.
      
      Hence, arrange to merge tuples from multiple update actions into a single
      transition table as much as we can.  There is a problem, which is that if
      the firing of FK enforcement triggers and after-row triggers with
      transition tables is interspersed, we might need to report more tuples
      after some triggers have already seen the transition table.  It seems like
      a bad idea for the transition table to be mutable between trigger calls.
      There's no good way around this without a major redesign of the FK logic,
      so for now, resolve it by opening a new transition table each time this
      happens.
      
      Also, ensure that AFTER STATEMENT triggers fire just once per statement,
      or once per transition table when we're forced to make more than one.
      Previous versions of Postgres have allowed each FK enforcement query
      to cause an additional firing of the AFTER STATEMENT triggers for the
      referencing table, but that's certainly not per spec.  (We're still
      doing multiple firings of BEFORE STATEMENT triggers, though; is that
      something worth changing?)
      
      Also, forbid using transition tables with column-specific UPDATE triggers.
      The spec requires such transition tables to show only the tuples for which
      the UPDATE trigger would have fired, which means maintaining multiple
      transition tables or else somehow filtering the contents at readout.
      Maybe someday we'll bother to support that option, but it looks like a
      lot of trouble for a marginal feature.
      
      The transition tables are now managed by the AfterTriggers data structures,
      rather than being directly the responsibility of ModifyTable nodes.  This
      removes a subtransaction-lifespan memory leak introduced by my previous
      band-aid patch 3c435952.
      
      In passing, refactor the AfterTriggers data structures to reduce the
      management overhead for them, by using arrays of structs rather than
      several parallel arrays for per-query-level and per-subtransaction state.
      
      I failed to resist the temptation to do some copy-editing on the SGML
      docs about triggers, above and beyond merely documenting the effects
      of this patch.
      
      Back-patch to v10, because we don't want the semantics of transition
      tables to change post-release.
      
      Patch by me, with help and review from Thomas Munro.
      
      Discussion: https://postgr.es/m/20170909064853.25630.12825@wrigleys.postgresql.org
      0f79440f
    • Bruce Momjian's avatar
      docs: clarify pg_upgrade docs regarding standbys and rsync · 04b64b8d
      Bruce Momjian authored
      Document that rsync is an _optional_ way to upgrade standbys, suggest
      rsync option --dry-run, and mention a way of upgrading one standby from
      another using rsync.  Also clarify some instructions by specifying if
      they operate on the old or new clusters.
      
      Reported-by: Stephen Frost, Magnus Hagander
      
      Discussion: https://postgr.es/m/20170914191250.GB6595@momjian.us
      
      Backpatch-through: 9.5
      04b64b8d
    • Robert Haas's avatar
      After a MINVALUE/MAXVALUE bound, allow only more of the same. · 9361f6f5
      Robert Haas authored
      In the old syntax, which used UNBOUNDED, we had a similar restriction,
      but commit d363d42b, which changed the
      syntax, eliminated it.  Put it back.
      
      Patch by me, reviewed by Dean Rasheed.
      
      Discussion: http://postgr.es/m/CA+Tgmobs+pLPC27tS3gOpEAxAffHrq5w509cvkwTf9pF6cWYbg@mail.gmail.com
      9361f6f5
  2. 15 Sep, 2017 16 commits
  3. 14 Sep, 2017 11 commits
  4. 13 Sep, 2017 8 commits
    • Tom Lane's avatar
      Adjust unstable regression test case. · 76e134fe
      Tom Lane authored
      Test queries added by commit 69835bc8 are giving unexpected results
      on some smaller buildfarm critters.  I think probably the seqscan
      logic is kicking in to cause the scans to not start at the beginning
      of the table.  Add ORDER BY to make them be indexscans instead.
      
      Per buildfarm member chipmunk.
      76e134fe
    • Tom Lane's avatar
      Update contrib/seg for new scalarlesel/scalargesel selectivity functions. · 44ba2920
      Tom Lane authored
      I somehow missed this module in commit 7d08ce28.
      44ba2920
    • Tom Lane's avatar
      Distinguish selectivity of < from <= and > from >=. · 7d08ce28
      Tom Lane authored
      Historically, the selectivity functions have simply not distinguished
      < from <=, or > from >=, arguing that the fraction of the population that
      satisfies the "=" aspect can be considered to be vanishingly small, if the
      comparison value isn't any of the most-common-values for the variable.
      (If it is, the code path that executes the operator against each MCV will
      take care of things properly.)  But that isn't really true unless we're
      dealing with a continuum of variable values, and in practice we seldom are.
      If "x = const" would estimate a nonzero number of rows for a given const
      value, then it follows that we ought to estimate different numbers of rows
      for "x < const" and "x <= const", even if the const is not one of the MCVs.
      Handling this more honestly makes a significant difference in edge cases,
      such as the estimate for a tight range (x BETWEEN y AND z where y and z
      are close together).
      
      Hence, split scalarltsel into scalarltsel/scalarlesel, and similarly
      split scalargtsel into scalargtsel/scalargesel.  Adjust <= and >=
      operator definitions to reference the new selectivity functions.
      Improve the core ineq_histogram_selectivity() function to make a
      correction for equality.  (Along the way, I learned quite a bit about
      exactly why that function gives good answers, which I tried to memorialize
      in improved comments.)
      
      The corresponding join selectivity functions were, and remain, just stubs.
      But I chose to split them similarly, to avoid confusion and to prevent the
      need for doing this exercise again if someone ever makes them less stubby.
      
      In passing, change ineq_histogram_selectivity's clamp for extreme
      probability estimates so that it varies depending on the histogram
      size, instead of being hardwired at 0.0001.  With the default histogram
      size of 100 entries, you still get the old clamp value, but bigger
      histograms should allow us to put more faith in edge values.
      
      Tom Lane, reviewed by Aleksander Alekseev and Kuntal Ghosh
      
      Discussion: https://postgr.es/m/12232.1499140410@sss.pgh.pa.us
      7d08ce28
    • Peter Eisentraut's avatar
      doc: Remove incorrect SCRAM protocol documentation · 089880ba
      Peter Eisentraut authored
      The documentation claimed that one should send
      "pg_same_as_startup_message" as the user name in the SCRAM messages, but
      this did not match the actual implementation, so remove it.
      089880ba
    • Bruce Momjian's avatar
      docs: adjust "link mode" mention in pg_upgrade streaming steps · 82e367dd
      Bruce Momjian authored
      Backpatch-through: 9.5
      82e367dd
    • Bruce Momjian's avatar
      docs: improve pg_upgrade standby instructions · 9521ce4a
      Bruce Momjian authored
      This makes it clear that pg_upgrade standby upgrade instructions should
      only be used in link mode, adds examples, and explains how rsync works
      with links.
      
      Reported-by: Andreas Joseph Krogh
      
      Discussion: https://postgr.es/m/VisenaEmail.6c.c0e592c5af4ef0a2.15e785dcb61@tc7-visena
      
      Backpatch-through: 9.5
      9521ce4a
    • Peter Eisentraut's avatar
      Improve error message in WAL sender · 61975d6c
      Peter Eisentraut authored
      The previous error message when attempting to run a general SQL command
      in a physical replication WAL sender was a bit sloppy.
      Reported-by: default avatarFujii Masao <masao.fujii@gmail.com>
      61975d6c
    • Peter Eisentraut's avatar
      Define LDAP_NO_ATTRS if necessary. · 1a2fdc99
      Peter Eisentraut authored
      Commit 83aaac41 introduced the use of
      LDAP_NO_ATTRS to avoid requesting a dummy attribute when doing search+bind
      LDAP authentication.  It turns out that not all LDAP implementations define
      that macro, but its value is fixed by the protocol so we can define it
      ourselves if it's missing.
      
      Author: Thomas Munro
      Reported-By: Ashutosh Sharma
      Discussion: https://postgr.es/m/CAE9k0Pm6FKCfPCiAr26-L_SMGOA7dT_k0%2B3pEbB8%2B-oT39xRpw%40mail.gmail.com
      1a2fdc99
  5. 12 Sep, 2017 2 commits