1. 28 May, 2010 4 commits
    • Tom Lane's avatar
      Rewrite LIKE's %-followed-by-_ optimization so it really works (this time · dbde97cd
      Tom Lane authored
      for sure ;-)).  It now also optimizes more cases, such as %_%_.  Improve
      comments too.  Per bug #5478.
      
      In passing, also rename the TCHAR macro to GETCHAR, because pgindent is
      messing with the formatting of the former (apparently it now thinks TCHAR
      is a typedef name).
      
      Back-patch to 8.3, where the bug was introduced.
      dbde97cd
    • Itagaki Takahiro's avatar
      PGDLLEXPORT is __declspec (dllexport) only on MSVC, · e54b0cba
      Itagaki Takahiro authored
      but is __declspec (dllimport) on other compilers
      because cygwin and mingw don't like dllexport.
      e54b0cba
    • Heikki Linnakangas's avatar
      Update High Availability docs. Clarify terms master/primary standby/slave, · fe76f93d
      Heikki Linnakangas authored
      move two paragraphs that apply to log shipping in general from the
      "Alternative method for log shipping" section to the earlier sections.
      Add varname tags where missing. Some small wording changes.
      fe76f93d
    • Tom Lane's avatar
      Rejigger mergejoin logic so that a tuple with a null in the first merge column · f39d57b8
      Tom Lane authored
      is treated like end-of-input, if nulls sort last in that column and we are not
      doing outer-join filling for that input.  In such a case, the tuple cannot
      join to anything from the other input (because we assume mergejoinable
      operators are strict), and neither can any tuple following it in the sort
      order.  If we're not interested in doing outer-join filling we can just
      pretend the tuple and its successors aren't there at all.  This can save a
      great deal of time in situations where there are many nulls in the join
      column, as in a recent example from Scott Marlowe.  Also, since the planner
      tends to not count nulls in its mergejoin scan selectivity estimates, this
      is an important fix to make the runtime behavior more like the estimate.
      
      I regard this as an omission in the patch I wrote years ago to teach mergejoin
      that tuples containing nulls aren't joinable, so I'm back-patching it.  But
      only to 8.3 --- in older versions, we didn't have a solid notion of whether
      nulls sort high or low, so attempting to apply this optimization could break
      things.
      f39d57b8
  2. 27 May, 2010 8 commits
    • Tom Lane's avatar
      Change ps_status.c to explicitly track the current logical length of ps_buffer. · ede50726
      Tom Lane authored
      This saves cycles in get_ps_display() on many popular platforms, and more
      importantly ensures that get_ps_display() will correctly return an empty
      string if init_ps_display() hasn't been called yet.  Per trouble report
      from Ray Stell, in which log_line_prefix %i produced junk early in backend
      startup.
      
      Back-patch to 8.0.  7.4 doesn't have %i and its version of get_ps_display()
      makes no pretense of avoiding pad junk anyhow.
      ede50726
    • Peter Eisentraut's avatar
    • Tom Lane's avatar
      Fix the volatility marking of textanycat() and anytextcat(): they were marked · c82d931d
      Tom Lane authored
      immutable, but that is wrong in general because the cast from the polymorphic
      argument to text could be stable or even volatile.  Mark them volatile for
      safety.  In the typical case where the cast isn't volatile, the planner will
      deduce the correct expression volatility after inlining the function, so
      performance is not lost.  The just-committed fix in CREATE INDEX also ensures
      this won't break any indexing cases that ought to be allowed.
      
      Per discussion, I'm not bumping catversion for this change, as it doesn't
      seem critical enough to force an initdb on beta testers.
      c82d931d
    • Tom Lane's avatar
      Make CREATE INDEX run expression preprocessing on a proposed index expression · 5a86e5e1
      Tom Lane authored
      before it checks whether the expression is immutable.  This covers two cases
      that were previously handled poorly:
      
      1. SQL function inlining could reduce the apparent volatility of the
      expression, allowing an expression to be accepted where it previously would
      not have been.  As an example, polymorphic functions must be marked with the
      worst-case volatility they have for any argument type, but for specific
      argument types they might not be so volatile, so indexing could be allowed.
      (Since the planner will refuse to inline functions in cases where the
      apparent volatility of the expression would increase, this won't break
      any cases that were accepted before.)
      
      2. A nominally immutable function could have default arguments that are
      volatile expressions.  In such a case insertion of the defaults will increase
      both the apparent and actual volatility of the expression, so it is
      *necessary* to check this before allowing the expression to be indexed.
      
      Back-patch to 8.4, where default arguments were introduced.
      5a86e5e1
    • Itagaki Takahiro's avatar
      Mark PG_MODULE_MAGIC and PG_FUNCTION_INFO_V1 with PGDLLEXPORT · 77e50a61
      Itagaki Takahiro authored
      independently from BUILDING_DLL. It is always __declspec(dllexport).
      77e50a61
    • Heikki Linnakangas's avatar
      Make it more clear that you need to release savepoint with · aa5bec67
      Heikki Linnakangas authored
      RELEASE SAVEPOINT to make an older savepoint with the same name
      accessible. It's also possible to implicitly release the savepoint by
      rolling back to an earlier savepoint, but mentioning that too would make
      the note just more verbose and confusing.
      aa5bec67
    • Robert Haas's avatar
      Avoid starting walreceiver in states where it shouldn't be running. · 5e85315e
      Robert Haas authored
      In particular, it's bad to start walreceiver when in state
      PM_WAIT_BACKENDS, because we have no provision to kill walreceiver
      when in that state.
      
      Fujii Masao
      5e85315e
    • Heikki Linnakangas's avatar
      c5bd8fea
  3. 26 May, 2010 13 commits
    • Bruce Momjian's avatar
      Fix SGML markup · f495020e
      Bruce Momjian authored
      f495020e
    • Tom Lane's avatar
      Improve SSL-related documentation. Explain how to deal with certificate · 1e6b654e
      Tom Lane authored
      chains, do assorted wordsmithing.
      1e6b654e
    • Bruce Momjian's avatar
    • Heikki Linnakangas's avatar
      Thinko in previous commit: ensure that MAX_SEND_SIZE is always greater · fbcdff39
      Heikki Linnakangas authored
      than XLOG_BLCKSZ, by defining it as 16 * XLOG_BLCKSZ rather than directly
      as 128k bytes.
      fbcdff39
    • Heikki Linnakangas's avatar
      In walsender, don't sleep if there's outstanding WAL waiting to be sent, · ea551608
      Heikki Linnakangas authored
      otherwise we effectively rate-limit the streaming as pointed out by
      Simon Riggs. Also, send the WAL in smaller chunks, to respond to signals
      more promptly.
      ea551608
    • Tom Lane's avatar
      Rearrange libpq's SSL initialization to simplify it and make it handle some · 4ed4b6c5
      Tom Lane authored
      additional cases correctly.  The original coding failed to load additional
      (chain) certificates from the client cert file, meaning that indirectly signed
      client certificates didn't work unless one hacked the server's root.crt file
      to include intermediate CAs (not the desired approach).  Another problem was
      that everything got loaded into the shared SSL_context object, which meant
      that concurrent connections trying to use different sslcert settings could
      well fail due to conflicting over the single available slot for a keyed
      certificate.
      
      To fix, get rid of the use of SSL_CTX_set_client_cert_cb(), which is
      deprecated anyway in the OpenSSL documentation, and instead just
      unconditionally load the client cert and private key during connection
      initialization.  This lets us use SSL_CTX_use_certificate_chain_file(),
      which does the right thing with additional certs, and is lots simpler than
      the previous hacking about with BIO-level access.  A small disadvantage is
      that we have to load the primary client cert a second time with
      SSL_use_certificate_file, so that that one ends up in the correct slot
      within the connection's SSL object where it can get paired with the key.
      Given the other overhead of making an SSL connection, that doesn't seem
      worth worrying about.
      
      Per discussion ensuing from bug #5468.
      4ed4b6c5
    • Tom Lane's avatar
      Fix bogus error message for SSL-cert authentication, due to lack of · 0d046a4d
      Tom Lane authored
      a uaCert entry in auth_failed().  Put the switch entries into a sane
      order, namely the one the enum is declared in.
      0d046a4d
    • Simon Riggs's avatar
      HS Defer buffer pin deadlock check until deadlock_timeout has expired. · f9dbac94
      Simon Riggs authored
      During Hot Standby we need to check for buffer pin deadlocks when the
      Startup process begins to wait, in case it never wakes up again. We
      previously made the deadlock check immediately on the basis it was
      cheap, though clearer thinking and prima facie evidence shows that
      was too simple. Refactor existing code to make it easy to add in
      deferral of deadlock check until deadlock_timeout allowing a good
      reduction in deadlock checks since far few buffer pins are held for
      that duration. It's worth doing anyway, though major goal is to
      prevent further reports of context switching with high numbers of
      users on occasional tests.
      f9dbac94
    • Robert Haas's avatar
      Fix psql help: \da+ is same as \da, but \daS is not. · 5234a952
      Robert Haas authored
      Noted by Stephen Frost.
      5234a952
    • Tom Lane's avatar
      The message style police pay a visit to hba.c. · af5be8bd
      Tom Lane authored
      af5be8bd
    • Tom Lane's avatar
      b1993a61
    • Tom Lane's avatar
      Tell openssl to include the names of the root certs the server trusts in · c3bf3bf2
      Tom Lane authored
      requests for client certs.  This lets a client with a keystore select the
      appropriate client certificate to send.  In particular, this is necessary
      to get Java clients to work in all but the most trivial configurations.
      Per discussion of bug #5468.
      
      Craig Ringer
      c3bf3bf2
    • Robert Haas's avatar
      More fixes for shutdown during recovery. · 615704af
      Robert Haas authored
      1. If we receive a fast shutdown request while in the PM_STARTUP state,
      process it just as we would in PM_RECOVERY, PM_HOT_STANDBY, or PM_RUN.
      Without this change, an early fast shutdown followed by Hot Standby causes
      the database to get stuck in a state where a shutdown is pending (so no new
      connections are allowed) but the shutdown request is never processed unless
      we end Hot Standby and enter normal running.
      
      2. Avoid removing the backup label file when a smart or fast shutdown occurs
      during recovery.  It makes sense to do this once we've reached normal running,
      since we must be taking a backup which now won't be valid.  But during
      recovery we must be recovering from a previously taken backup, and any backup
      label file is needed to restart recovery from the right place.
      
      Fujii Masao and Robert Haas
      615704af
  4. 25 May, 2010 10 commits
  5. 24 May, 2010 3 commits
  6. 23 May, 2010 2 commits