| Anonymous | Login | Signup for a new account | 2013-06-18 23:19 EDT | ![]() |
| Main | My View | View Issues | Change Log | Roadmap | Wiki | ManTweet | Repositories |
| View Issue Details [ Jump to Notes ] [ Wiki ] [ Related Changesets ] | [ Issue History ] [ Print ] | ||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||
| 0014288 | mantisbt | db postgresql | public | 2012-05-23 10:20 | 2013-04-06 09:23 | ||||
| Reporter | awenkhh | ||||||||
| Assigned To | dregad | ||||||||
| Priority | high | Severity | crash | Reproducibility | always | ||||
| Status | closed | Resolution | fixed | ||||||
| Platform | Linux | OS | Linux | OS Version | 2.6.32-5-686 | ||||
| Product Version | 1.2.10 | ||||||||
| Target Version | 1.2.11 | Fixed in Version | 1.2.11 | ||||||
| Summary | 0014288: Manage User not reachable due to error in PostgreSQL | ||||||||
| Description | It is not possible to reach the page manage_user_page.php when using PostgreSQL (8.3/8.4). The problem can be found in the table mantis_user_table columns enabled and protected. The type of the columns is boolean and the default value is 'true' or 'false'. But the software is trying to compare the value true (resp.false) with 1 or 0. If one wants to fix that fast do this: ALTER TABLE mantis_user_table ALTER COLUMN enabled SET DEFAULT NULL; ALTER TABLE mantis_user_table ALTER COLUMN enabled TYPE integer USING 1; ALTER TABLE mantis_user_table ALTER COLUMN enabled SET DEFAULT 0; same for column protected | ||||||||
| Tags | 2.0.x check | ||||||||
| Attached Files | |||||||||
Relationships |
|||||||||||||||||||||
|
|||||||||||||||||||||
Notes |
|
|
dregad (developer) 2012-05-24 09:47 |
I can reproduce this on my dev box (Ubuntu 12.04 with PostgreSQL 9.3.1)APPLICATION ERROR 0000401 Database query failed. Error received from database was #-1: ERROR: operator does not exist: boolean = integer LINE 4: AND enabled = 1 ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. for the query: SELECT count(*) as usercnt FROM mantis_user_table WHERE (1 = 1) AND enabled = 1. Call stack ./core/database_api.php 405 - - trigger_error ( <string>'401', <integer>256 ) ./manage_user_page.php 186 - - db_query_bound ( <string>'SELECT count(*) as usercnt FROM mantis_user_table WHERE (1 = 1) AND enabled = 1', <NULL>NULL ) |
|
dregad (developer) 2012-05-24 13:00 |
Please test the following code, which should fix the problem. https://github.com/dregad/mantisbt/tree/fix-14288 [^] |
|
dregad (developer) 2012-05-24 13:10 edited on: 2012-05-24 13:11 |
Reminder sent to: rombert @rombert, as I made a change to soap api that I am not able to test, I would appreciate if you could have a look at this and make sure it is not introducing any regressions in the display of filters. Note that the change was made to remain consistent with filter api, as the code in mc_api.php/mci_filter_db_get_available_queries() is basically a duplicate of filter_db_get_available_queries() (which I tested successfully). Test cases: - to be done for PostgreSQL and another RDBMS - contents of filters list for current user should be identical between 1.2.x and the fix-14288 branch In other words, for an absolute definition, the filters displayed should be: all available public ones, as well as the user's private filters (for all projects and the current project). Thanks in advance for your help. |
|
rombert (developer) 2012-05-24 15:01 |
@dregad - the changes look fine to me ; I've tested using the SOAP API and the behaviour is exactly the same as before the change. |
|
dregad (developer) 2012-05-25 07:32 |
Thanks for your help rombert. awenkhh, I'm waiting for your confirmation that this resolves your issue. |
|
dregad (developer) 2012-05-29 18:57 |
Without feedback from you, I assume that you are OK with the change, which will be included in the next version of MantisBT. |
|
grangeway (developer) 2013-04-05 17:57 |
Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch |
Related Changesets |
|||
|
MantisBT: master 32559580
Timestamp: 2012-05-24 09:21:29 Author: dregad [ Details ] [ Diff ] |
Fix PostgreSQL errors with boolean fields PostgreSQL triggers an error when comparing a boolean field with an integer value. This happens frequently in MantisBT as AdoDB stores boolean fields as integers for most RDBMS. This could prevent for example manage_user_page.php from loading. To fix the problem, db_prepare_bool() has been modified to return 'true' or 'false' as appropriate when the DB is PostgreSQL, through use of AdoDB qstr() function. Behavior for other RDMBS is unchanged. The where clause condition in manage_user_page.php has been modified to use db_prepare_bool() instead of hardcoding 'enabled = 1'. Following code cleanup was also performed: - Uses of db_prepare_bool() in filter_api.php and mc_api.php that would have caused incorrect behavior with the modified function have been removed - Removed non-existant 2nd parameter in call to db_prepare_bool() in filter_api.php - Fix whitespace in mc_api.php Fixes 0014288 |
||
| mod - api/soap/mc_api.php | [ Diff ] [ File ] | ||
| mod - core/database_api.php | [ Diff ] [ File ] | ||
| mod - core/filter_api.php | [ Diff ] [ File ] | ||
| mod - manage_user_page.php | [ Diff ] [ File ] | ||
|
MantisBT: master-1.2.x b8d4b503
Timestamp: 2012-05-24 09:21:29 Author: dregad [ Details ] [ Diff ] |
Fix PostgreSQL errors with boolean fields PostgreSQL triggers an error when comparing a boolean field with an integer value. This happens frequently in MantisBT as AdoDB stores boolean fields as integers for most RDBMS. This could prevent for example manage_user_page.php from loading. To fix the problem, db_prepare_bool() has been modified to return 'true' or 'false' as appropriate when the DB is PostgreSQL, through use of AdoDB qstr() function. Behavior for other RDMBS is unchanged. The where clause condition in manage_user_page.php has been modified to use db_prepare_bool() instead of hardcoding 'enabled = 1'. Following code cleanup was also performed: - Uses of db_prepare_bool() in filter_api.php and mc_api.php that would have caused incorrect behavior with the modified function have been removed - Removed non-existant 2nd parameter in call to db_prepare_bool() in filter_api.php - Fix whitespace in mc_api.php Fixes 0014288 |
||
| mod - api/soap/mc_api.php | [ Diff ] [ File ] | ||
| mod - core/database_api.php | [ Diff ] [ File ] | ||
| mod - core/filter_api.php | [ Diff ] [ File ] | ||
| mod - manage_user_page.php | [ Diff ] [ File ] | ||
|
MantisBT: master-1.2.x ba71cf96
Timestamp: 2012-06-18 06:52:48 Author: dregad [ Details ] [ Diff ] |
Fix PostgreSQL error when adding project/subproject Release 1.2.11 (see commit b8d4b5039598248d0b0c78619450c51d4dc98df2 and issue 0014288) introduced a regression preventing the user from creating a new project or adding a subproject. The error is caused by columns mantis_project_table.inherit_global and mantis_project_hierarchy_table.inherit_parent, which are defined as unsigned int in schema.php, but treated as boolean in the code. This is a problem with PostgreSQL due to strict type checking, but not on MySQL as type cast is done automatically. This commit is a workaround for the problem (sending an int to the DB instead of a bool if using PostgreSQL), as fixing the root cause would require a schema change which is not possible in 1.2.x. Fixes 0014385 |
||
| mod - core/project_api.php | [ Diff ] [ File ] | ||
| mod - core/project_hierarchy_api.php | [ Diff ] [ File ] | ||
|
MantisBT: master-1.2.x ef24c0f3
Timestamp: 2012-06-27 05:30:34 Author: dregad [ Details ] [ Diff ] |
Fix PostgreSQL error when updating a project Release 1.2.11 (see commit b8d4b5039598248d0b0c78619450c51d4dc98df2 and issue 0014288) introduced a regression preventing the user from updating an existing project. This commit is a workaround for the problem (sending an int to the DB instead of a bool if using PostgreSQL), as fixing the root cause would require a schema change which is not possible in 1.2.x. Fixes 0014385 |
||
| mod - core/project_api.php | [ Diff ] [ File ] | ||
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2012-05-23 10:20 | awenkhh | New Issue | |
| 2012-05-24 09:47 | dregad | Note Added: 0031889 | |
| 2012-05-24 09:47 | dregad | Status | new => confirmed |
| 2012-05-24 09:47 | dregad | Product Version | git trunk => 1.2.10 |
| 2012-05-24 13:00 | dregad | Note Added: 0031893 | |
| 2012-05-24 13:00 | dregad | Assigned To | => dregad |
| 2012-05-24 13:00 | dregad | Status | confirmed => assigned |
| 2012-05-24 13:10 | dregad | Note Added: 0031894 | |
| 2012-05-24 13:11 | dregad | Note Edited: 0031894 | View Revisions |
| 2012-05-24 15:01 | rombert | Note Added: 0031895 | |
| 2012-05-25 07:32 | dregad | Note Added: 0031907 | |
| 2012-05-29 18:57 | dregad | Note Added: 0031922 | |
| 2012-05-29 18:57 | dregad | Status | assigned => resolved |
| 2012-05-29 18:57 | dregad | Resolution | open => fixed |
| 2012-05-29 18:57 | dregad | Fixed in Version | => 1.2.11 |
| 2012-05-29 18:57 | dregad | Target Version | => 1.2.11 |
| 2012-05-29 19:00 | dregad | Changeset attached | => MantisBT master 32559580 |
| 2012-05-29 19:00 | dregad | Changeset attached | => MantisBT master-1.2.x b8d4b503 |
| 2012-06-06 23:53 | jreese | Status | resolved => closed |
| 2012-06-12 09:12 | dregad | Relationship added | related to 0014385 |
| 2012-06-12 09:18 | dregad | Relationship added | related to 0014375 |
| 2012-06-27 09:22 | dregad | Changeset attached | => MantisBT master-1.2.x ba71cf96 |
| 2012-06-27 09:22 | dregad | Changeset attached | => MantisBT master-1.2.x ef24c0f3 |
| 2012-07-09 22:27 | dregad | Relationship added | related to 0014466 |
| 2013-04-05 17:57 | grangeway | Status | closed => acknowledged |
| 2013-04-05 17:57 | grangeway | Note Added: 0036247 | |
| 2013-04-05 18:36 | grangeway | Relationship added | related to 0015721 |
| 2013-04-06 03:40 | dregad | Status | acknowledged => closed |
| 2013-04-06 07:23 | grangeway | Status | closed => acknowledged |
| 2013-04-06 09:22 | dregad | Tag Attached: 2.0.x check | |
| 2013-04-06 09:23 | dregad | Status | acknowledged => closed |
| MantisBT 1.2.16dev master-1.2.x-05091f5 [^]
Copyright © 2000 - 2013 MantisBT Team
Time: 0.1016 seconds. memory usage: 2,915 KB |