1. 09 Jan, 2020 6 commits
    • Tom Lane's avatar
      Reconsider the representation of join alias Vars. · 9ce77d75
      Tom Lane authored
      The core idea of this patch is to make the parser generate join alias
      Vars (that is, ones with varno pointing to a JOIN RTE) only when the
      alias Var is actually different from any raw join input, that is a type
      coercion and/or COALESCE is necessary to generate the join output value.
      Otherwise just generate varno/varattno pointing to the relevant join
      input column.
      
      In effect, this means that the planner's flatten_join_alias_vars()
      transformation is already done in the parser, for all cases except
      (a) columns that are merged by JOIN USING and are transformed in the
      process, and (b) whole-row join Vars.  In principle that would allow
      us to skip doing flatten_join_alias_vars() in many more queries than
      we do now, but we don't have quite enough infrastructure to know that
      we can do so --- in particular there's no cheap way to know whether
      there are any whole-row join Vars.  I'm not sure if it's worth the
      trouble to add a Query-level flag for that, and in any case it seems
      like fit material for a separate patch.  But even without skipping the
      work entirely, this should make flatten_join_alias_vars() faster,
      particularly where there are nested joins that it previously had to
      flatten recursively.
      
      An essential part of this change is to replace Var nodes'
      varnoold/varoattno fields with varnosyn/varattnosyn, which have
      considerably more tightly-defined meanings than the old fields: when
      they differ from varno/varattno, they identify the Var's position in
      an aliased JOIN RTE, and the join alias is what ruleutils.c should
      print for the Var.  This is necessary because the varno change
      destroyed ruleutils.c's ability to find the JOIN RTE from the Var's
      varno.
      
      Another way in which this change broke ruleutils.c is that it's no
      longer feasible to determine, from a JOIN RTE's joinaliasvars list,
      which join columns correspond to which columns of the join's immediate
      input relations.  (If those are sub-joins, the joinaliasvars entries
      may point to columns of their base relations, not the sub-joins.)
      But that was a horrid mess requiring a lot of fragile assumptions
      already, so let's just bite the bullet and add some more JOIN RTE
      fields to make it more straightforward to figure that out.  I added
      two integer-List fields containing the relevant column numbers from
      the left and right input rels, plus a count of how many merged columns
      there are.
      
      This patch depends on the ParseNamespaceColumn infrastructure that
      I added in commit 5815696b.  The biggest bit of code change is
      restructuring transformFromClauseItem's handling of JOINs so that
      the ParseNamespaceColumn data is propagated upward correctly.
      
      Other than that and the ruleutils fixes, everything pretty much
      just works, though some processing is now inessential.  I grabbed
      two pieces of low-hanging fruit in that line:
      
      1. In find_expr_references, we don't need to recurse into join alias
      Vars anymore.  There aren't any except for references to merged USING
      columns, which are more properly handled when we scan the join's RTE.
      This change actually fixes an edge-case issue: we will now record a
      dependency on any type-coercion function present in a USING column's
      joinaliasvar, even if that join column has no references in the query
      text.  The odds of the missing dependency causing a problem seem quite
      small: you'd have to posit somebody dropping an implicit cast between
      two data types, without removing the types themselves, and then having
      a stored rule containing a whole-row Var for a join whose USING merge
      depends on that cast.  So I don't feel a great need to change this in
      the back branches.  But in theory this way is more correct.
      
      2. markRTEForSelectPriv and markTargetListOrigin don't need to recurse
      into join alias Vars either, because the cases they care about don't
      apply to alias Vars for USING columns that are semantically distinct
      from the underlying columns.  This removes the only case in which
      markVarForSelectPriv could be called with NULL for the RTE, so adjust
      the comments to describe that hack as being strictly internal to
      markRTEForSelectPriv.
      
      catversion bump required due to changes in stored rules.
      
      Discussion: https://postgr.es/m/7115.1577986646@sss.pgh.pa.us
      9ce77d75
    • Robert Haas's avatar
      Add pg_shmem_allocations view. · ed10f32e
      Robert Haas authored
      This tells you about allocations that have been made from the main
      shared memory segment. The original patch also tried to show information
      about dynamic shared memory allocation as well, but I decided to
      leave that problem for another time.
      
      Andres Freund and Robert Haas, reviewed by Michael Paquier, Marti
      Raudsepp, Tom Lane, Álvaro Herrera, and Kyotaro Horiguchi.
      
      Discussion: http://postgr.es/m/20140504114417.GM12715@awork2.anarazel.de
      ed10f32e
    • Robert Haas's avatar
      Remove bogus 'return'. · 5acf6d8b
      Robert Haas authored
      Per the buildfarm, via Michael Paquier.
      
      Discussion: http://postgr.es/m/20200108032648.GE3413@paquier.xyz
      5acf6d8b
    • Magnus Hagander's avatar
      Clarify that pg_trgm is used in example · e3019f63
      Magnus Hagander authored
      Reported-by: Octopus ZHANG
      Author: Daniel Gustafsson
      e3019f63
    • Peter Eisentraut's avatar
      Add support for automatically updating Unicode derived files · f85a485f
      Peter Eisentraut authored
      We currently have several sets of files generated from data provided
      by Unicode.  These all have ad hoc rules and instructions for updating
      when new Unicode versions appear, and it's not done consistently.
      
      This patch centralizes and automates the process and makes it part of
      the release checklist.  The Unicode and CLDR versions are specified in
      Makefile.global.in.  There is a new make target "update-unicode" that
      downloads all the relevant files and runs the generation script.
      
      There is also a new script for generating the table of combining
      characters for ucs_wcwidth().  That table is now in a separate include
      file rather than hardcoded into the middle of other code.  This is
      based on the script that was used for generating
      d8594d12, but the script itself wasn't
      committed at that time.
      Reviewed-by: default avatarJohn Naylor <john.naylor@2ndquadrant.com>
      Discussion: https://www.postgresql.org/message-id/flat/c8d05f42-443e-6c23-819b-05b31759a37c@2ndquadrant.com
      f85a485f
    • Andrew Dunstan's avatar
      Allow 'sslkey' and 'sslcert' in postgres_fdw user mappings · f5fd995a
      Andrew Dunstan authored
      This allows different users to authenticate with different certificates.
      
      Author: Craig Ringer
      f5fd995a
  2. 08 Jan, 2020 9 commits
  3. 07 Jan, 2020 5 commits
  4. 06 Jan, 2020 5 commits
  5. 05 Jan, 2020 3 commits
  6. 04 Jan, 2020 5 commits
  7. 03 Jan, 2020 7 commits
    • Peter Geoghegan's avatar
      Add xl_btree_delete optimization. · d2e5e20e
      Peter Geoghegan authored
      Commit 558a9165 taught _bt_delitems_delete() to produce its own XID
      horizon on the primary.  Standbys no longer needed to generate their own
      latestRemovedXid, since they could just use the explicitly logged value
      from the primary instead.  The deleted offset numbers array from the
      xl_btree_delete WAL record was no longer used by the REDO routine for
      anything other than deleting the items.
      
      This enables a minor optimization:  We now treat the array as buffer
      state, not generic WAL data, following _bt_delitems_vacuum()'s example.
      This should be a minor win, since it allows us to avoid including the
      deleted items array in cases where XLogInsert() stores the whole buffer
      anyway.  The primary goal here is to make the code more maintainable,
      though.  Removing inessential differences between the two functions
      highlights the fundamental differences that remain.
      
      Also change xl_btree_delete to use uint32 for the size of the array of
      item offsets being deleted.  This brings xl_btree_delete closer to
      xl_btree_vacuum.  Furthermore, it seems like a good idea to use an
      explicit-width integer type (the field was previously an "int").
      
      Bump XLOG_PAGE_MAGIC because xl_btree_delete changed.
      
      Discussion: https://postgr.es/m/CAH2-Wzkz4TjmezzfAbaV1zYrh=fr0bCpzuJTvBe5iUQ3aUPsCQ@mail.gmail.com
      d2e5e20e
    • Tom Lane's avatar
      Further fixes for tab-completion TAP tests. · 56a3921a
      Tom Lane authored
      Escape non-printable characters in failure reports, by using Data::Dumper
      in Useqq mode.  Also, bump $Test::Builder::Level so the diagnostic
      references the calling line, and use diag() instad of note(),
      so it shows even in non-verbose mode (per request from Christoph Berg).
      
      Also, give up on trying to test for the specific way that readline
      chooses to overwrite existing text in the \DRD -> \drds test.
      There are too many variants, it seems, at least on the libedit
      side of things.
      
      Dagfinn Ilmari Mannsåker and Tom Lane
      
      Discussion: https://postgr.es/m/20200103110128.GA28967@msg.df7cb.de
      56a3921a
    • Tom Lane's avatar
      Add an ugly workaround for a bug in some recent libedit versions. · ddd87d56
      Tom Lane authored
      Debian unstable is shipping a broken version of libedit: it de-escapes
      words before passing them to the application's tab completion function,
      preventing us from recognizing backslash commands.  Fortunately,
      we have enough information available to dig the original text out of
      rl_line_buffer, so ignore the string argument and do that.
      
      I view this as a temporary workaround to get the affected buildfarm
      members back to green in the wake of 7c015045.  I hope we can get
      rid of it once somebody fixes Debian's libedit; hence, no back-patch,
      at least for now.
      
      Discussion: https://postgr.es/m/20200103110128.GA28967@msg.df7cb.de
      ddd87d56
    • Peter Eisentraut's avatar
      pgbench: Improve test description · 04334fde
      Peter Eisentraut authored
      Author: Fabien COELHO <coelho@cri.ensmp.fr>
      04334fde
    • Amit Kapila's avatar
      Fix typos in parallel query docs. · d5b6b651
      Amit Kapila authored
      Reported-by: Jon Jensen
      Author: Jon Jensen
      Reviewed-by: Amit Kapila and Robert Haas
      Backpatch-through: 10
      Discussion: https://postgr.es/m/nycvar.YSQ.7.76.1912301807510.9899@ybpnyubfg
      d5b6b651
    • Peter Geoghegan's avatar
      Clear up btree_xlog_split() alignment comment. · 0c41c83d
      Peter Geoghegan authored
      Adjust a comment that describes how alignment of the new left page high
      key works in btree_xlog_split(), the nbtree page split REDO routine.
      The wording used before commit 2c03216d is much clearer, so go back
      to that.
      0c41c83d
    • Tom Lane's avatar
      Minor portability fixes for new TAP script. · 90d7f660
      Tom Lane authored
      Satisfy perlcritic, mostly.  Per buildfarm.
      90d7f660