Skip to content
Snippets Groups Projects
  1. Oct 24, 2014
  2. Oct 23, 2014
    • Fujii Masao's avatar
      Remove the unused argument of PSQLexec(). · efbbbbc8
      Fujii Masao authored
      This commit simply removes the second argument of PSQLexec that was
      set to the same value everywhere. Comments and code blocks related
      to this parameter are removed.
      
      Noticed by Heikki Linnakangas, reviewed by Michael Paquier
      efbbbbc8
  3. Oct 20, 2014
  4. Oct 19, 2014
  5. Oct 17, 2014
    • Fujii Masao's avatar
      Fix bug in handling of connections that pg_receivexlog creates. · 504c7175
      Fujii Masao authored
      Previously pg_receivexlog created new connection for WAL streaming
      even though another connection which had been established to create
      or delete the replication slot was being left. This caused the unused
      connection to be left uselessly until pg_receivexlog exited.
      This bug was introduced by the commit d9f38c7a.
      
      This patch changes pg_receivexlog so that the connection for
      the replication slot is reused for WAL streaming.
      
      Andres Freund, slightly modified by me, reviewed by Michael Paquier
      504c7175
    • Tom Lane's avatar
      Fix core dump in pg_dump --binary-upgrade on zero-column composite type. · 5c38a1d4
      Tom Lane authored
      This reverts nearly all of commit 28f6cab6
      in favor of just using the typrelid we already have in pg_dump's TypeInfo
      struct for the composite type.  As coded, it'd crash if the composite type
      had no attributes, since then the query would return no rows.
      
      Back-patch to all supported versions.  It seems to not really be a problem
      in 9.0 because that version rejects the syntax "create type t as ()", but
      we might as well keep the logic similar in all affected branches.
      
      Report and fix by Rushabh Lathia.
      5c38a1d4
    • Tom Lane's avatar
      Re-pgindent src/bin/pg_dump/*. · 7584649a
      Tom Lane authored
      Seems to have gotten rather messy lately, as a consequence of a couple
      of large recent commits.
      7584649a
    • Stephen Frost's avatar
      Fix pg_dump for UPDATE policies · 389573fd
      Stephen Frost authored
      pg_dump had the wrong character for update and so was failing when
      attempts were made to pg_dump databases with UPDATE policies.
      
      Pointed out by Fujii Masao (thanks!)
      389573fd
  6. Oct 14, 2014
    • Alvaro Herrera's avatar
      Blind attempt at fixing Win32 pg_dump issues · 076d29a1
      Alvaro Herrera authored
      Per buildfarm failures
      076d29a1
    • Alvaro Herrera's avatar
      pg_dump: Reduce use of global variables · 0eea8047
      Alvaro Herrera authored
      Most pg_dump.c global variables, which were passed down individually to
      dumping routines, are now grouped as members of the new DumpOptions
      struct, which is used as a local variable and passed down into routines
      that need it.  This helps future development efforts; in particular it
      is said to enable a mode in which a parallel pg_dump run can output
      multiple streams, and have them restored in parallel.
      
      Also take the opportunity to clean up the pg_dump header files somewhat,
      to avoid circularity.
      
      Author: Joachim Wieland, revised by Álvaro Herrera
      Reviewed by Peter Eisentraut
      0eea8047
    • Peter Eisentraut's avatar
      psql: Fix \? output alignment · 7ce09e61
      Peter Eisentraut authored
      This was inadvertently changed in commit c64e68fd.
      7ce09e61
  7. Oct 13, 2014
  8. Oct 12, 2014
    • Peter Eisentraut's avatar
      pg_recvlogical: Improve --help output · a0fb59d8
      Peter Eisentraut authored
      List the actions first, as they are the most important options.  Group
      the other options more sensibly, consistent with the man page.  Correct
      a few typographical errors, clarify some things.
      
      Also update the pg_receivexlog --help output to make it a bit more
      consistent with that of pg_recvlogical.
      a0fb59d8
  9. Oct 06, 2014
    • Stephen Frost's avatar
      Clean up Create/DropReplicationSlot query buffer · 273b29db
      Stephen Frost authored
      CreateReplicationSlot() and DropReplicationSlot() were not cleaning up
      the query buffer in some cases (mostly error conditions) which meant a
      small leak.  Not generally an issue as the error case would result in an
      immediate exit, but not difficult to fix either and reduces the number
      of false positives from code analyzers.
      
      In passing, also add appropriate PQclear() calls to RunIdentifySystem().
      
      Pointed out by Coverity.
      273b29db
    • Andres Freund's avatar
      Add support for managing physical replication slots to pg_receivexlog. · d9f38c7a
      Andres Freund authored
      pg_receivexlog already has the capability to use a replication slot to
      reserve WAL on the upstream node. But the used slot currently has to
      be created via SQL.
      
      To allow using slots directly, without involving SQL, add
      --create-slot and --drop-slot actions, analogous to the logical slot
      manipulation support in pg_recvlogical.
      
      Author: Michael Paquier
      Discussion: CABUevEx+zrOHZOQg+dPapNPFRJdsk59b=TSVf30Z71GnFXhQaw@mail.gmail.com
      d9f38c7a
    • Andres Freund's avatar
      Rename pg_recvlogical's --create/--drop to --create-slot/--drop-slot. · c8b6cba8
      Andres Freund authored
      A future patch (9.5 only) adds slot management to pg_receivexlog. The
      verbs create/drop don't seem descriptive enough there. It seems better
      to rename pg_recvlogical's commands now, in beta, than live with the
      inconsistency forever.
      
      The old form (e.g. --drop) will still be accepted by virtue of most
      getopt_long() options accepting abbreviations for long commands.
      
      Backpatch to 9.4 where pg_recvlogical was introduced.
      
      Author: Michael Paquier and Andres Freund
      Discussion: CAB7nPqQtt79U6FmhwvgqJmNyWcVCbbV-nS72j_jyPEopERg9rg@mail.gmail.com
      c8b6cba8
    • Peter Eisentraut's avatar
      Translation updates · 1ec4a970
      Peter Eisentraut authored
      1ec4a970
  10. Oct 03, 2014
    • Stephen Frost's avatar
      Fix CreatePolicy, pg_dump -v; psql and doc updates · 78d72563
      Stephen Frost authored
      Peter G pointed out that valgrind was, rightfully, complaining about
      CreatePolicy() ending up copying beyond the end of the parsed policy
      name.  Name is a fixed-size type and we need to use namein (through
      DirectFunctionCall1()) to flush out the entire array before we pass
      it down to heap_form_tuple.
      
      Michael Paquier pointed out that pg_dump --verbose was missing a
      newline and Fabrízio de Royes Mello further pointed out that the
      schema was also missing from the messages, so fix those also.
      
      Also, based on an off-list comment from Kevin, rework the psql \d
      output to facilitate copy/pasting into a new CREATE or ALTER POLICY
      command.
      
      Lastly, improve the pg_policies view and update the documentation for
      it, along with a few other minor doc corrections based on an off-list
      discussion with Adam Brightwell.
      78d72563
  11. Oct 01, 2014
    • Andres Freund's avatar
      Refactor replication connection code of various pg_basebackup utilities. · 0c013e08
      Andres Freund authored
      Move some more code to manage replication connection command to
      streamutil.c. A later patch will introduce replication slot via
      pg_receivexlog and this avoid duplicating relevant code between
      pg_receivexlog and pg_recvlogical.
      
      Author: Michael Paquier, with some editing by me.
      0c013e08
    • Andres Freund's avatar
      pg_recvlogical.c code review. · fdf81c9a
      Andres Freund authored
      Several comments still referred to 'initiating', 'freeing', 'stopping'
      replication slots. These were terms used during different phases of
      the development of logical decoding, but are no long accurate.
      
      Also rename StreamLog() to StreamLogicalLog() and add 'void' to the
      prototype.
      
      Author: Michael Paquier, with some editing by me.
      
      Backpatch to 9.4 where pg_recvlogical was introduced.
      fdf81c9a
  12. Sep 30, 2014
  13. Sep 26, 2014
    • Stephen Frost's avatar
      Fix relcache for policies, and doc updates · ff27fcfa
      Stephen Frost authored
      Andres pointed out that there was an extra ';' in equalPolicies, which
      made me realize that my prior testing with CLOBBER_CACHE_ALWAYS was
      insufficient (it didn't always catch the issue, just most of the time).
      Thanks to that, a different issue was discovered, specifically in
      equalRSDescs.  This change corrects eqaulRSDescs to return 'true' once
      all policies have been confirmed logically identical.  After stepping
      through both functions to ensure correct behavior, I ran this for
      about 12 hours of CLOBBER_CACHE_ALWAYS runs of the regression tests
      with no failures.
      
      In addition, correct a few typos in the documentation which were pointed
      out by Thom Brown (thanks!) and improve the policy documentation further
      by adding a flushed out usage example based on a unix passwd file.
      
      Lastly, clean up a few comments in the regression tests and pg_dump.h.
      ff27fcfa
    • Robert Haas's avatar
      Fix identify_locking_dependencies for schema-only dumps. · 07d46a89
      Robert Haas authored
      Without this fix, parallel restore of a schema-only dump can deadlock,
      because when the dump is schema-only, the dependency will still be
      pointing at the TABLE item rather than the TABLE DATA item.
      
      Robert Haas and Tom Lane
      07d46a89
  14. Sep 25, 2014
  15. Sep 24, 2014
    • Stephen Frost's avatar
      Code review for row security. · 6550b901
      Stephen Frost authored
      Buildfarm member tick identified an issue where the policies in the
      relcache for a relation were were being replaced underneath a running
      query, leading to segfaults while processing the policies to be added
      to a query.  Similar to how TupleDesc RuleLocks are handled, add in a
      equalRSDesc() function to check if the policies have actually changed
      and, if not, swap back the rsdesc field (using the original instead of
      the temporairly built one; the whole structure is swapped and then
      specific fields swapped back).  This now passes a CLOBBER_CACHE_ALWAYS
      for me and should resolve the buildfarm error.
      
      In addition to addressing this, add a new chapter in Data Definition
      under Privileges which explains row security and provides examples of
      its usage, change \d to always list policies (even if row security is
      disabled- but note that it is disabled, or enabled with no policies),
      rework check_role_for_policy (it really didn't need the entire policy,
      but it did need to be using has_privs_of_role()), and change the field
      in pg_class to relrowsecurity from relhasrowsecurity, based on
      Heikki's suggestion.  Also from Heikki, only issue SET ROW_SECURITY in
      pg_restore when talking to a 9.5+ server, list Bypass RLS in \du, and
      document --enable-row-security options for pg_dump and pg_restore.
      
      Lastly, fix a number of minor whitespace and typo issues from Heikki,
      Dimitri, add a missing #include, per Peter E, fix a few minor
      variable-assigned-but-not-used and resource leak issues from Coverity
      and add tab completion for role attribute bypassrls as well.
      6550b901
  16. Sep 23, 2014
    • Stephen Frost's avatar
      Add unicode_*_linestyle to \? variables · a5643073
      Stephen Frost authored
      In a2dabf0e we added the ability to have single or double unicode
      linestyle for the border, column, or header.  Unfortunately, the
      \? variables output was not updated for these new psql variables.
      
      This corrects that oversight.
      
      Patch by Pavel Stehule.
      a5643073
  17. Sep 19, 2014
    • Stephen Frost's avatar
      Row-Level Security Policies (RLS) · 491c029d
      Stephen Frost authored
      Building on the updatable security-barrier views work, add the
      ability to define policies on tables to limit the set of rows
      which are returned from a query and which are allowed to be added
      to a table.  Expressions defined by the policy for filtering are
      added to the security barrier quals of the query, while expressions
      defined to check records being added to a table are added to the
      with-check options of the query.
      
      New top-level commands are CREATE/ALTER/DROP POLICY and are
      controlled by the table owner.  Row Security is able to be enabled
      and disabled by the owner on a per-table basis using
      ALTER TABLE .. ENABLE/DISABLE ROW SECURITY.
      
      Per discussion, ROW SECURITY is disabled on tables by default and
      must be enabled for policies on the table to be used.  If no
      policies exist on a table with ROW SECURITY enabled, a default-deny
      policy is used and no records will be visible.
      
      By default, row security is applied at all times except for the
      table owner and the superuser.  A new GUC, row_security, is added
      which can be set to ON, OFF, or FORCE.  When set to FORCE, row
      security will be applied even for the table owner and superusers.
      When set to OFF, row security will be disabled when allowed and an
      error will be thrown if the user does not have rights to bypass row
      security.
      
      Per discussion, pg_dump sets row_security = OFF by default to ensure
      that exports and backups will have all data in the table or will
      error if there are insufficient privileges to bypass row security.
      A new option has been added to pg_dump, --enable-row-security, to
      ask pg_dump to export with row security enabled.
      
      A new role capability, BYPASSRLS, which can only be set by the
      superuser, is added to allow other users to be able to bypass row
      security using row_security = OFF.
      
      Many thanks to the various individuals who have helped with the
      design, particularly Robert Haas for his feedback.
      
      Authors include Craig Ringer, KaiGai Kohei, Adam Brightwell, Dean
      Rasheed, with additional changes and rework by me.
      
      Reviewers have included all of the above, Greg Smith,
      Jeff McCormick, and Robert Haas.
      491c029d
    • Andres Freund's avatar
      Avoid 'clobbered by longjmp' warning in psql/copy.c. · afaefa1b
      Andres Freund authored
      This was introduced in 51bb7956.
      afaefa1b
  18. Sep 13, 2014
  19. Sep 12, 2014
    • Stephen Frost's avatar
      Add unicode_{column|header|border}_style to psql · a2dabf0e
      Stephen Frost authored
      With the unicode linestyle, this adds support to control if the
      column, header, or border style should be single or double line
      unicode characters.  The default remains 'single'.
      
      In passing, clean up the border documentation and address some
      minor formatting/spelling issues.
      
      Pavel Stehule, with some additional changes by me.
      a2dabf0e
    • Stephen Frost's avatar
      Handle border = 3 in expanded mode · 82962838
      Stephen Frost authored
      In psql, expanded mode was not being displayed correctly when using
      the normal ascii or unicode linestyles and border set to '3'.  Now,
      per the documentation, border '3' is really only sensible for HTML
      and LaTeX formats, however, that's no excuse for ascii/unicode to
      break in that case, and provisions had been made for psql to cleanly
      handle this case (and it did, in non-expanded mode).
      
      This was broken when ascii/unicode was initially added a good five
      years ago because print_aligned_vertical_line wasn't passed in the
      border setting being used by print_aligned_vertical but instead was
      given the whole printTableContent.  There really isn't a good reason
      for vertical_line to have the entire printTableContent structure, so
      just pass in the printTextFormat and border setting (similar to how
      this is handled in horizontal_line).
      
      Pointed out by Pavel Stehule, fix by me.
      
      Back-patch to all currently-supported versions.
      82962838
    • Peter Eisentraut's avatar
      Fix vacuumdb --analyze-in-stages --all order · da24813c
      Peter Eisentraut authored
      When running vacuumdb --analyze-in-stages --all, it needs to run the
      first stage across all databases before the second one, instead of
      running all stages in a database before processing the next one.
      
      Also respect the --quiet option with --analyze-in-stages.
      da24813c
  20. Sep 10, 2014
    • Andres Freund's avatar
      Add new psql help topics, accessible to both --help and \?. · 07c8651d
      Andres Freund authored
      Add --help=<topic> for the commandline, and \? <topic> as a backslash
      command, to show more help than the invocations without parameters
      do. "commands", "variables" and "options" currently exist as help
      topics describing, respectively, backslash commands, psql variables,
      and commandline switches. Without parameters the help commands show
      their previous topic.
      
      Some further wordsmithing or extending of the added help content might
      be needed; but there seems little benefit delaying the overall feature
      further.
      
      Author: Pavel Stehule, editorialized by many
      
      Reviewed-By: Andres Freund, Petr Jelinek, Fujii Masao, MauMau, Abhijit
          Menon-Sen and Erik Rijkers.
      
      Discussion: CAFj8pRDVGuC-nXBfe2CK8vpyzd2Dsr9GVpbrATAnZO=2YQ0s2Q@mail.gmail.com,
          CAFj8pRA54AbTv2RXDTRxiAd8hy8wxmoVLqhJDRCwEnhdd7OUkw@mail.gmail.com
      07c8651d
  21. Sep 08, 2014
    • Tom Lane's avatar
      Fix psql \s to work with recent libedit, and add pager support. · 750c5ee6
      Tom Lane authored
      psql's \s (print command history) doesn't work at all with recent libedit
      versions when printing to the terminal, because libedit tries to do an
      fchmod() on the target file which will fail if the target is /dev/tty.
      (We'd already noted this in the context of the target being /dev/null.)
      Even before that, it didn't work pleasantly, because libedit likes to
      encode the command history file (to ensure successful reloading), which
      renders it nigh unreadable, not to mention significantly different-looking
      depending on exactly which libedit version you have.  So let's forget using
      write_history() for this purpose, and instead print the data ourselves,
      using logic similar to that used to iterate over the history for newline
      encoding/decoding purposes.
      
      While we're at it, insert the ability to use the pager when \s is printing
      to the terminal.  This has been an acknowledged shortcoming of \s for many
      years, so while you could argue it's not exactly a back-patchable bug fix
      it still seems like a good improvement.  Anyone who's seriously annoyed
      at this can use "\s /dev/tty" or local equivalent to get the old behavior.
      
      Experimentation with this showed that the history iteration logic was
      actually rather broken when used with libedit.  It turns out that with
      libedit you have to use previous_history() not next_history() to advance
      to more recent history entries.  The easiest and most robust fix for this
      seems to be to make a run-time test to verify which function to call.
      We had not noticed this because libedit doesn't really need the newline
      encoding logic: its own encoding ensures that command entries containing
      newlines are reloaded correctly (unlike libreadline).  So the effective
      behavior with recent libedits was that only the oldest history entry got
      newline-encoded or newline-decoded.  However, because of yet other bugs in
      history_set_pos(), some old versions of libedit allowed the existing loop
      logic to reach entries besides the oldest, which means there may be libedit
      ~/.psql_history files out there containing encoded newlines in more than
      just the oldest entry.  To ensure we can reload such files, it seems
      appropriate to back-patch this fix, even though that will result in some
      incompatibility with older psql versions (ie, multiline history entries
      written by a psql with this fix will look corrupted to a psql without it,
      if its libedit is reasonably up to date).
      
      Stepan Rutz and Tom Lane
      750c5ee6
  22. Sep 07, 2014
  23. Sep 06, 2014
Loading