PostgreSQL: Improve SQL error handling
authorMarcin Cieślak <saper@users.mediawiki.org>
Thu, 8 Mar 2012 21:44:03 +0000 (21:44 +0000)
committerMarcin Cieślak <saper@users.mediawiki.org>
Thu, 8 Mar 2012 21:44:03 +0000 (21:44 +0000)
commit94633ff448e9253c5503124df6748be1fc26b8e2
treee8818433f5712c1cc56ed82d2243595043a1f925
parentd8ef87afbf619ece4e219144ab5b348878e9cc60
PostgreSQL: Improve SQL error handling

After a query error, PostgreSQL transaction is aborted
until it's terminated or the query is closed.

All further queries result in:

  ERROR: current transaction is aborted, commands ignored
  until end of transaction block

Those subsequent errors are ignored by double fault handling in
DatabaseBase::reportQueryError but they cause all localization
of error messages to fail (unable to issue queries to message
tables) and errors lke

This resulted in a broken MediaWiki screen with

  <databaseerror>
  <dberrortext>

instead of localized error message.

We need to fully reset database connection because after
pg_connection_reset() various session parameters need to
be set again (like "search_path"), otherwise tables will not be
found.

   ERROR: relation "msg_resource" does not exist
   ERROR:  relation "l10n_cache" does not exist
includes/db/DatabasePostgres.php