The New Database Compatibility Layer

Maxwell Kanat-Alexander mkanat at
Wed Feb 16 18:29:45 UTC 2005

	As of just now, I have checked in the new cross-database-compatibility
layer for Bugzilla. It was written by Tomas Kopal, and reviewed a lot by
me. Thanks also to all the people who have helped with PostgreSQL
support over time, which means almost everybody who's commented on bug
98304 or bug 237862.

	What You Need to Know

	Bugzilla is not yet cross-database compatible, but this means that we
are almost there.

	There are some important things to know, from now on, about using the
database in Bugzilla:

	+ Any non-cross-database SQL has a function that corresponds to it in
Bugzilla::DB. You access this function through Bugzilla->dbh. Functions
that return sql start with "sql_". Functions that return data or perform
an action start with "bz_".

	For example:

	+ Instead of doing "LOCK TABLES bugs WRITE, products READ", you would
now do:

	Bugzilla->dbh->bz_lock_tables("bugs WRITE", "products READ");

	+ Instead of doing "WHERE login_name REGEXP 'mka.*'", you would now do:

	"WHERE login_name " . Bugzilla->dbh->sql_regexp() . " 'mka.*"

	The POD docs on Bugzilla::DB are very good, so read them if you need
some help.

	No new patch that uses incompatible SQL should be given review+.

	Existing review+ patches should be looked over for this SQL before they
are checked-in.

	Adding New Functions

	If you need to add a new function to the DB layer while you write a
patch, that's OK. The only times we need to add a function is when not
all the databases that we support have some ANSI-standard way of doing a
SQL call. For example, we don't need a function for MySQL's IFNULL,
because the ANSI-standard COALESCE works in all DBs that we currently

	When you add a new function, you must add it to the list of required
functions in Bugzilla::DB (@_abstract_methods), and to all the database
"drivers" we currently ship (which at the moment are MySQL and

	The Immediate Future

	I will be checking-in and reviewing patches over the next few days to
make existing Bugzilla code use the new Bugzilla::DB code. I am usually
around in IRC, so if you have any regressions come up, please let me
know. You can also file bugs and CC me on them.

	The next step is to get installation fully cross-DB compatible, which I
and Edward Sabol are working on.

	Any help with any of the blockers of bug 98304 would be appreciated.

	For Bugzilla 2.20

	I expect to have "experimental" support for PostgreSQL by Bugzilla
2.20. That is, it should work on all our testing installations, but I
wouldn't yet guarantee it for large, public, high-volume installations.

	By Bugzilla 2.22, I expect PostgreSQL support to be completely on par
with MySQL support.

	Minimum Verison of PostgreSQL

	Right now, I suspect that the minimum version of PostgreSQL that we
will support will be either 7.3. I'm not sure if anything prevents us
from supporting 7.2, but I also don't think that we will have any
testing installations that use 7.2.

	I'd like to shoot for 7.3 support because that's what Red Hat
Enterprise Linux 3 is shipping with nowadays. I'm pretty sure it
supports everything that we need.

Max Kanat-Alexander
Technical Support Manager, USA
Kerio Technologies, Inc.
2350 Mission College Blvd., Suite 400
Santa Clara, CA 95054
Phone: (408) 496-2500
Fax: (408) 496-6902

More information about the developers mailing list