1. 06 Mar, 2017 15 commits
    • Stephen Frost's avatar
      pg_upgrade: Fix large object COMMENTS, SECURITY LABELS · ff992c07
      Stephen Frost authored
      When performing a pg_upgrade, we copy the files behind pg_largeobject
      and pg_largeobject_metadata, allowing us to avoid having to dump out and
      reload the actual data for large objects and their ACLs.
      
      Unfortunately, that isn't all of the information which can be associated
      with large objects.  Currently, we also support COMMENTs and SECURITY
      LABELs with large objects and these were being silently dropped during a
      pg_upgrade as pg_dump would skip everything having to do with a large
      object and pg_upgrade only copied the tables mentioned to the new
      cluster.
      
      As the file copies happen after the catalog dump and reload, we can't
      simply include the COMMENTs and SECURITY LABELs in pg_dump's binary-mode
      output but we also have to include the actual large object definition as
      well.  With the definition, comments, and security labels in the pg_dump
      output and the file copies performed by pg_upgrade, all of the data and
      metadata associated with large objects is able to be successfully pulled
      forward across a pg_upgrade.
      
      In 9.6 and master, we can simply adjust the dump bitmask to indicate
      which components we don't want.  In 9.5 and earlier, we have to put
      explciit checks in in dumpBlob() and dumpBlobs() to not include the ACL
      or the data when in binary-upgrade mode.
      
      Adjustments made to the privileges regression test to allow another test
      (large_object.sql) to be added which explicitly leaves a large object
      with a comment in place to provide coverage of that case with
      pg_upgrade.
      
      Back-patch to all supported branches.
      
      Discussion: https://postgr.es/m/20170221162655.GE9812@tamriel.snowman.net
      ff992c07
    • Tom Lane's avatar
      Avoid dangling pointer to relation name in RLS code path in DoCopy(). · a8df75b0
      Tom Lane authored
      With RLS active, "COPY tab TO ..." failed under -DRELCACHE_FORCE_RELEASE,
      and would sometimes fail without that, because it used the relation name
      directly from the relcache as part of the parsetree it's building.  That
      becomes a potentially-dangling pointer as soon as the relcache entry is
      closed, a bit further down.  Typical symptom if the relcache entry chanced
      to get cleared would be "relation does not exist" error with a garbage
      relation name, or possibly a core dump; but if you were really truly
      unlucky, the COPY might copy from the wrong table.
      
      Per report from Andrew Dunstan that regression tests fail with
      -DRELCACHE_FORCE_RELEASE.  The core tests now pass for me (but have
      not tried "make check-world" yet).
      
      Discussion: https://postgr.es/m/7b52f900-0579-cda9-ae2e-de5da17090e6@2ndQuadrant.com
      a8df75b0
    • Peter Eisentraut's avatar
      Combine several DROP variants into generic DropStmt · e6477a81
      Peter Eisentraut authored
      Combine DROP of FOREIGN DATA WRAPPER, SERVER, POLICY, RULE, and TRIGGER
      into generic DropStmt grammar.
      Reviewed-by: default avatarJim Nasby <Jim.Nasby@BlueTreble.com>
      Reviewed-by: default avatarMichael Paquier <michael.paquier@gmail.com>
      e6477a81
    • Peter Eisentraut's avatar
      Allow dropping multiple functions at once · 583f6c41
      Peter Eisentraut authored
      The generic drop support already supported dropping multiple objects of
      the same kind at once.  But the previous representation
      of function signatures across two grammar symbols and structure members
      made this cumbersome to do for functions, so it was not supported.  Now
      that function signatures are represented by a single structure, it's
      trivial to add this support.  Same for aggregates and operators.
      Reviewed-by: default avatarJim Nasby <Jim.Nasby@BlueTreble.com>
      Reviewed-by: default avatarMichael Paquier <michael.paquier@gmail.com>
      583f6c41
    • Peter Eisentraut's avatar
      Replace LookupFuncNameTypeNames() with LookupFuncWithArgs() · 2ca64c6f
      Peter Eisentraut authored
      The old function took function name and function argument list as
      separate arguments.  Now that all function signatures are passed around
      as ObjectWithArgs structs, this is no longer necessary and can be
      replaced by a function that takes ObjectWithArgs directly.  Similarly
      for aggregates and operators.
      Reviewed-by: default avatarJim Nasby <Jim.Nasby@BlueTreble.com>
      Reviewed-by: default avatarMichael Paquier <michael.paquier@gmail.com>
      2ca64c6f
    • Peter Eisentraut's avatar
      Remove objname/objargs split for referring to objects · 8b6d6cf8
      Peter Eisentraut authored
      In simpler times, it might have worked to refer to all kinds of objects
      by a list of name components and an optional argument list.  But this
      doesn't work for all objects, which has resulted in a collection of
      hacks to place various other nodes types into these fields, which have
      to be unpacked at the other end.  This makes it also weird to represent
      lists of such things in the grammar, because they would have to be lists
      of singleton lists, to make the unpacking work consistently.  The other
      problem is that keeping separate name and args fields makes it awkward
      to deal with lists of functions.
      
      Change that by dropping the objargs field and have objname, renamed to
      object, be a generic Node, which can then be flexibly assigned and
      managed using the normal Node mechanisms.  In many cases it will still
      be a List of names, in some cases it will be a string Value, for types
      it will be the existing Typename, for functions it will now use the
      existing ObjectWithArgs node type.  Some of the more obscure object
      types still use somewhat arbitrary nested lists.
      Reviewed-by: default avatarJim Nasby <Jim.Nasby@BlueTreble.com>
      Reviewed-by: default avatarMichael Paquier <michael.paquier@gmail.com>
      8b6d6cf8
    • Peter Eisentraut's avatar
      Add operator_with_argtypes grammar rule · 550214a4
      Peter Eisentraut authored
      This makes the handling of operators similar to that of functions and
      aggregates.
      
      Rename node FuncWithArgs to ObjectWithArgs, to reflect the expanded use.
      Reviewed-by: default avatarJim Nasby <Jim.Nasby@BlueTreble.com>
      Reviewed-by: default avatarMichael Paquier <michael.paquier@gmail.com>
      550214a4
    • Peter Eisentraut's avatar
      Use class_args field in opclass_drop · 63ebd377
      Peter Eisentraut authored
      This makes it consistent with the usage in opclass_item.
      Reviewed-by: default avatarJim Nasby <Jim.Nasby@BlueTreble.com>
      Reviewed-by: default avatarMichael Paquier <michael.paquier@gmail.com>
      63ebd377
    • Robert Haas's avatar
      Fix incorrect comments. · 12a2544c
      Robert Haas authored
      Commit 19dc233c introduced these
      comments.  Michael Paquier noticed that one of them had a typo, but
      a bigger problem is that they were not an accurate description of
      what the code was doing.
      
      Patch by me.
      12a2544c
    • Robert Haas's avatar
      Mark pg_start_backup and pg_stop_backup as parallel-restricted. · 9fe3c644
      Robert Haas authored
      They depend on backend-private state that will not be synchronized by
      the parallel machinery, so they should not be marked parallel-safe.
      This issue also exists in 9.6, but we obviously can't do anything
      about 9.6 clusters that already exist.  Possibly this could be
      back-patched so that future 9.6 clusters would come out OK, or
      possibly we should back-patch some other fix, but that would need more
      discussion.
      
      David Steele, reviewed by Michael Paquier
      
      Discussion: http://postgr.es/m/CA+TgmoYCWfO2UM-t=HUMFJyxJywLDiLL0nAJpx88LKtvBvNECw@mail.gmail.com
      9fe3c644
    • Robert Haas's avatar
      Fix user-after-free bug. · 7f6fa29f
      Robert Haas authored
      Introduced by commit aea5d298.
      
      Patch from Amit Kapila.  Issue discovered independently by Amit Kapila
      and Ashutosh Sharma.
      7f6fa29f
    • Peter Eisentraut's avatar
      Reorder the asynchronous libpq calls for replication connection · e434ad39
      Peter Eisentraut authored
      Per libpq documentation, the initial state must be
      PGRES_POLLING_WRITING.  Failing to do that appears to cause some issues
      on some Windows systems.
      
      From: Petr Jelinek <petr.jelinek@2ndquadrant.com>
      e434ad39
    • Simon Riggs's avatar
      Enhance docs for ALTER TABLE lock levels of storage parms · 6f3a13ff
      Simon Riggs authored
      As requested by Robert Haas
      6f3a13ff
    • Simon Riggs's avatar
      Reduce lock levels for table storage params related to planning · 21d4e2e2
      Simon Riggs authored
      The following parameters are now updateable with ShareUpdateExclusiveLock
      effective_io_concurrency
      parallel_workers
      seq_page_cost
      random_page_cost
      n_distinct
      n_distinct_inherited
      
      Simon Riggs and Fabrízio Mello
      21d4e2e2
    • Simon Riggs's avatar
      Allow partitioned tables to be dropped without CASCADE · 8b4d582d
      Simon Riggs authored
      Record partitioned table dependencies as DEPENDENCY_AUTO
      rather than DEPENDENCY_NORMAL, so that DROP TABLE just works.
      
      Remove all the tests for partitioned tables where earlier
      work had deliberately avoided using CASCADE.
      
      Amit Langote, reviewed by Ashutosh Bapat and myself
      8b4d582d
  2. 04 Mar, 2017 5 commits
  3. 03 Mar, 2017 10 commits
  4. 02 Mar, 2017 6 commits
  5. 01 Mar, 2017 4 commits