From e54c45b7d1b8bbb59526cc7d99e8700e58f81bbb Mon Sep 17 00:00:00 2001 From: Mika Bostrom Date: Sat, 19 Sep 2009 11:44:06 +0300 Subject: [PATCH] Fix database creation with Postgres * Database.py : fillDefaultData() PostgreSQL has a rather annoying (mis)feature when dealing with boolean data types: raw 1/0 input as integer is not automatically cast to boolean values. Instead, one must use one of several other ways of signifying true/false. http://www.postgresql.org/docs/8.4/static/datatype-boolean.html documents the available and understood formatting. Fix by special-casing PostgreSQL and making all boolean values fed as strings, '1' for true and '0' for false. --- pyfpdb/Database.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index f4de8169..53e2a10e 100755 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -1014,6 +1014,8 @@ class Database: c.execute("INSERT INTO Sites (name,currency) VALUES ('PartyPoker', 'USD')") if self.backend == self.SQLITE: c.execute("INSERT INTO TourneyTypes (id, siteId, buyin, fee) VALUES (NULL, 1, 0, 0);") + elif self.backend == self.PGSQL: + c.execute("insert into TourneyTypes values (0,1,0,0,0,'0','0',null,'0','0','0');") else: c.execute("insert into TourneyTypes values (0,1,0,0,0,0,0,null,0,0,0);")