View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0009720 | mantisbt | db postgresql | public | 2008-10-20 20:11 | 2014-05-16 15:02 |
Reporter | olegos | Assigned To | dregad | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | duplicate | ||
Product Version | 1.2.1 | ||||
Summary | 0009720: Error upgrading from 1.1.x (PostgreSQL) | ||||
Description | Trying to upgrade from 1.1.3 to 1.2.0a2 (really, trunk r5703). Using PostgreSQL 8.3 ("Running pgsql version PostgreSQL 8.3.3 on x86_64-pc-linux-gnu, compiled by GCC cc (GCC) 4.2.3 (Ubuntu 4.2.3-2ubuntu7)"). Executing admin/install.php, and after getting through 0009701, I'm running into the following error in step "Schema Array ( mantis_user_pref_table )": BAD I don't see anything wrong with the query, and I can execute it without errors in psql (same host, same postgres user): mantis=> ALTER TABLE mantis_user_pref_table ALTER COLUMN redirect_delay TYPE INTEGER ; | ||||
Tags | No tags attached. | ||||
Attached Files | schema.php.diff (1,390 bytes)
--- schema.php_orig 2011-06-09 10:48:15.021330320 +0200 +++ schema.php 2011-06-09 10:58:12.371330413 +0200 @@ -383,7 +383,7 @@ enabled L NOTNULL DEFAULT \" '0' \" ", Array( 'mysql' => 'ENGINE=MyISAM DEFAULT CHARSET=utf8', 'pgsql' => 'WITHOUT OIDS' ) ) ); -$upgrade[] = Array('AlterColumnSQL', Array( db_get_table( 'mantis_user_pref_table' ), "redirect_delay I NOTNULL DEFAULT 0" ) ); +# $upgrade[] = Array('AlterColumnSQL', Array( db_get_table( 'mantis_user_pref_table' ), "redirect_delay I NOTNULL DEFAULT 0" ) ); /* apparently mysql now has a STRICT mode, where setting a DEFAULT value on a blob/text is now an error, instead of being silently ignored */ if ( isset( $f_db_type ) && ( $f_db_type == 'mysql' || $f_db_type == 'mysqli' ) ) { @@ -426,8 +426,8 @@ " ) ); $upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_project_version_table' ), " obsolete L NOTNULL DEFAULT \" '0' \"" ) ); -$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_bug_table' ), " - due_date T NOTNULL DEFAULT '" . db_null_date() . "' " ) ); +#$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_bug_table' ), " +# due_date T NOTNULL DEFAULT '" . db_null_date() . "' " ) ); $upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_custom_field_table' ), " filter_by L NOTNULL DEFAULT \" '1' \"" ) ); | ||||
I can see it now. Using the "Print SQL Queries" option, I see that the problem query is not the one printed, but two down: ALTER TABLE mantis_user_pref_table ALTER COLUMN INTEGER SET NOT NULL; So there are two problems here: this query is bad, and the error message prints wrong query. |
|
After getting through the above error (by hacking the code to skip mods to mantis_user_pref_table, since I can see that everything it's trying to do is already done), here's the next error: Schema AddColumnSQL ( mantis_bug_table ) : The problem queries are: ALTER TABLE mantis_bug_table ADD COLUMN due_date TIMESTAMP 00:00:01' ; There are obvious unbalanced quotes in each. Also, I can't figure out what that "00:00:01" after TIMESTAMP in the first query was supposed to do -- according to postgres doc, the only thing that can be there is a number 0 to 6, and/or time zone stuff (http://www.postgresql.org/docs/8.3/interactive/datatype-datetime.html ). After fixing these queries, install completed successfully. |
|
I'm hitting this as well on a clean install. |
|
We should really look into getting this fixed. @olegos: can you provide a patch which corrects the installation? |
|
I'm sorry I don't have a patch. This was quite a long time ago and I don't remember for sure, but I think as this upgrade turned into an iterative process I ended up just commenting out all steps up to and including the failing one in the upgrade script, fixing and executing a problem query manually with psql, then re-running the upgrade. I did try to document all problems I've encountered here. The problem with producing a patch for me was that while I could figure out what needed to be done for my installation, I wasn't clear whether the same would be the right thing to do in all cases, esp. since most of the code was shared with other DB's and I only have experience with PG. |
|
hi, ALTER TABLE mantis_bug_table ADD COLUMN due_date TIMESTAMP 00:00:01' ; UPDATE mantis_bug_table SET due_date='1970-01-01; ALTER TABLE mantis_bug_table ALTER COLUMN due_date SET DEFAULT '1970-01-01; into UPDATE mantis_bug_table SET due_date='1970-01-01; ALTER TABLE mantis_bug_table ALTER COLUMN due_date SET DEFAULT '1970-01-01 00:00:01'; ALTER TABLE mantis_bug_table ALTER COLUMN due_date SET NOT NULL; |
|
With mantis-1.2.4, I've got the same problem with a fresh install with postgresql db as well. I circumvent the problem with the following steps: 1. --- schema.php_orig 2011-06-09 10:48:15.021330320 +0200 -$upgrade[] = Array('AlterColumnSQL', Array( db_get_table( 'mantis_user_pref_table' ), "redirect_delay I NOTNULL DEFAULT 0" ) ); / apparently mysql now has a STRICT mode, where setting a DEFAULT value on a blob/text is now an error, instead of being silently ignored /
2. 3.
|
|
Thanks. Can you provide the errors reported? |
|
BAD Workaround: Create user manually: CREATE ROLE mantis LOGIN ENCRYPTED PASSWORD 'md532783c2352bbb609188bc11f55c17bae'
Schema AlterColumnSQL ( mantis_user_pref_table )
Schema AddColumnSQL ( mantis_bug_table )
APPLICATION ERROR 0000401 Database query failed. Error received from database was #-1: FEHLER: Spalte »due_date« existiert nicht Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section. Workaround: |
|
I hit the exact same problem trying to fix PostgreSQL support for 1.3.x (see 0014398). The error is actually caused by a bug in ADOdb which generates incorrect SQL. Feel free to have a look at the work-in-progress github branch (not sure how easily it would apply to 1.2 - use at your own risk, and please report any issues directly in 0014398). The problem with the error message listed to the wrong statement has already been fixed (see 0014399). |
|
MantisBT currently supports Mysql and has support for other database engines. The support for other databases is known to be problematic. Having implemented the current database layer into Mantis 10 years ago, I'm currently working on replacing the current layer. If you are interested in using Mantis with non-mysql databases - for example, Oracle, PGSQL or MSSQL, and would be willing to help out testing the new database layer, please drop me an email at paul@mantisforge.org In the meantime, I'd advise running Mantis with Mysql Only to avoid issues. Thanks |
|