1. 13 6月, 2013 2 次提交
    • A
      Fix unescaping of JSON Unicode escapes, especially for non-UTF8. · 78ed8e03
      Andrew Dunstan 提交于
      Per discussion  on -hackers. We treat Unicode escapes when unescaping
      them similarly to the way we treat them in PostgreSQL string literals.
      Escapes in the ASCII range are always accepted, no matter what the
      database encoding. Escapes for higher code points are only processed in
      UTF8 databases, and attempts to process them in other databases will
      result in an error. \u0000 is never unescaped, since it would result in
      an impermissible null byte.
      78ed8e03
    • R
      Improve description of loread/lowrite. · c1d729b4
      Robert Haas 提交于
      Patch by me, reviewed by Tatsuo Ishii.
      c1d729b4
  2. 12 6月, 2013 1 次提交
    • T
      Fix cache flush hazard in cache_record_field_properties(). · e262755b
      Tom Lane 提交于
      We need to increment the refcount on the composite type's cached tuple
      descriptor while we do lookups of its column types.  Otherwise a cache
      flush could occur and release the tuple descriptor before we're done with
      it.  This fails reliably with -DCLOBBER_CACHE_ALWAYS, but the odds of a
      failure in a production build seem rather low (since the pfree'd descriptor
      typically wouldn't get scribbled on immediately).  That may explain the
      lack of any previous reports.  Buildfarm issue noted by Christian Ullrich.
      
      Back-patch to 9.1 where the bogus code was added.
      e262755b
  3. 11 6月, 2013 2 次提交
    • T
      Add description that loread()/lowrite() are corresponding to · ecdec470
      Tatsuo Ishii 提交于
      lo_read()/lo_write() in libpq to avoid confusion.
      ecdec470
    • F
      Fix pg_isready to handle conninfo properly. · 941c4ece
      Fujii Masao 提交于
      pg_isready displays the host name and the port number that it uses to connect
      to the server. So far, pg_isready didn't use the conninfo specified in -d option
      for calculating those host name and port number. This can lead to wrong display
      to a user. This commit changes pg_isready so that it uses the conninfo for that
      calculation.
      
      Original patch by Phil Sorber, modified by me.
      941c4ece
  4. 10 6月, 2013 5 次提交
    • J
      Fix ordering of obj id for Rules and EventTriggers in pg_dump. · 33a4466f
      Joe Conway 提交于
      getSchemaData() must identify extension member objects and mark them
      as not to be dumped. This must happen after reading all objects that can be
      direct members of extensions, but before we begin to process table subsidiary
      objects. Both rules and event triggers were wrong in this regard.
      
      Backport rules portion of patch to 9.1 -- event triggers do not exist prior to 9.3.
      Suggested fix by Tom Lane, initial complaint and patch by me.
      33a4466f
    • T
      Tweak postgres_fdw regression test so autovacuum doesn't change results. · e0b451e4
      Tom Lane 提交于
      Autovacuum occurring while the test runs could allow some of the inserts to
      go into recycled space, thus changing the output ordering of later queries.
      While we could complicate those queries to force sorting of their output
      rows, it doesn't seem like that would make the test better in any
      meaningful way, and conceivably it could hide unexpected diffs.  Instead,
      tweak the affected queries so that the inserted rows aren't updated by the
      following UPDATE.  Per buildfarm.
      e0b451e4
    • T
      Remove unnecessary restrictions about RowExprs in transformAExprIn(). · a4424c57
      Tom Lane 提交于
      When the existing code here was written, it made sense to special-case
      RowExprs because that was the only way that we could handle row comparisons
      at all.  Now that we have record_eq() and arrays of composites, the generic
      logic for "scalar" types will in fact work on RowExprs too, so there's no
      reason to throw error for combinations of RowExprs and other ways of
      forming composite values, nor to ignore the possibility of using a
      ScalarArrayOpExpr.  But keep using the old logic when comparing two
      RowExprs, for consistency with the main transformAExprOp() logic.  (This
      allows some cases with not-quite-identical rowtypes to succeed, so we might
      get push-back if we removed it.)  Per bug #8198 from Rafal Rzepecki.
      
      Back-patch to all supported branches, since this works fine as far back as
      8.4.
      
      Rafal Rzepecki and Tom Lane
      a4424c57
    • T
      Remove ALTER DEFAULT PRIVILEGES' requirement of schema CREATE permissions. · f3839ea1
      Tom Lane 提交于
      Per discussion, this restriction isn't needed for any real security reason,
      and it seems to confuse people more often than it helps them.  It could
      also result in some database states being unrestorable.  So just drop it.
      
      Back-patch to 9.0, where ALTER DEFAULT PRIVILEGES was introduced.
      f3839ea1
    • T
      Remove fixed limit on the number of concurrent AllocateFile() requests. · 007556bf
      Tom Lane 提交于
      AllocateFile(), AllocateDir(), and some sister routines share a small array
      for remembering requests, so that the files can be closed on transaction
      failure.  Previously that array had a fixed size, MAX_ALLOCATED_DESCS (32).
      While historically that had seemed sufficient, Steve Toutant pointed out
      that this meant you couldn't scan more than 32 file_fdw foreign tables in
      one query, because file_fdw depends on the COPY code which uses
      AllocateFile().  There are probably other cases, or will be in the future,
      where this nonconfigurable limit impedes users.
      
      We can't completely remove any such limit, at least not without a lot of
      work, since each such request requires a kernel file descriptor and most
      platforms limit the number we can have.  (In principle we could
      "virtualize" these descriptors, as fd.c already does for the main VFD pool,
      but not without an additional layer of overhead and a lot of notational
      impact on the calling code.)  But we can at least let the array size be
      configurable.  Hence, change the code to allow up to max_safe_fds/2
      allocated file requests.  On modern platforms this should allow several
      hundred concurrent file_fdw scans, or more if one increases the value of
      max_files_per_process.  To go much further than that, we'd need to do some
      more work on the data structure, since the current code for closing
      requests has potentially O(N^2) runtime; but it should still be all right
      for request counts in this range.
      
      Back-patch to 9.1 where contrib/file_fdw was introduced.
      007556bf
  5. 08 6月, 2013 3 次提交
    • A
      Don't downcase non-ascii identifier chars in multi-byte encodings. · d535136b
      Andrew Dunstan 提交于
      Long-standing code has called tolower() on identifier character bytes
      with the high bit set. This is clearly an error and produces junk output
      when the encoding is multi-byte. This patch therefore restricts this
      activity to cases where there is a character with the high bit set AND
      the encoding is single-byte.
      
      There have been numerous gripes about this, most recently from Martin
      Schäfer.
      
      Backpatch to all live releases.
      d535136b
    • A
      Handle Unicode surrogate pairs correctly when processing JSON. · 94e3311b
      Andrew Dunstan 提交于
      In 9.2, Unicode escape sequences are not analysed at all other than
      to make sure that they are in the form \uXXXX. But in 9.3 many of the
      new operators and functions try to turn JSON text values into text in
      the server encoding, and this includes de-escaping Unicode escape
      sequences. This processing had not taken into account the possibility
      that this might contain a surrogate pair to designate a character
      outside the BMP. That is now handled correctly.
      
      This also enforces correct use of surrogate pairs, something that is not
      done by the type's input routines. This fact is noted in the docs.
      94e3311b
    • P
      doc: Fix <synopsis> in <term> markup · c99d5d1b
      Peter Eisentraut 提交于
      Although the DTD technically allows this, the resulting HTML is invalid
      because it puts block elements inside inline elements.  DocBook 5.0 also
      doesn't allow it anymore, so it's fair to assume that this was never
      really intended to work.  Replace <synopsis> with <literal>, which is
      the markup used elsewhere in the documentation in similar cases.
      c99d5d1b
  6. 07 6月, 2013 3 次提交
  7. 06 6月, 2013 6 次提交
    • H
      Fix typo in comment. · f73cb556
      Heikki Linnakangas 提交于
      f73cb556
    • R
      Ensure that XLOG_HEAP2_VISIBLE always targets an initialized page. · a6370fd9
      Robert Haas 提交于
      Andres Freund
      a6370fd9
    • B
      pg_upgrade: document that --link should be used with --check · e2c84bc9
      Bruce Momjian 提交于
      Backpatch to 9.2.
      e2c84bc9
    • T
      Prevent pushing down WHERE clauses into unsafe UNION/INTERSECT nests. · 964c0d0f
      Tom Lane 提交于
      The planner is aware that it mustn't push down upper-level quals into
      subqueries if the quals reference subquery output columns that contain
      set-returning functions or volatile functions, or are non-DISTINCT outputs
      of a DISTINCT ON subquery.  However, it missed making this check when
      there were one or more levels of UNION or INTERSECT above the dangerous
      expression.  This could lead to "set-valued function called in context that
      cannot accept a set" errors, as seen in bug #8213 from Eric Soroos, or to
      silently wrong answers in the other cases.
      
      To fix, refactor the checks so that we make the column-is-unsafe checks
      during subquery_is_pushdown_safe(), which already has to recursively
      inspect all arms of a set-operation tree.  This makes
      qual_is_pushdown_safe() considerably simpler, at the cost that we will
      spend some cycles checking output columns that possibly aren't referenced
      in any upper qual.  But the cases where this code gets executed at all
      are already nontrivial queries, so it's unlikely anybody will notice any
      slowdown of planning.
      
      This has been broken since commit 05f916e6,
      which makes the bug over ten years old.  A bit surprising nobody noticed it
      before now.
      964c0d0f
    • P
      Update SQL features list · a3bd6096
      Peter Eisentraut 提交于
      a3bd6096
    • T
      Put analyze_keyword back in explain_option_name production. · 3f783c88
      Tom Lane 提交于
      In commit 2c92edad, I broke "EXPLAIN
      (ANALYZE)" syntax, because I mistakenly thought that ANALYZE/ANALYSE were
      only partially reserved and thus would be included in NonReservedWord;
      but actually they're fully reserved so they still need to be called out
      here.
      
      A nicer solution would be to demote these words to type_func_name_keyword
      status (they can't be less than that because of "VACUUM [ANALYZE] ColId").
      While that works fine so far as the core grammar is concerned, it breaks
      ECPG's grammar for reasons I don't have time to isolate at the moment.
      So do this for the time being.
      
      Per report from Kevin Grittner.  Back-patch to 9.0, like the previous
      commit.
      3f783c88
  8. 05 6月, 2013 3 次提交
    • T
      Provide better message when CREATE EXTENSION can't find a target schema. · 530acda4
      Tom Lane 提交于
      The new message (and SQLSTATE) matches the corresponding error cases in
      namespace.c.
      
      This was thought to be a "can't happen" case when extension.c was written,
      so we didn't think hard about how to report it.  But it definitely can
      happen in 9.2 and later, since we no longer require search_path to contain
      any valid schema names.  It's probably also possible in 9.1 if search_path
      came from a noninteractive source.  So, back-patch to all releases
      containing this code.
      
      Per report from Sean Chittenden, though this isn't exactly his patch.
      530acda4
    • T
      Add ARM64 (aarch64) support to s_lock.h. · 5c7603c3
      Tom Lane 提交于
      Use the same gcc atomic functions as we do on newer ARM chips.
      (Basically this is a copy and paste of the __arm__ code block,
      but omitting the SWPB option since that definitely won't work.)
      
      Back-patch to 9.2.  The patch would work further back, but we'd also
      need to update config.guess/config.sub in older branches to make them
      build out-of-the-box, and there hasn't been demand for it.
      
      Mark Salter
      5c7603c3
    • T
      Fix memory leak in LogStandbySnapshot(). · dbc6eb1f
      Tom Lane 提交于
      The array allocated by GetRunningTransactionLocks() needs to be pfree'd
      when we're done with it.  Otherwise we leak some memory during each
      checkpoint, if wal_level = hot_standby.  This manifests as memory bloat
      in the checkpointer process, or in bgwriter in versions before we made
      the checkpointer separate.
      
      Reported and fixed by Naoya Anzai.  Back-patch to 9.0 where the issue
      was introduced.
      
      In passing, improve comments for GetRunningTransactionLocks(), and add
      an Assert that we didn't overrun the palloc'd array.
      dbc6eb1f
  9. 04 6月, 2013 2 次提交
    • H
      Fix off-by-one in pg_xlogdump -r option. · 79e15c7d
      Heikki Linnakangas 提交于
      Because of the bug, -r would not accept the rmgr with the highest ID.
      79e15c7d
    • T
      Add semicolons to eval'd strings to hide a minor Perl behavioral change. · 035a5e1e
      Tom Lane 提交于
      "eval q{foo}" used to complain that the error was on line 2 of the eval'd
      string, because eval internally tacked on "\n;" so that the end of the
      erroneous command was indeed on line 2.  But as of Perl 5.18 it more
      sanely says that the error is on line 1.  To avoid Perl-version-dependent
      regression test results, use "eval q{foo;}" instead in the two places
      where this matters.  Per buildfarm.
      
      Since people might try to use newer Perl versions with older PG releases,
      back-patch as far as 9.0 where these test cases were added.
      035a5e1e
  10. 03 6月, 2013 4 次提交
    • H
      Put back allow_system_table_mods check in heap_create(). · 15386281
      Heikki Linnakangas 提交于
      This reverts commit a475c603.
      
      Erik Rijkers reported back in January 2013 that after the patch, if you do
      "pg_dump -t myschema.mytable" to dump a single table, and restore that in
      a database where myschema does not exist, the table is silently created in
      pg_catalog instead. That is because pg_dump uses
      "SET search_path=myschema, pg_catalog" to set schema the table is created
      in. While allow_system_table_mods is not a very elegant solution to this,
      we can't leave it as it is, so for now, revert it back to the way it was
      previously.
      15386281
    • S
      Additional spelling corrections · f129615f
      Stephen Frost 提交于
      A few more minor spelling corrections, no functional changes.
      
      Thom Brown
      f129615f
    • H
      Code review of recycling WAL segments in a restartpoint. · e1e2bb34
      Heikki Linnakangas 提交于
      Seems cleaner to get the currently-replayed TLI in the same call to
      GetXLogReplayRecPtr that we get the WAL position. Make it more clear in the
      comment what the code does when recovery has already ended
      (RecoveryInProgress() will set ThisTimeLineID in that case). Finally, make
      resetting ThisTimeLineID afterwards more explicit.
      e1e2bb34
    • T
      Allow type_func_name_keywords in some places where they weren't before. · 2c92edad
      Tom Lane 提交于
      This change makes type_func_name_keywords less reserved than they were
      before, by allowing them for role names, language names, EXPLAIN and COPY
      options, and SET values for GUCs; which are all places where few if any
      actual keywords could appear instead, so no new ambiguities are introduced.
      
      The main driver for this change is to allow "COPY ... (FORMAT BINARY)"
      to work without quoting the word "binary".  That is an inconsistency that
      has been complained of repeatedly over the years (at least by Pavel Golub,
      Kurt Lidl, and Simon Riggs); but we hadn't thought of any non-ugly solution
      until now.
      
      Back-patch to 9.0 where the COPY (FORMAT BINARY) syntax was introduced.
      2c92edad
  11. 02 6月, 2013 3 次提交
  12. 01 6月, 2013 5 次提交
  13. 31 5月, 2013 1 次提交