Skip to content
Snippets Groups Projects
  1. May 28, 2015
    • Stephen Frost's avatar
      Finish removing pg_audit · cde9cf17
      Stephen Frost authored
      cde9cf17
    • Tom Lane's avatar
      Fix pg_rewind's handling of top-level symlinks. · 0381fefa
      Tom Lane authored
      The previous coding suffered a null-pointer dereference if it found any
      symlink at the top level of $PGDATA.  Fix that, and teach it to recurse
      into a symlink for pg_xlog, but not anything else.
      
      Per note from Abhijit Menon-Sen.
      0381fefa
    • Stephen Frost's avatar
      Remove pg_audit · e5f1a4f1
      Stephen Frost authored
      This removes pg_audit, per discussion:
      
      20150528082038.GU26667@tamriel.snowman.net
      e5f1a4f1
    • Tom Lane's avatar
      Fix assorted inconsistencies in our calls of readlink(). · 32f628be
      Tom Lane authored
      Ensure that we null-terminate the result string (one place in pg_rewind).
      Be paranoid about out-of-range results from readlink() (should not happen,
      but there is no good reason for some call sites to be careful about it and
      others not).  Consistently use the whole buffer, not sometimes one byte
      less.  Ensure we emit an appropriate errcode() in all cases.  Spell the
      error messages the same way.
      
      The only serious bug here is the missing null-termination in pg_rewind,
      which is new code, so no need for a back-patch.
      
      Abhijit Menon-Sen and Tom Lane
      32f628be
    • Tom Lane's avatar
      Fix pg_get_functiondef() to print a function's LEAKPROOF property. · f46edf47
      Tom Lane authored
      Seems to have been an oversight in the original leakproofness patch.
      Per report and patch from Jeevan Chalke.
      
      In passing, prettify some awkward leakproof-related code in AlterFunction.
      f46edf47
    • Tom Lane's avatar
      Fix portability issue in isolationtester grammar. · aa9eac45
      Tom Lane authored
      specparse.y and specscanner.l used "string" as a token name.  Now, bison
      likes to define each token name as a macro for the token code it assigns,
      which means those names are basically off-limits for any other use within
      the grammar file or included headers.  So names as generic as "string" are
      dangerous.  This is what was causing the recent failures on protosciurus:
      some versions of Solaris' sys/kstat.h use "string" as a field name.
      With late-model bison we don't see this problem because the token macros
      aren't defined till later (that is why castoroides didn't show the problem
      even though it's on the same machine).  But protosciurus uses bison 1.875
      which defines the token macros up front.
      
      This land mine has been there from day one; we'd have found it sooner
      except that protosciurus wasn't trying to run the isolation tests till
      recently.
      
      To fix, rename the token to "string_literal" which is hopefully less
      likely to collide with names used by system headers.  Back-patch to
      all branches containing the isolation tests.
      aa9eac45
  2. May 27, 2015
  3. May 26, 2015
    • Tom Lane's avatar
      Suppress occasional failures in brin regression test. · 1f303fd1
      Tom Lane authored
      brin.sql included a call of brin_summarize_new_values(), and expected
      it to always report exactly 5 summarization events.  This failed sometimes
      during parallel regression tests, as a consequence of the database-wide
      VACUUM in gist.sql getting there first.  The most future-proof way
      to avoid variation in the test results is to forget about using
      brin_summarize_new_values() and just do a plain "VACUUM brintest",
      which will exercise the same code anyway.
      
      Having done that, there's no need for preventing autovacuum on brintest;
      doing so just reduces the scope of test coverage, so let's not.
      1f303fd1
    • Andrew Dunstan's avatar
      Simplify addJsonbToParseState() · fba12c8c
      Andrew Dunstan authored
      This function no longer needs to walk non-scalar structures passed to
      it, following commit 54547bd8.
      fba12c8c
    • Andrew Dunstan's avatar
      Add all structured objects passed to pushJsonbValue piecewise. · 54547bd8
      Andrew Dunstan authored
      Commit 9b74f32c did this for objects of
      type jbvBinary, but in trying further to simplify some of the new jsonb
      code I discovered that objects of type jbvObject or jbvArray passed as
      WJB_ELEM or WJB_VALUE also caused problems. These too are now added
      component by component.
      
      Backpatch to 9.4.
      54547bd8
    • Tom Lane's avatar
      Fix valgrind's "unaddressable bytes" whining about BRIN code. · 79f2b5d5
      Tom Lane authored
      brin_form_tuple calculated an exact tuple size, then palloc'd and
      filled just that much.  Later, brin_doinsert or brin_doupdate would
      MAXALIGN the tuple size and tell PageAddItem that that was the size
      of the tuple to insert.  If the original tuple size wasn't a multiple
      of MAXALIGN, the net result would be that PageAddItem would memcpy
      a few more bytes than the palloc request had been for.
      
      AFAICS, this is totally harmless in the real world: the error is a
      read overrun not a write overrun, and palloc would certainly have
      rounded the request up to a MAXALIGN multiple internally, so there's
      no chance of the memcpy fetching off the end of memory.  Valgrind,
      however, is picky to the byte level not the MAXALIGN level.
      
      Fix it by pushing the MAXALIGN step back to brin_form_tuple.  (The other
      possible source of tuples in this code, brin_form_placeholder_tuple,
      was already producing a MAXALIGN'd result.)
      
      In passing, be a bit more paranoid about internal allocations in
      brin_form_tuple.
      79f2b5d5
  4. May 25, 2015
  5. May 24, 2015
  6. May 23, 2015
    • Tom Lane's avatar
      Add error check for lossy distance functions in index-only scans. · f84c8601
      Tom Lane authored
      Maybe we should actually support this, but for the moment let's just
      throw an error if the opclass tries it.
      f84c8601
    • Tom Lane's avatar
      Fix incorrect snprintf() limit. · 72809480
      Tom Lane authored
      Typo in commit 7cbee7c0.  No practical effect since the buffer should
      never actually be overrun, but various compilers and static analyzers will
      whine about it.
      
      Petr Jelinek
      72809480
    • Tom Lane's avatar
      Still more fixes for lossy-GiST-distance-functions patch. · 821b821a
      Tom Lane authored
      Fix confusion in documentation, substantial memory leakage if float8 or
      float4 are pass-by-reference, and assorted comments that were obsoleted
      by commit 98edd617.
      821b821a
    • Andres Freund's avatar
      Fix yet another bug in ON CONFLICT rule deparsing. · 284bef29
      Andres Freund authored
      Expand testing of rule deparsing a good bit, it's evidently needed.
      
      Author: Peter Geoghegan, Andres Freund
      Discussion: CAM3SWZQmXxZhQC32QVEOTYfNXJBJ_Q2SDENL7BV14Cq-zL0FLg@mail.gmail.com
      284bef29
    • Andres Freund's avatar
      Remove the new UPSERT command tag and use INSERT instead. · 631d7490
      Andres Freund authored
      Previously, INSERT with ON CONFLICT DO UPDATE specified used a new
      command tag -- UPSERT.  It was introduced out of concern that INSERT as
      a command tag would be a misrepresentation for ON CONFLICT DO UPDATE, as
      some affected rows may actually have been updated.
      
      Alvaro Herrera noticed that the implementation of that new command tag
      was incomplete; in subsequent discussion we concluded that having it
      doesn't provide benefits that are in line with the compatibility breaks
      it requires.
      
      Catversion bump due to the removal of PlannedStmt->isUpsert.
      
      Author: Peter Geoghegan
      Discussion: 20150520215816.GI5885@postgresql.org
      631d7490
    • Tom Lane's avatar
      Fix recently-introduced crash in array_contain_compare(). · 49ad32d5
      Tom Lane authored
      Silly oversight in commit 1dc5ebc9:
      when array2 is an expanded array, it might have array2->xpn.dnulls equal
      to NULL, indicating the array is known null-free.  The code wasn't
      expecting that, because it formerly always used deconstruct_array() which
      always delivers a nulls array.
      
      Per bug #13334 from Regina Obe.
      49ad32d5
  7. May 22, 2015
    • Andrew Dunstan's avatar
      Unpack jbvBinary objects passed to pushJsonbValue · 5302760a
      Andrew Dunstan authored
      pushJsonbValue was accepting jbvBinary objects passed as WJB_ELEM or
      WJB_VALUE data. While this succeeded, when those objects were later
      encountered in attempting to convert the result to Jsonb, errors
      occurred. With this change we ghuarantee that a JSonbValue constructed
      from calls to pushJsonbValue does not contain any jbvBinary objects.
      This cures a problem observed with jsonb_delete.
      
      This means callers of pushJsonbValue no longer need to perform this
      unpacking themselves. A subsequent patch will perform some cleanup in
      that area.
      
      The error was not triggered by any 9.4 code, but this is a publicly
      visible routine, and so the error could be exercised by third party
      code, therefore backpatch to 9.4.
      
      Bug report from Peter Geoghegan, fix by me.
      5302760a
    • Fujii Masao's avatar
      Minor enhancement of readability of ALTER TABLE syntax in the doc. · 6d1733fa
      Fujii Masao authored
      Fabrízio Mello
      6d1733fa
    • Heikki Linnakangas's avatar
      At promotion, don't leave behind a partial segment on the old timeline. · 7cbee7c0
      Heikki Linnakangas authored
      With commit de768844, a copy of the partial segment was archived with the
      .partial suffix, but the original file was still left in pg_xlog, so it
      didn't actually solve the problems with archiving the partial segment that
      it was supposed to solve. With this patch, the partial segment is renamed
      rather than copied, so we only archive it with the .partial suffix.
      
      Also be more robust in detecting if the last segment is already being
      archived. Previously I used XLogArchiveIsBusy() for that, but that's not
      quite right. With archive_mode='always', there might be a .ready file for
      it, and we don't want to rename it to .partial in that case.
      
      The old segment is needed until we're fully committed to the new timeline,
      i.e. until we've written the end-of-recovery WAL record and updated the
      min recovery point and timeline in the control file. So move the renaming
      later in the startup sequence, after all that's been done.
      7cbee7c0
    • Tom Lane's avatar
      More fixes for lossy-GiST-distance-functions patch. · c5dd8ead
      Tom Lane authored
      Paul Ramsey reported that commit 35fcb1b3
      induced a core dump on commuted ORDER BY expressions, because it was
      assuming that the indexorderby expression could be found verbatim in the
      relevant equivalence class, but it wasn't there.  We really don't need
      anything that complicated anyway; for the data types likely to be used for
      index ORDER BY operators in the foreseeable future, the exprType() of the
      ORDER BY expression will serve fine.  (The case where we'd have to work
      harder is where the ORDER BY expression's result is only binary-compatible
      with the declared input type of the ordering operator; long before worrying
      about that, one would need to get rid of GiST's hard-wired assumption that
      said datatype is float8.)
      
      Aside from fixing that crash and adding a regression test for the case,
      I did some desultory code review:
      
      nodeIndexscan.c was likewise overthinking how hard it ought to work to
      identify the datatype of the ORDER BY expressions.
      
      Add comments explaining how come nodeIndexscan.c can get away with
      simplifying assumptions about NULLS LAST ordering and no backward scan.
      
      Revert no-longer-needed changes of find_ec_member_for_tle(); while the
      new definition was no worse than the old, it wasn't better either, and
      it might cause back-patching pain.
      
      Revert entirely bogus additions to genam.h.
      c5dd8ead
  8. May 21, 2015
    • Tom Lane's avatar
      Improve packing/alignment annotation for ItemPointerData. · d4b538ea
      Tom Lane authored
      We want this struct to be exactly a series of 3 int16 words, no more
      and no less.  Historically, at least, some ARM compilers preferred to
      pad it to 8 bytes unless coerced.  Our old way of doing that was just
      to use __attribute__((packed)), but as pointed out by Piotr Stefaniak,
      that does too much: it also licenses the compiler to give the struct
      only byte-alignment.  We don't want that because it adds access overhead,
      possibly quite significant overhead.  According to the GCC manual, what
      we want requires also specifying __attribute__((align(2))).  It's not
      entirely clear if all the relevant compilers accept this pragma as well,
      but we can hope the buildfarm will tell us if not.  We can also add a
      static assertion that should fire if the compiler padded the struct.
      
      Since the combination of these pragmas should define exactly what we
      want on any compiler that accepts them, let's try using them wherever
      we think they exist, not only for __arm__.  (This is likely to expose
      that the conditional definitions in c.h are inadequate, but finding
      that out would be a good thing.)
      
      The immediate motivation for this is that the current definition of
      ExecRowMark allows its curCtid field to be misaligned.  It is not clear
      whether there are any other uses of ItemPointerData with a similar hazard.
      We could change the definition of ExecRowMark if this doesn't work, but
      it would be far better to have a future-proof fix.
      
      Piotr Stefaniak, some further hacking by me
      d4b538ea
    • Robert Haas's avatar
      Correct two mistakes in the ALTER FOREIGN TABLE reference page. · 160a9aaa
      Robert Haas authored
      Etsuro Fujita
      160a9aaa
Loading