1. 29 Feb, 2008 1 commit
    • Neil Conway's avatar
      Fix several memory leaks when rescanning SRFs. Arrange for an SRF's · ff428cde
      Neil Conway authored
      "multi_call_ctx" to be a distinct sub-context of the EState's per-query
      context, and delete the multi_call_ctx as soon as the SRF finishes
      execution. This avoids leaking SRF memory until the end of the current
      query, which is particularly egregious when the SRF is scanned
      multiple times. This change also fixes a leak of the fields of the
      AttInMetadata struct in shutdown_MultiFuncCall().
      
      Also fix a leak of the SRF result TupleDesc when rescanning a
      FunctionScan node. The TupleDesc is allocated in the per-query context
      for every call to ExecMakeTableFunctionResult(), so we should free it
      after calling that function. Since the SRF might choose to return
      a non-expendable TupleDesc, we only free the TupleDesc if it is
      not being reference-counted.
      
      Backpatch to 8.3 and 8.2 stable branches.
      ff428cde
  2. 28 Feb, 2008 1 commit
  3. 27 Feb, 2008 2 commits
  4. 26 Feb, 2008 13 commits
  5. 25 Feb, 2008 3 commits
    • Tom Lane's avatar
      Reject year zero during datetime input, except when it's a 2-digit year · bc93919b
      Tom Lane authored
      (then it means 2000 AD).  Formerly we silently interpreted this as 1 BC,
      which at best is unwarranted familiarity with the implementation.
      It's barely possible that some app somewhere expects the old behavior,
      though, so we won't back-patch this into existing release branches.
      bc93919b
    • Tom Lane's avatar
      Fix datetime input to behave correctly for Feb 29 in years BC. · 05506fc4
      Tom Lane authored
      Formerly, DecodeDate attempted to verify the day-of-the-month exactly, but
      it was under the misapprehension that it would know whether we were looking
      at a BC year or not.  In reality this check can't be made until the calling
      function (eg DecodeDateTime) has processed all the fields.  So, split the
      BC adjustment and validity checks out into a new function ValidateDate that
      is called only after processing all the fields.  In passing, this patch
      makes DecodeTimeOnly work for BC inputs, which it never did before.
      
      (The historical veracity of all this is nonexistent, of course, but if
      we're going to say we support proleptic Gregorian calendar then we should
      do it correctly.  In any case the unpatched code is broken because it could
      emit dates that it would then reject on re-inputting.)
      
      Per report from Bernd Helmle.  Back-patch as far as 8.0; in 7.x we were
      not using our own calendar support and so this seems a bit too risky
      to put into 7.4.
      05506fc4
    • Peter Eisentraut's avatar
      Link postgres from all object files at once, to avoid the error-prone · 9956ddc1
      Peter Eisentraut authored
      SUBSYS.o step and allow for better optimization by the linker.
      
      Instead of partial linking into SUBSYS.o, the list of object files is
      assembled in objfiles.txt files that are expanded when the final
      linking is done.
      
      Because we are not yet sure how long command lines different platforms
      can handle, the old way of linking is still available, by defining the
      make variable PARTIAL_LINKING (e.g., make all PARTIAL_LINKING=1).  If
      we determine that this is necessary for some platforms, then we will
      document this in a more prominent place.
      9956ddc1
  6. 24 Feb, 2008 1 commit
  7. 23 Feb, 2008 2 commits
    • Tom Lane's avatar
      Avoid trying to print a NULL char pointer in --describe-config. On some · 2e0e5631
      Tom Lane authored
      platforms this works, but on some it crashes.  Zdenek Kotala
      2e0e5631
    • Tom Lane's avatar
      Change the declaration of struct varlena so that the length word is · 9713c063
      Tom Lane authored
      represented as "char ...[4]" not "int32".  Since the length word is never
      supposed to be accessed via this struct member anyway, this won't break
      any existing code that is following the rules.  The advantage is that C
      compilers will no longer assume that a pointer to struct varlena is
      word-aligned, which prevents incorrect optimizations in TOAST-pointer
      access and perhaps other places.  gcc doesn't seem to do this (at least
      not at -O2), but the problem is demonstrable on some other compilers.
      
      I changed struct inet as well, but didn't bother to touch a lot of other
      struct definitions in which it wouldn't make any difference because there
      were other fields forcing int alignment anyway.  Hopefully none of those
      struct definitions are used for accessing unaligned Datums.
      9713c063
  8. 20 Feb, 2008 6 commits
  9. 19 Feb, 2008 10 commits
  10. 18 Feb, 2008 1 commit
    • Tom Lane's avatar
      Remove unnecessary opening of other relation in RI_FKey_keyequal_upd_pk · cf59277a
      Tom Lane authored
      and RI_FKey_keyequal_upd_fk, as well as no-longer-needed calls of
      ri_BuildQueryKeyFull.  Aside from saving a few cycles, this avoids needless
      deadlock risks when an update is not changing the columns that participate
      in an RI constraint.  Per a gripe from Alexey Nalbat.
      
      Back-patch to 8.3.  Earlier releases did have a need to open the other
      relation due to the way in which they retrieved information about the RI
      constraint, so this problem unfortunately can't easily be improved pre-8.3.
      
      Tom Lane and Stephan Szabo
      cf59277a