1. 24 Jun, 2018 1 commit
  2. 23 Jun, 2018 3 commits
  3. 22 Jun, 2018 6 commits
  4. 21 Jun, 2018 6 commits
  5. 20 Jun, 2018 11 commits
  6. 19 Jun, 2018 5 commits
  7. 18 Jun, 2018 8 commits
    • Tom Lane's avatar
      Fix jsonb_plperl to convert Perl UV values correctly. · 93b6e03a
      Tom Lane authored
      Values greater than IV_MAX were incorrectly converted to SQL,
      for instance ~0 would become -1 rather than 18446744073709551615
      (on a 64-bit machine).
      
      Dagfinn Ilmari Mannsåker, adjusted a bit by me
      
      Discussion: https://postgr.es/m/d8jtvskjzzs.fsf@dalvik.ping.uio.no
      93b6e03a
    • Tom Lane's avatar
      Fix contrib/hstore_plperl to look through scalar refs. · e3b7f7cc
      Tom Lane authored
      Bring this transform function into sync with the policy established
      by commit 3a382983.
      
      Also, fix it to make sure that what it drills down to is indeed a
      hash, and not some other kind of Perl SV.  Previously, the test
      cases added here provoked crashes.
      
      Because of the crash hazard, back-patch to 9.5 where this module
      was introduced.
      
      Discussion: https://postgr.es/m/28336.1528393969@sss.pgh.pa.us
      e3b7f7cc
    • Tom Lane's avatar
      Allow plperl_sv_to_datum to look through scalar refs. · 3a382983
      Tom Lane authored
      There seems little reason for the policy of throwing error if we
      find a ref to something other than a hash or array.   Recursively
      look through the ref, instead.  This makes the behavior in non-transform
      cases comparable to what was already instantiated for jsonb_plperl.
      
      Note that because we invoke any available transform function before
      considering the ref case, it's up to each transform function whether
      it wants to play along with this behavior or do something different.
      
      Because the previous behavior was just to throw a useless error,
      this seems unlikely to create any compatibility issues.  Still, given
      the lack of field complaints so far, seems best not to back-patch.
      
      Discussion: https://postgr.es/m/28336.1528393969@sss.pgh.pa.us
      3a382983
    • Tom Lane's avatar
      Avoid platform-dependent output from Data::Dumper. · e4300a35
      Tom Lane authored
      Per buildfarm, the output from Data::Dumper for an IEEE infinity
      is platform-dependent (e.g. "inf" vs "Inf").  Just skip that one
      test case in the plperlu test; testing it on the plperl side is
      coverage enough.  Fixes issue in commit 1731e374.
      e4300a35
    • Tom Lane's avatar
      Fix excessive enreferencing in jsonb-to-plperl transform. · 1731e374
      Tom Lane authored
      We want, say, 2 to be transformed as 2, not \\2 which is what the
      original coding produced.  Perl's standard seems to be to add an RV
      wrapper only for hash and array SVs, so do it like that.
      
      This was missed originally because the test cases only checked what came
      out of a round trip back to SQL, and the strip-all-dereferences loop at
      the top of SV_to_JsonbValue hides the extra refs from view.  As a better
      test, print the Perl value with Data::Dumper, like the hstore_plperlu
      tests do.  While we can't do that in the plperl test, only plperlu,
      that should be good enough because this code is the same for both PLs.
      But also add a simplistic test for extra REFs, which we can do in both.
      
      That strip-all-dereferences behavior is now a bit dubious; it's unlike
      what happens for other Perl-to-SQL conversions.  However, the best
      thing to do seems to be to leave it alone and make the other conversions
      act similarly.  That will be done separately.
      
      Dagfinn Ilmari Mannsåker, adjusted a bit by me
      
      Discussion: https://postgr.es/m/d8jlgbq66t9.fsf@dalvik.ping.uio.no
      1731e374
    • Tom Lane's avatar
      Remove obsolete prohibition on function name matching a column name. · 45e98ee7
      Tom Lane authored
      ProcedureCreate formerly threw an error if the function to be created
      has one argument of composite type and the function name matches some
      column of the composite type.  This was a (very non-bulletproof) defense
      against creating situations where f(x) and x.f are ambiguous.  But we
      don't really need such a defense in the wake of commit b97a3465, which
      allows us to deal with such situations fairly cleanly.  This behavior
      also created a dump-and-reload hazard, since a function might be
      rejected if a conflicting column name had been added to the input
      composite type later.  Hence, let's just drop the check.
      
      Discussion: https://postgr.es/m/CAOW5sYa3Wp7KozCuzjOdw6PiOYPi6D=VvRybtH2S=2C0SVmRmA@mail.gmail.com
      45e98ee7
    • Tom Lane's avatar
      Consider syntactic form when disambiguating function vs column reference. · b97a3465
      Tom Lane authored
      Postgres has traditionally considered the syntactic forms f(x) and x.f
      to be equivalent, allowing tricks such as writing a function and then
      using it as though it were a computed-on-demand column.  However, our
      behavior when both interpretations are feasible left something to be
      desired: we always chose the column interpretation.  This could lead
      to very surprising results, as in a recent bug report from Neil Conway.
      It also created a dump-and-reload hazard, since what was a function
      call in a dumped view could get interpreted as a column reference
      at reload, if a matching column name had been added to the underlying
      table since the view was created.
      
      What seems better, in ambiguous situations, is to prefer the choice
      matching the syntactic form of the reference.  This seems much less
      astonishing in general, and it fixes the dump/reload hazard.
      
      Although this could be called a bug fix, there have been few complaints
      and there's some small risk of breaking applications that depend on the
      old behavior, so no back-patch.  It does seem reasonable to slip it
      into v11, though.
      
      Discussion: https://postgr.es/m/CAOW5sYa3Wp7KozCuzjOdw6PiOYPi6D=VvRybtH2S=2C0SVmRmA@mail.gmail.com
      b97a3465
    • Thomas Munro's avatar
      Add PGTYPESchar_free() to avoid cross-module problems on Windows. · 4c8156d8
      Thomas Munro authored
      On Windows, it is sometimes important for corresponding malloc() and
      free() calls to be made from the same DLL, since some build options can
      result in multiple allocators being active at the same time.  For that
      reason we already provided PQfreemem().  This commit adds a similar
      function for freeing string results allocated by the pgtypes library.
      
      Author: Takayuki Tsunakawa
      Reviewed-by: Kyotaro Horiguchi
      Discussion: https://postgr.es/m/0A3221C70F24FB45833433255569204D1F8AD5D6%40G01JPEXMBYT05
      4c8156d8