[drupal-devel] [bug] pgsql _db_query() shows each query error twice

Dries drupal-devel at drupal.org
Mon Apr 25 18:02:57 UTC 2005

Issue status update for http://drupal.org/node/19942

 Project:      Drupal
 Version:      cvs
 Component:    database system
 Category:     bug reports
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  danielc
 Updated by:   Dries
 Status:       patch

We're not fond of using '@'.  I'll await feedback from Adrian, who
maintains the PostgreSQL port.  He might be able to suggest an
alternative/better fix.


Previous comments:

April 4, 2005 - 06:27 : danielc

Attachment: http://drupal.org/files/issues/database.silence.query.diff (1.2 KB)

In _db_query(), when a query error happens, the error messages are
displayed twice.  First at the point of the pg_query()/mysql_query()
call and then at the track_errors() call.  Since there is an error
handling/reporting process in place, the query calls should suppress
error output by placing @'s in front of them.  The attached patch does
that for both the database.mysql.inc and database.pgsql.inc files.


April 8, 2005 - 02:43 : danielc

Can this please be applied to 4-6 and HEAD?


April 8, 2005 - 13:41 : Dries

How can we reproduce this?  No matter what I do, I only see each error
reported once.  

(We try to avoid the use of @ to surpress errors.)


April 8, 2005 - 15:36 : danielc

Ah!  It's just happening with PostgreSQL.  I noticed it there and
assumed the same issue existed with MySQL.  Sorry for the confusion. 
Please commit to database.pgsql.inc only.


April 23, 2005 - 16:35 : danielc

Add "pgsql" to title.

Test script:


April 23, 2005 - 16:37 : danielc

The  test script got ripped out.  Perhaps because I used an opening PHP
tag w/o a closing one.  Let's try again:

// so we don't need to include bootstrap
function variable_get($name, $default) {
  return $default;
ini_set('include_path', 'd:/webroot/drupal/includes');
require_once 'database.pgsql.inc';
$db_url = 'pgsql://dropper:ak17q8l10@localhost/drupal';
$active_db = db_connect($db_url);
_db_query('a REALLY bad query');

More information about the drupal-devel mailing list