Skip to content
Snippets Groups Projects
  1. Jun 21, 2017
    • Tom Lane's avatar
      Phase 3 of pgindent updates. · 382ceffd
      Tom Lane authored
      Don't move parenthesized lines to the left, even if that means they
      flow past the right margin.
      
      By default, BSD indent lines up statement continuation lines that are
      within parentheses so that they start just to the right of the preceding
      left parenthesis.  However, traditionally, if that resulted in the
      continuation line extending to the right of the desired right margin,
      then indent would push it left just far enough to not overrun the margin,
      if it could do so without making the continuation line start to the left of
      the current statement indent.  That makes for a weird mix of indentations
      unless one has been completely rigid about never violating the 80-column
      limit.
      
      This behavior has been pretty universally panned by Postgres developers.
      Hence, disable it with indent's new -lpl switch, so that parenthesized
      lines are always lined up with the preceding left paren.
      
      This patch is much less interesting than the first round of indent
      changes, but also bulkier, so I thought it best to separate the effects.
      
      Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org
      Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
      382ceffd
    • Tom Lane's avatar
      Initial pgindent run with pg_bsd_indent version 2.0. · e3860ffa
      Tom Lane authored
      The new indent version includes numerous fixes thanks to Piotr Stefaniak.
      The main changes visible in this commit are:
      
      * Nicer formatting of function-pointer declarations.
      * No longer unexpectedly removes spaces in expressions using casts,
        sizeof, or offsetof.
      * No longer wants to add a space in "struct structname *varname", as
        well as some similar cases for const- or volatile-qualified pointers.
      * Declarations using PG_USED_FOR_ASSERTS_ONLY are formatted more nicely.
      * Fixes bug where comments following declarations were sometimes placed
        with no space separating them from the code.
      * Fixes some odd decisions for comments following case labels.
      * Fixes some cases where comments following code were indented to less
        than the expected column 33.
      
      On the less good side, it now tends to put more whitespace around typedef
      names that are not listed in typedefs.list.  This might encourage us to
      put more effort into typedef name collection; it's not really a bug in
      indent itself.
      
      There are more changes coming after this round, having to do with comment
      indentation and alignment of lines appearing within parentheses.  I wanted
      to limit the size of the diffs to something that could be reviewed without
      one's eyes completely glazing over, so it seemed better to split up the
      changes as much as practical.
      
      Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org
      Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
      e3860ffa
  2. May 17, 2017
  3. Apr 14, 2017
  4. Mar 10, 2017
  5. Aug 30, 2016
    • Tom Lane's avatar
      Simplify correct use of simple_prompt(). · 9daec77e
      Tom Lane authored
      The previous API for this function had it returning a malloc'd string.
      That meant that callers had to check for NULL return, which few of them
      were doing, and it also meant that callers had to remember to free()
      the string later, which required extra logic in most cases.
      
      Instead, make simple_prompt() write into a buffer supplied by the caller.
      Anywhere that the maximum required input length is reasonably small,
      which is almost all of the callers, we can just use a local or static
      array as the buffer instead of dealing with malloc/free.
      
      A fair number of callers used "pointer == NULL" as a proxy for "haven't
      requested the password yet".  Maintaining the same behavior requires
      adding a separate boolean flag for that, which adds back some of the
      complexity we save by removing free()s.  Nonetheless, this nets out
      at a small reduction in overall code size, and considerably less code
      than we would have had if we'd added the missing NULL-return checks
      everywhere they were needed.
      
      In passing, clean up the API comment for simple_prompt() and get rid
      of a very-unnecessary malloc/free in its Windows code path.
      
      This is nominally a bug fix, but it does not seem worth back-patching,
      because the actual risk of an OOM failure in any of these places seems
      pretty tiny, and all of them are client-side not server-side anyway.
      
      This patch is by me, but it owes a great deal to Michael Paquier
      who identified the problem and drafted a patch for fixing it the
      other way.
      
      Discussion: <CAB7nPqRu07Ot6iht9i9KRfYLpDaF2ZuUv5y_+72uP23ZAGysRg@mail.gmail.com>
      9daec77e
  6. Jul 14, 2014
  7. May 06, 2014
    • Bruce Momjian's avatar
      pgindent run for 9.4 · 0a783200
      Bruce Momjian authored
      This includes removing tabs after periods in C comments, which was
      applied to back branches, so this change should not effect backpatching.
      0a783200
  8. Feb 15, 2014
    • Tom Lane's avatar
      Centralize getopt-related declarations in a new header file pg_getopt.h. · 60ff2fdd
      Tom Lane authored
      We used to have externs for getopt() and its API variables scattered
      all over the place.  Now that we find we're going to need to tweak the
      variable declarations for Cygwin, it seems like a good idea to have
      just one place to tweak.
      
      In this commit, the variables are declared "#ifndef HAVE_GETOPT_H".
      That may or may not work everywhere, but we'll soon find out.
      
      Andres Freund
      60ff2fdd
  9. Oct 23, 2013
    • Tom Lane's avatar
      Replace pg_asprintf() with psprintf(). · 2c66f992
      Tom Lane authored
      This eliminates an awkward coding pattern that's also unnecessarily
      inconsistent with backend coding.  psprintf() is now the thing to
      use everywhere.
      2c66f992
  10. Oct 13, 2013
  11. May 29, 2013
  12. Mar 04, 2013
    • Kevin Grittner's avatar
      Add a materialized view relations. · 3bf3ab8c
      Kevin Grittner authored
      A materialized view has a rule just like a view and a heap and
      other physical properties like a table.  The rule is only used to
      populate the table, references in queries refer to the
      materialized data.
      
      This is a minimal implementation, but should still be useful in
      many cases.  Currently data is only populated "on demand" by the
      CREATE MATERIALIZED VIEW and REFRESH MATERIALIZED VIEW statements.
      It is expected that future releases will add incremental updates
      with various timings, and that a more refined concept of defining
      what is "fresh" data will be developed.  At some point it may even
      be possible to have queries use a materialized in place of
      references to underlying tables, but that requires the other
      above-mentioned features to be working first.
      
      Much of the documentation work by Robert Haas.
      Review by Noah Misch, Thom Brown, Robert Haas, Marko Tiikkaja
      Security review by KaiGai Kohei, with a decision on how best to
      implement sepgsql still pending.
      3bf3ab8c
  13. Feb 12, 2013
    • Alvaro Herrera's avatar
      Create libpgcommon, and move pg_malloc et al to it · 8396447c
      Alvaro Herrera authored
      libpgcommon is a new static library to allow sharing code among the
      various frontend programs and backend; this lets us eliminate duplicate
      implementations of common routines.  We avoid libpgport, because that's
      intended as a place for porting issues; per discussion, it seems better
      to keep them separate.
      
      The first use case, and the only implemented by this patch, is pg_malloc
      and friends, which many frontend programs were already using.
      
      At the same time, we can use this to provide palloc emulation functions
      for the frontend; this way, some palloc-using files in the backend can
      also be used by the frontend cleanly.  To do this, we change palloc() in
      the backend to be a function instead of a macro on top of
      MemoryContextAlloc().  This was previously believed to cause loss of
      performance, but this implementation has been tweaked by Tom and Andres
      so that on modern compilers it provides a slight improvement over the
      previous one.
      
      This lets us clean up some places that were already with
      localized hacks.
      
      Most of the pg_malloc/palloc changes in this patch were authored by
      Andres Freund. Zoltán Böszörményi also independently provided a form of
      that.  libpgcommon infrastructure was authored by Álvaro.
      8396447c
  14. Oct 02, 2012
    • Tom Lane's avatar
      Work around unportable behavior of malloc(0) and realloc(NULL, 0). · 09ac603c
      Tom Lane authored
      On some platforms these functions return NULL, rather than the more common
      practice of returning a pointer to a zero-sized block of memory.  Hack our
      various wrapper functions to hide the difference by substituting a size
      request of 1.  This is probably not so important for the callers, who
      should never touch the block anyway if they asked for size 0 --- but it's
      important for the wrapper functions themselves, which mistakenly treated
      the NULL result as an out-of-memory failure.  This broke at least pg_dump
      for the case of no user-defined aggregates, as per report from
      Matthew Carrington.
      
      Back-patch to 9.2 to fix the pg_dump issue.  Given the lack of previous
      complaints, it seems likely that there is no live bug in previous releases,
      even though some of these functions were in place before that.
      09ac603c
    • Tom Lane's avatar
      Standardize naming of malloc/realloc/strdup wrapper functions. · a563d941
      Tom Lane authored
      We had a number of variants on the theme of "malloc or die", with the
      majority named like "pg_malloc", but by no means all.  Standardize on the
      names pg_malloc, pg_malloc0, pg_realloc, pg_strdup.  Get rid of pg_calloc
      entirely in favor of using pg_malloc0.
      
      This is an essentially cosmetic change, so no back-patch.  (I did find
      a couple of places where psql and pg_dump were using plain malloc or
      strdup instead of the pg_ versions, but they don't look significant
      enough to bother back-patching.)
      a563d941
  15. Jul 04, 2012
  16. Jun 18, 2012
  17. May 08, 2012
  18. Jan 25, 2011
  19. Sep 22, 2010
  20. Sep 20, 2010
  21. May 12, 2010
  22. Feb 26, 2010
  23. Feb 07, 2010
    • Tom Lane's avatar
      Create a "relation mapping" infrastructure to support changing the relfilenodes · b9b8831a
      Tom Lane authored
      of shared or nailed system catalogs.  This has two key benefits:
      
      * The new CLUSTER-based VACUUM FULL can be applied safely to all catalogs.
      
      * We no longer have to use an unsafe reindex-in-place approach for reindexing
        shared catalogs.
      
      CLUSTER on nailed catalogs now works too, although I left it disabled on
      shared catalogs because the resulting pg_index.indisclustered update would
      only be visible in one database.
      
      Since reindexing shared system catalogs is now fully transactional and
      crash-safe, the former special cases in REINDEX behavior have been removed;
      shared catalogs are treated the same as non-shared.
      
      This commit does not do anything about the recently-discussed problem of
      deadlocks between VACUUM FULL/CLUSTER on a system catalog and other
      concurrent queries; will address that in a separate patch.  As a stopgap,
      parallel_schedule has been tweaked to run vacuum.sql by itself, to avoid
      such failures during the regression tests.
      b9b8831a
  24. Jun 11, 2009
  25. Feb 27, 2009
  26. Feb 25, 2009
  27. Dec 11, 2007
  28. Nov 11, 2007
  29. Jul 26, 2007
    • Tom Lane's avatar
      Arrange to put TOAST tables belonging to temporary tables into special schemas · 82eed4db
      Tom Lane authored
      named pg_toast_temp_nnn, alongside the pg_temp_nnn schemas used for the temp
      tables themselves.  This allows low-level code such as the relcache to
      recognize that these tables are indeed temporary, which enables various
      optimizations such as not WAL-logging changes and using local rather than
      shared buffers for access.  Aside from obvious performance benefits, this
      provides a solution to bug #3483, in which other backends unexpectedly held
      open file references to temporary tables.  The scheme preserves the property
      that TOAST tables are not in any schema that's normally in the search path,
      so they don't conflict with user table names.
      
      initdb forced because of changes in system view definitions.
      82eed4db
  30. Jul 16, 2007
  31. Jun 27, 2007
  32. Oct 19, 2006
  33. Mar 11, 2006
  34. Oct 15, 2005
  35. Sep 27, 2005
  36. Jun 21, 2005
    • Tom Lane's avatar
      Cause initdb to create a third standard database "postgres", which · 6f7fc0ba
      Tom Lane authored
      unlike template0 and template1 does not have any special status in
      terms of backend functionality.  However, all external utilities such
      as createuser and createdb now connect to "postgres" instead of
      template1, and the documentation is changed to encourage people to use
      "postgres" instead of template1 as a play area.  This should fix some
      longstanding gotchas involving unexpected propagation of database
      objects by createdb (when you used template1 without understanding
      the implications), as well as ameliorating the problem that CREATE
      DATABASE is unhappy if anyone else is connected to template1.
      Patch by Dave Page, minor editing by Tom Lane.  All per recent
      pghackers discussions.
      6f7fc0ba
  37. Mar 25, 2005
Loading