1. 24 1月, 2014 1 次提交
    • T
      Allow use of "z" flag in our printf calls, and use it where appropriate. · ac4ef637
      Tom Lane 提交于
      Since C99, it's been standard for printf and friends to accept a "z" size
      modifier, meaning "whatever size size_t has".  Up to now we've generally
      dealt with printing size_t values by explicitly casting them to unsigned
      long and using the "l" modifier; but this is really the wrong thing on
      platforms where pointers are wider than longs (such as Win64).  So let's
      start using "z" instead.  To ensure we can do that on all platforms, teach
      src/port/snprintf.c to understand "z", and add a configure test to force
      use of that implementation when the platform's version doesn't handle "z".
      
      Having done that, modify a bunch of places that were using the
      unsigned-long hack to use "z" instead.  This patch doesn't pretend to have
      gotten everyplace that could benefit, but it catches many of them.  I made
      an effort in particular to ensure that all uses of the same error message
      text were updated together, so as not to increase the number of
      translatable strings.
      
      It's possible that this change will result in format-string warnings from
      pre-C99 compilers.  We might have to reconsider if there are any popular
      compilers that will warn about this; but let's start by seeing what the
      buildfarm thinks.
      
      Andres Freund, with a little additional work by me
      ac4ef637
  2. 20 1月, 2014 1 次提交
    • M
      Remove support for native krb5 authentication · 98de86e4
      Magnus Hagander 提交于
      krb5 has been deprecated since 8.3, and the recommended way to do
      Kerberos authentication is using the GSSAPI authentication method
      (which is still fully supported).
      
      libpq retains the ability to identify krb5 authentication, but only
      gives an error message about it being unsupported. Since all authentication
      is initiated from the backend, there is no need to keep it at all
      in the backend.
      98de86e4
  3. 30 12月, 2013 1 次提交
    • T
      Undo autoconf 2.69's attempt to #define _DARWIN_USE_64_BIT_INODE. · ed011d97
      Tom Lane 提交于
      Defining this symbol causes OS X 10.5 to use a buggy version of readdir(),
      which can sometimes fail with EINVAL if the previously-fetched directory
      entry has been deleted or renamed.  In later OS X versions that bug has
      been repaired, but we still don't need the #define because it's on by
      default.  So this is just an all-around bad idea, and we can do without it.
      ed011d97
  4. 19 12月, 2013 1 次提交
  5. 30 11月, 2013 1 次提交
  6. 23 10月, 2013 1 次提交
    • T
      Get rid of use of asprintf() in favor of a more portable implementation. · 09a89cb5
      Tom Lane 提交于
      asprintf(), aside from not being particularly portable, has a fundamentally
      badly-designed API; the psprintf() function that was added in passing in
      the previous patch has a much better API choice.  Moreover, the NetBSD
      implementation that was borrowed for the previous patch doesn't work with
      non-C99-compliant vsnprintf, which is something we still have to cope with
      on some platforms; and it depends on va_copy which isn't all that portable
      either.  Get rid of that code in favor of an implementation similar to what
      we've used for many years in stringinfo.c.  Also, move it into libpgcommon
      since it's not really libpgport material.
      
      I think this patch will be enough to turn the buildfarm green again, but
      there's still cosmetic work left to do, namely get rid of pg_asprintf()
      in favor of using psprintf().  That will come in a followon patch.
      09a89cb5
  7. 13 10月, 2013 1 次提交
  8. 10 10月, 2013 1 次提交
  9. 05 9月, 2013 1 次提交
  10. 06 7月, 2013 1 次提交
    • J
      Use posix_fallocate() for new WAL files, where available. · 269e7808
      Jeff Davis 提交于
      This function is more efficient than actually writing out zeroes to
      the new file, per microbenchmarks by Jon Nelson. Also, it may reduce
      the likelihood of WAL file fragmentation.
      
      Jon Nelson, with review by Andres Freund, Greg Smith and me.
      269e7808
  11. 14 1月, 2013 1 次提交
    • T
      Improve handling of ereport(ERROR) and elog(ERROR). · b853eb97
      Tom Lane 提交于
      In commit 71450d7f, we added code to inform
      suitably-intelligent compilers that ereport() doesn't return if the elevel
      is ERROR or higher.  This patch extends that to elog(), and also fixes a
      double-evaluation hazard that the previous commit created in ereport(),
      as well as reducing the emitted code size.
      
      The elog() improvement requires the compiler to support __VA_ARGS__, which
      should be available in just about anything nowadays since it's required by
      C99.  But our minimum language baseline is still C89, so add a configure
      test for that.
      
      The previous commit assumed that ereport's elevel could be evaluated twice,
      which isn't terribly safe --- there are already counterexamples in xlog.c.
      On compilers that have __builtin_constant_p, we can use that to protect the
      second test, since there's no possible optimization gain if the compiler
      doesn't know the value of elevel.  Otherwise, use a local variable inside
      the macros to prevent double evaluation.  The local-variable solution is
      inferior because (a) it leads to useless code being emitted when elevel
      isn't constant, and (b) it increases the optimization level needed for the
      compiler to recognize that subsequent code is unreachable.  But it seems
      better than not teaching non-gcc compilers about unreachability at all.
      
      Lastly, if the compiler has __builtin_unreachable(), we can use that
      instead of abort(), resulting in a noticeable code savings since no
      function call is actually emitted.  However, it seems wise to do this only
      in non-assert builds.  In an assert build, continue to use abort(), so that
      the behavior will be predictable and debuggable if the "impossible"
      happens.
      
      These changes involve making the ereport and elog macros emit do-while
      statement blocks not just expressions, which forces small changes in
      a few call sites.
      
      Andres Freund, Tom Lane, Heikki Linnakangas
      b853eb97
  12. 09 10月, 2012 1 次提交
    • A
      Rename USE_INLINE to PG_USE_INLINE · f46baf60
      Alvaro Herrera 提交于
      The former name was too likely to conflict with symbols from external
      headers; and, as seen in recent buildfarm failures in member spoonbill,
      it has now happened at least in plpython.
      f46baf60
  13. 08 10月, 2012 1 次提交
    • T
      Autoconfiscate selection of 64-bit int type for 64-bit large object API. · 95d035e6
      Tom Lane 提交于
      Get rid of the fundamentally indefensible assumption that "long long int"
      exists and is exactly 64 bits wide on every platform Postgres runs on.
      Instead let the configure script select the type to use for "pg_int64".
      
      This is a bit of a pain in the rear since we do not want to pollute client
      namespace with all the random symbols that pg_config.h defines; instead
      we have to create a separate generated header file, "pg_config_ext.h".
      But now that the infrastructure is there, we might have the ability to
      add some other stuff that's long been wanting in this area.
      95d035e6
  14. 01 10月, 2012 1 次提交
  15. 01 9月, 2012 1 次提交
    • T
      Make configure probe for mbstowcs_l as well as wcstombs_l. · 58a031f9
      Tom Lane 提交于
      We previously supposed that any given platform would supply both or neither
      of these functions, so that one configure test would be sufficient.  It now
      appears that at least on AIX this is not the case ... which is likely an
      AIX bug, but nonetheless we need to cope with it.  So use separate tests.
      Per bug #6758; thanks to Andrew Hastie for doing the followup testing
      needed to confirm what was happening.
      
      Backpatch to 9.1, where we began using these functions.
      58a031f9
  16. 17 8月, 2012 1 次提交
    • T
      Check LIBXML_VERSION instead of testing in configure script. · 470d0b97
      Tom Lane 提交于
      We had put a test for libxml2's xmlStructuredErrorContext variable in
      configure, but of course that doesn't work on Windows builds.  The next
      best alternative seems to be to test the LIBXML_VERSION symbol provided
      by xmlversion.h.
      
      Per report from Talha Bin Rizwan, though this fixes it in a different way
      than his proposed patch.
      470d0b97
  17. 14 7月, 2012 1 次提交
    • T
      Add fsync capability to initdb, and use sync_file_range() if available. · b966dd6c
      Tom Lane 提交于
      Historically we have not worried about fsync'ing anything during initdb
      (in fact, initdb intentionally passes -F to each backend launch to prevent
      it from fsync'ing).  But with filesystems getting more aggressive about
      caching data, that's not such a good plan anymore.  Make initdb do a pass
      over the finished data directory tree to fsync everything.  For testing
      purposes, the -N/--nosync flag can be used to restore the old behavior.
      
      Also, testing shows that on Linux, sync_file_range() is much faster than
      posix_fadvise() for hinting to the kernel that an fsync is coming,
      apparently because the latter blocks on a rather small request queue while
      the former doesn't.  So use this function if available in initdb, and also
      in the backend's pg_flush_data() (where it currently will affect only the
      speed of CREATE DATABASE's cloning step).
      
      We will later make pg_regress invoke initdb with the --nosync flag
      to avoid slowing down cases such as "make check" in contrib.  But
      let's not do so until we've shaken out any portability issues in this
      patch.
      
      Jeff Davis, reviewed by Andres Freund
      b966dd6c
  18. 06 7月, 2012 1 次提交
    • T
      Remove support for using wait3() in place of waitpid(). · fc548b22
      Tom Lane 提交于
      All Unix-oid platforms that we currently support should have waitpid(),
      since it's in V2 of the Single Unix Spec.  Our git history shows that
      the wait3 code was added to support NextStep, which we officially dropped
      support for as of 9.2.  So get rid of the configure test, and simplify the
      macro spaghetti in reaper().  Per suggestion from Fujii Masao.
      fc548b22
  19. 15 5月, 2012 2 次提交
    • T
      Put back AC_REQUIRE([AC_STRUCT_TM]). · f667747b
      Tom Lane 提交于
      The BSD-ish members of the buildfarm all seem to think removing this
      was a bad idea.  It looks to me like it resulted in omitting the system
      header inclusion necessary to detect the fields of struct tm correctly.
      f667747b
    • P
      Remove unused AC_DEFINE symbols · ff4628f3
      Peter Eisentraut 提交于
      ENABLE_DTRACE            unused as of a7b7b07a
      HAVE_ERR_SET_MARK        unused as of 4ed4b6c5
      HAVE_FCVT                unused as of 4553e1d8
      HAVE_STRUCT_SOCKADDR_UN  unused as of b4cea00a
      HAVE_SYSCONF             unused as of f83356c7
      TM_IN_SYS_TIME           never used, obsolescent per Autoconf documentation
      ff4628f3
  20. 14 5月, 2012 1 次提交
  21. 08 5月, 2012 1 次提交
  22. 24 2月, 2012 1 次提交
  23. 08 2月, 2012 1 次提交
    • R
      Support fls(). · 4f658dc8
      Robert Haas 提交于
      The immediate impetus for this is that Noah Misch's patch to elide
      unnecessary table and index rebuilds when changing typmod for temporal
      types uses it; and this is extracted from that patch, with some
      further commentary by me.  But it seems logically separate from the
      remainder of the patch, so I'm committing it separately; this is not
      the first time someone has wanted fls() in the backend and probably
      won't be the last.
      
      If we end up using this in more performance-critical spots it may be
      worthwhile to add some architecture-specific optimizations to our
      src/port version of fls() - e.g. any x86 platform can implement this
      using the assembly instruction BSRL.  But performance won't matter
      a bit for assessing typmod changes, so I'm not worried about that
      right now.
      4f658dc8
  24. 08 1月, 2012 1 次提交
    • T
      Use __sync_lock_test_and_set() for spinlocks on ARM, if available. · 0a41e865
      Tom Lane 提交于
      Historically we've used the SWPB instruction for TAS() on ARM, but this
      is deprecated and not available on ARMv6 and later.  Instead, make use
      of a GCC builtin if available.  We'll still fall back to SWPB if not,
      so as not to break existing ports using older GCC versions.
      
      Eventually we might want to try using __sync_lock_test_and_set() on some
      other architectures too, but for now that seems to present only risk and
      not reward.
      
      Back-patch to all supported versions, since people might want to use any
      of them on more recent ARM chips.
      
      Martin Pitt
      0a41e865
  25. 02 1月, 2012 1 次提交
    • T
      Use mutex hint bit in PPC LWARX instructions, where possible. · 5cfa8dd3
      Tom Lane 提交于
      The hint bit makes for a small but measurable performance improvement
      in access to contended spinlocks.
      
      On the other hand, some PPC chips give an illegal-instruction failure.
      There doesn't seem to be a completely bulletproof way to tell whether the
      hint bit will cause an illegal-instruction failure other than by trying
      it; but most if not all 64-bit PPC machines should accept it, so follow
      the Linux kernel's lead and assume it's okay to use it in 64-bit builds.
      Of course we must also check whether the assembler accepts the command,
      since even with a recent CPU the toolchain could be old.
      
      Patch by Manabu Ori, significantly modified by me.
      5cfa8dd3
  26. 28 12月, 2011 1 次提交
    • P
      Remove support for on_exit() · d383c23f
      Peter Eisentraut 提交于
      All supported platforms support the C89 standard function atexit()
      (SunOS 4 probably being the last one not to), and supporting both
      makes the code clumsy.
      d383c23f
  27. 11 12月, 2011 1 次提交
    • A
      Enable compiling with the mingw-w64 32 bit compiler. · 1a0c76c3
      Andrew Dunstan 提交于
      Original patch by Lars Kanis, reviewed by Nishiyama Tomoaki and tweaked some by me.
      
      This compiler, or at least the latest version of it, is currently broken, and
      only passes the regression tests if built with -O0.
      1a0c76c3
  28. 18 11月, 2011 1 次提交
  29. 04 8月, 2011 1 次提交
    • R
      Make pgbench use erand48() rather than random(). · 4af43ee3
      Robert Haas 提交于
      glibc renders random() thread-safe by wrapping a futex lock around it;
      testing reveals that this limits the performance of pgbench on machines
      with many CPU cores.  Rather than switching to random_r(), which is
      only available on GNU systems and crashes unless you use undocumented
      alchemy to initialize the random state properly, switch to our built-in
      implementation of erand48(), which is both thread-safe and concurrent.
      
      Since the list of reasons not to use the operating system's erand48()
      is getting rather long, rename ours to pg_erand48() (and similarly
      for our implementations of lrand48() and srand48()) and just always
      use those.  We were already doing this on Cygwin anyway, and the
      glibc implementation is not quite thread-safe, so pgbench wouldn't
      be able to use that either.
      
      Per discussion with Tom Lane.
      4af43ee3
  30. 21 7月, 2011 1 次提交
    • T
      Rewrite libxml error handling to be more robust. · cacd42d6
      Tom Lane 提交于
      libxml reports some errors (like invalid xmlns attributes) via the error
      handler hook, but still returns a success indicator to the library caller.
      This causes us to miss some errors that are important to report.  Since the
      "generic" error handler hook doesn't know whether the message it's getting
      is for an error, warning, or notice, stop using that and instead start
      using the "structured" error handler hook, which gets enough information
      to be useful.
      
      While at it, arrange to save and restore the error handler hook setting in
      each libxml-using function, rather than assuming we can set and forget the
      hook.  This should improve the odds of working nicely with third-party
      libraries that also use libxml.
      
      In passing, volatile-ize some local variables that get modified within
      PG_TRY blocks.  I noticed this while testing with an older gcc version
      than I'd previously tried to compile xml.c with.
      
      Florian Pflug and Tom Lane, with extensive review/testing by Noah Misch
      cacd42d6
  31. 17 6月, 2011 1 次提交
    • P
      Start using flexible array members · dbbba527
      Peter Eisentraut 提交于
      Flexible array members are a C99 feature that avoids "cheating" in the
      declaration of variable-length arrays at the end of structs.  With
      Autoconf support, this should be transparent for older compilers.
      
      We start with one use in gist.h because gcc 4.6 started to raise a
      warning there.  Over time, it can be expanded to other places in the
      source, but they will likely need some review of sizeof and offsetof
      usage.  The current change in gist.h appears to be safe in this
      regard.
      dbbba527
  32. 01 6月, 2011 1 次提交
    • T
      Replace use of credential control messages with getsockopt(LOCAL_PEERCRED). · be4585b1
      Tom Lane 提交于
      It turns out the reason we hadn't found out about the portability issues
      with our credential-control-message code is that almost no modern platforms
      use that code at all; the ones that used to need it now offer getpeereid(),
      which we choose first.  The last holdout was NetBSD, and they added
      getpeereid() as of 5.0.  So far as I can tell, the only live platform on
      which that code was being exercised was Debian/kFreeBSD, ie, FreeBSD kernel
      with Linux userland --- since glibc doesn't provide getpeereid(), we fell
      back to the control message code.  However, the FreeBSD kernel provides a
      LOCAL_PEERCRED socket parameter that's functionally equivalent to Linux's
      SO_PEERCRED.  That is both much simpler to use than control messages, and
      superior because it doesn't require receiving a message from the other end
      at just the right time.
      
      Therefore, add code to use LOCAL_PEERCRED when necessary, and rip out all
      the credential-control-message code in the backend.  (libpq still has such
      code so that it can still talk to pre-9.1 servers ... but eventually we can
      get rid of it there too.)  Clean up related autoconf probes, too.
      
      This means that libpq's requirepeer parameter now works on exactly the same
      platforms where the backend supports peer authentication, so adjust the
      documentation accordingly.
      be4585b1
  33. 24 4月, 2011 1 次提交
    • T
      Fix char2wchar/wchar2char to support collations properly. · 2ab0796d
      Tom Lane 提交于
      These functions should take a pg_locale_t, not a collation OID, and should
      call mbstowcs_l/wcstombs_l where available.  Where those functions are not
      available, temporarily select the correct locale with uselocale().
      
      This change removes the bogus assumption that all locales selectable in
      a given database have the same wide-character conversion method; in
      particular, the collate.linux.utf8 regression test now passes with
      LC_CTYPE=C, so long as the database encoding is UTF8.
      
      I decided to move the char2wchar/wchar2char functions out of mbutils.c and
      into pg_locale.c, because they work on wchar_t not pg_wchar_t and thus
      don't really belong with the mbutils.c functions.  Keeping them where they
      were would have required importing pg_locale_t into pg_wchar.h somehow,
      which did not seem like a good plan.
      2ab0796d
  34. 09 2月, 2011 1 次提交
    • P
      Per-column collation support · 414c5a2e
      Peter Eisentraut 提交于
      This adds collation support for columns and domains, a COLLATE clause
      to override it per expression, and B-tree index support.
      
      Peter Eisentraut
      reviewed by Pavel Stehule, Itagaki Takahiro, Robert Haas, Noah Misch
      414c5a2e
  35. 27 1月, 2011 1 次提交
    • P
      autoreconf · 6fe5e4e6
      Peter Eisentraut 提交于
      Synchronize pg_config.h.in with configure.in (someone must have
      forgotten to run autoheader or autoreconf), and clean up some spurious
      change in configure introduced by the last commit there.
      6fe5e4e6
  36. 26 12月, 2010 1 次提交
  37. 26 5月, 2010 1 次提交
  38. 25 5月, 2010 1 次提交
  39. 14 5月, 2010 1 次提交