Skip to content
Snippets Groups Projects
  1. Nov 23, 2010
  2. Oct 21, 2010
    • Tom Lane's avatar
      Improve handling of domains over arrays. · 529cb267
      Tom Lane authored
      This patch eliminates various bizarre behaviors caused by sloppy thinking
      about the difference between a domain type and its underlying array type.
      In particular, the operation of updating one element of such an array
      has to be considered as yielding a value of the underlying array type,
      *not* a value of the domain, because there's no assurance that the
      domain's CHECK constraints are still satisfied.  If we're intending to
      store the result back into a domain column, we have to re-cast to the
      domain type so that constraints are re-checked.
      
      For similar reasons, such a domain can't be blindly matched to an ANYARRAY
      polymorphic parameter, because the polymorphic function is likely to apply
      array-ish operations that could invalidate the domain constraints.  For the
      moment, we just forbid such matching.  We might later wish to insert an
      automatic downcast to the underlying array type, but such a change should
      also change matching of domains to ANYELEMENT for consistency.
      
      To ensure that all such logic is rechecked, this patch removes the original
      hack of setting a domain's pg_type.typelem field to match its base type;
      the typelem will always be zero instead.  In those places where it's really
      okay to look through the domain type with no other logic changes, use the
      newly added get_base_element_type function in place of get_element_type.
      catversion bumped due to change in pg_type contents.
      
      Per bug #5717 from Richard Huxton and subsequent discussion.
      529cb267
  3. Oct 15, 2010
  4. Sep 20, 2010
  5. Aug 13, 2010
  6. Aug 08, 2010
  7. Aug 05, 2010
  8. Jul 06, 2010
  9. Mar 03, 2010
    • Tom Lane's avatar
      Export xml.c's libxml-error-handling support so that contrib/xml2 can use it · 8bf14182
      Tom Lane authored
      too, instead of duplicating the functionality (badly).
      
      I renamed xml_init to pg_xml_init, because the former seemed just a bit too
      generic to be safe as a global symbol.  I considered likewise renaming
      xml_ereport to pg_xml_ereport, but felt that the reference to ereport probably
      made it sufficiently PG-centric already.
      8bf14182
  10. Feb 14, 2010
    • Robert Haas's avatar
      Wrap calls to SearchSysCache and related functions using macros. · e26c539e
      Robert Haas authored
      The purpose of this change is to eliminate the need for every caller
      of SearchSysCache, SearchSysCacheCopy, SearchSysCacheExists,
      GetSysCacheOid, and SearchSysCacheList to know the maximum number
      of allowable keys for a syscache entry (currently 4).  This will
      make it far easier to increase the maximum number of keys in a
      future release should we choose to do so, and it makes the code
      shorter, too.
      
      Design and review by Tom Lane.
      e26c539e
  11. Jan 02, 2010
  12. Sep 04, 2009
  13. Aug 10, 2009
  14. Jun 11, 2009
  15. Jun 10, 2009
  16. Jun 08, 2009
  17. May 13, 2009
    • Tom Lane's avatar
      Rewrite xml.c's memory management (yet again). Give up on the idea of · 23543c73
      Tom Lane authored
      redirecting libxml's allocations into a Postgres context.  Instead, just let
      it use malloc directly, and add PG_TRY blocks as needed to be sure we release
      libxml data structures in error recovery code paths.  This is ugly but seems
      much more likely to play nicely with third-party uses of libxml, as seen in
      recent trouble reports about using Perl XML facilities in pl/perl and bug
      #4774 about contrib/xml2.
      
      I left the code for allocation redirection in place, but it's only
      built/used if you #define USE_LIBXMLCONTEXT.  This is because I found it
      useful to corral libxml's allocations in a palloc context when hunting
      for libxml memory leaks, and we're surely going to have more of those
      in the future with this type of approach.  But we don't want it turned on
      in a normal build because it breaks exactly what we need to fix.
      
      I have not re-indented most of the code sections that are now wrapped
      by PG_TRY(); that's for ease of review.  pg_indent will fix it.
      
      This is a pre-existing bug in 8.3, but I don't dare back-patch this change
      until it's gotten a reasonable amount of field testing.
      23543c73
  18. May 12, 2009
    • Tom Lane's avatar
      Fix intratransaction memory leaks in xml_recv, xmlconcat, xmlroot, and · 546454f8
      Tom Lane authored
      xml_parse, all arising from the same sloppy usage of parse_xml_decl.
      The original coding had that function returning its output string
      parameters in the libxml context, which is long-lived, and all but one
      of its callers neglected to free the strings afterwards.  The easiest
      and most bulletproof fix is to return the strings in the local palloc
      context instead, since that's short-lived.  This was only costing a
      dozen or two bytes per function call, but that adds up fast if the
      function is called repeatedly ...
      
      Noted while poking at the more general problem of what to do with our
      libxml memory allocation hooks.  Back-patch to 8.3, which has the
      identical coding.
      546454f8
  19. Apr 08, 2009
  20. Mar 27, 2009
  21. Mar 23, 2009
  22. Jan 07, 2009
  23. Jan 01, 2009
  24. Nov 10, 2008
  25. Oct 29, 2008
  26. Oct 14, 2008
  27. Oct 09, 2008
  28. Sep 16, 2008
  29. Aug 26, 2008
  30. Jul 03, 2008
  31. May 12, 2008
    • Alvaro Herrera's avatar
      Restructure some header files a bit, in particular heapam.h, by removing some · f8c4d7db
      Alvaro Herrera authored
      unnecessary #include lines in it.  Also, move some tuple routine prototypes and
      macros to htup.h, which allows removal of heapam.h inclusion from some .c
      files.
      
      For this to work, a new header file access/sysattr.h needed to be created,
      initially containing attribute numbers of system columns, for pg_dump usage.
      
      While at it, make contrib ltree, intarray and hstore header files more
      consistent with our header style.
      f8c4d7db
  32. May 04, 2008
  33. Apr 04, 2008
  34. Mar 25, 2008
    • Tom Lane's avatar
      Simplify and standardize conversions between TEXT datums and ordinary C · 220db7cc
      Tom Lane authored
      strings.  This patch introduces four support functions cstring_to_text,
      cstring_to_text_with_len, text_to_cstring, and text_to_cstring_buffer, and
      two macros CStringGetTextDatum and TextDatumGetCString.  A number of
      existing macros that provided variants on these themes were removed.
      
      Most of the places that need to make such conversions now require just one
      function or macro call, in place of the multiple notational layers that used
      to be needed.  There are no longer any direct calls of textout or textin,
      and we got most of the places that were using handmade conversions via
      memcpy (there may be a few still lurking, though).
      
      This commit doesn't make any serious effort to eliminate transient memory
      leaks caused by detoasting toasted text objects before they reach
      text_to_cstring.  We changed PG_GETARG_TEXT_P to PG_GETARG_TEXT_PP in a few
      places where it was easy, but much more could be done.
      
      Brendan Jurd and Tom Lane
      220db7cc
  35. Mar 24, 2008
  36. Mar 01, 2008
    • Tom Lane's avatar
      Disable the undocumented xmlvalidate() function, which was unintentionally · 3bf822c4
      Tom Lane authored
      left in the code though it was not meant to be provided.  It represents a
      security hole because unprivileged users could use it to look at (at least the
      first line of) any file readable by the backend.  Fortunately, this is only
      possible if the backend was built with XML support, so the damage is at least
      mitigated; and 8.3 probably hasn't propagated into any security-critical uses
      yet anyway.  Per report from Sergey Burladyan.
      3bf822c4
  37. Jan 15, 2008
    • Tom Lane's avatar
      Revise memory management for libxml calls. Instead of keeping libxml's data · ac12412e
      Tom Lane authored
      in whichever context happens to be current during a call of an xml.c function,
      use a dedicated context that will not go away until we explicitly delete it
      (which we do at transaction end or subtransaction abort).  This makes recovery
      after an error much simpler --- we don't have to individually delete the data
      structures created by libxml.  Also, we need to initialize and cleanup libxml
      only once per transaction (if there's no error) instead of once per function
      call, so it should be a bit faster.  We'll need to keep an eye out for
      intra-transaction memory leaks, though.  Alvaro and Tom.
      ac12412e
  38. Jan 12, 2008
Loading