1. 15 Mar, 2017 3 commits
  2. 14 Mar, 2017 17 commits
  3. 13 Mar, 2017 14 commits
  4. 12 Mar, 2017 6 commits
    • Noah Misch's avatar
      Use wrappers of PG_DETOAST_DATUM_PACKED() more. · 3a0d4731
      Noah Misch authored
      This makes almost all core code follow the policy introduced in the
      previous commit.  Specific decisions:
      
      - Text search support functions with char* and length arguments, such as
        prsstart and lexize, may receive unaligned strings.  I doubt
        maintainers of non-core text search code will notice.
      
      - Use plain VARDATA() on values detoasted or synthesized earlier in the
        same function.  Use VARDATA_ANY() on varlenas sourced outside the
        function, even if they happen to always have four-byte headers.  As an
        exception, retain the universal practice of using VARDATA() on return
        values of SendFunctionCall().
      
      - Retain PG_GETARG_BYTEA_P() in pageinspect.  (Page images are too large
        for a one-byte header, so this misses no optimization.)  Sites that do
        not call get_page_from_raw() typically need the four-byte alignment.
      
      - For now, do not change btree_gist.  Its use of four-byte headers in
        memory is partly entangled with storage of 4-byte headers inside
        GBT_VARKEY, on disk.
      
      - For now, do not change gtrgm_consistent() or gtrgm_distance().  They
        incorporate the varlena header into a cache, and there are multiple
        credible implementation strategies to consider.
      3a0d4731
    • Noah Misch's avatar
      Recommend wrappers of PG_DETOAST_DATUM_PACKED(). · 9d7726c2
      Noah Misch authored
      When commit 3e23b68d introduced
      single-byte varlena headers, its fmgr.h changes presented
      PG_GETARG_TEXT_PP() and PG_GETARG_TEXT_P() as equals.  Its postgres.h
      changes presented PG_DETOAST_DATUM_PACKED() and VARDATA_ANY() as the
      exceptional case.  Now, instead, firmly recommend PG_GETARG_TEXT_PP()
      over PG_GETARG_TEXT_P(); likewise for other ...PP() macros.  This shaves
      cycles and invites consistency of style.
      9d7726c2
    • Noah Misch's avatar
      Fix pg_file_write() error handling. · 944a026b
      Noah Misch authored
      Detect fclose() failures; given "ln -s /dev/full $PGDATA/devfull",
      "pg_file_write('devfull', 'x', true)" now fails as it should.  Don't
      leak a stream when fwrite() fails.  Remove a born-ineffective test that
      aimed to skip zero-length writes.  Back-patch to 9.2 (all supported
      versions).
      944a026b
    • Noah Misch's avatar
      Assume deconstruct_array() outputs are untoasted. · 2fd26b23
      Noah Misch authored
      In functions that issue a deconstruct_array() call, consistently use
      plain VARSIZE()/VARDATA() on the array elements.  Prior practice was
      divided between those and VARSIZE_ANY_EXHDR()/VARDATA_ANY().
      2fd26b23
    • Noah Misch's avatar
      Fix comment about length of text, bytea, etc. · 9e092646
      Noah Misch authored
      When commit 3e23b68d introduced
      single-byte varlena headers, it rendered this comment incomplete.
      9e092646
    • Tom Lane's avatar
      Add "break"s to make it clearer what will happen in a nested switch. · 766f7fd6
      Tom Lane authored
      This could only matter if the guessed_type variable had a value that wasn't
      a member of the PasswordType enum; but just in case, let's be sure that
      control falls out to reach the elog(ERROR) at the end of the function.
      Per gripe from Coverity.
      766f7fd6