Re: [Mailman-Developers] [Bug 860159] Re: Mailman 3.0 support for Postgres
![](https://secure.gravatar.com/avatar/01aa7d6d4db83982a2f6dd363d0ee0f3.jpg?s=120&d=mm&r=g)
On Sep 27, 2011, at 12:44 AM, Stephen A. Goss wrote:
I've attached a branch with the Postgres support code that I've cooked up.
Fantastic, thanks! Do be sure to add a merge proposal.
- There is now an alternate mailman_pg.sql file which is used to create the tables. Currently, two foreign key constraints are commented out because those are violated in Mailman 3 (apparently this doesn't bother SQLite). Some column TYPES are different from mailman.sql. Classes are created in a slightly different order due to FK constraint creation requires the referenced table to actually exist. The primary key indexes defined after each class are probably redundant, as those are created automatically for SERIAL columns defined as PRIMARY KEY in Postgres.
Do you have any thoughts on whether the two .sql files can possibly be shared? My biggest concern is that it will be difficult-ish to keep them in sync as I add or modify the SQLite version. If it's not possible, so be it.
I took a quick look at the Python changes, and I think I'm going to refactor the code to not hardcode so much in stock.py. For example, I'll probably rename StockDatabase to SQLiteDatabase and add a PostgresDatabase class, adding a common super class. That way, you'd only need to put this in your mailman.cfg file:
[database] class: mailman.database.postgres.PostgresDatabase
Don't worry about that too much, I can make that change when I merge your branch.
- Probably more FK constraint violations exist that my tests haven't uncovered.
I'd definitely like to be able to run the test suite against Postgres, if even for now it's a manual select (e.g. because Postgres would obviously have to be installed and configured in order to work).
![](https://secure.gravatar.com/avatar/5b1db63e7cdbec3744998ce8cd44994b.jpg?s=120&d=mm&r=g)
On 09/26/2011 09:03 PM, Barry Warsaw wrote:
Currently, two foreign key constraints are commented out
because those are violated in Mailman 3 (apparently this doesn't bother SQLite).
Foreign key constraints are available in sqlite 3.6.19 and above. They are turned off by default. They can be enabled with:
PRAGMA foreign_keys = ON;
More details at: http://www.sqlite.org/foreignkeys.html
![](https://secure.gravatar.com/avatar/01aa7d6d4db83982a2f6dd363d0ee0f3.jpg?s=120&d=mm&r=g)
On Sep 26, 2011, at 09:11 PM, Dan MacNeil wrote:
Foreign key constraints are available in sqlite 3.6.19 and above. They are turned off by default. They can be enabled with:
PRAGMA foreign_keys = ON;
More details at: http://www.sqlite.org/foreignkeys.html
Thanks. AFAICT, Ubuntu's sqlite3 package is compiled with this enabled, and adding this line to mailman.sql still passes all the tests.
-Barry
participants (2)
-
Barry Warsaw
-
Dan MacNeil