View Issue Details

IDProjectCategoryView StatusLast Update
0009384mantisbtdb postgresqlpublic2015-03-15 20:15
ReporterMax_well Assigned Tograngeway  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
PlatformApache/2.2.3 PHP/5.2.0-8+etch11OSLinuxOS Version2.6.18.1
Product Version1.2.0a1 
Fixed in Version1.2.0 
Summary0009384: Cannot create new user (type error, integer instead of boolean)
Description

PostgresQL 7.4

When creating a new user, Mantis show the following error :

APPLICATION ERROR 0000401

Database query failed. Error received from database was #-1: ERROR: column "enabled" is of type boolean but expression is of type integer
HINT: You will need to rewrite or cast the expression. for the query: INSERT INTO mantis_user_table
( username, email, password, date_created, last_visit,
enabled, access_level, login_count, cookie_string, realname )
VALUES
( 'username', 'username@email.org', 'a313838e27827ee3bc6ba3abb88da90a', '2008-07-14 01:44:38', '2008-07-14 01:44:38',
0, 90, 0, '51c59d644df5f6ff20eef83a8b6fe663496537ced127dc38e34c52e26499d434', 'realname')

Steps To Reproduce

Install Mantis with PostgresQL 7.4.
Create a new user.

TagsNo tags attached.

Activities

Max_well

Max_well

2008-07-14 07:20

reporter   ~0018497

The following diff seems to resolve the problem with Postgresql 7.4 :

core/user_api.php
444c444
< '$c_enabled', $c_access_level, 0, '$t_cookie_string', '$c_realname')";

                    $c_enabled, $c_access_level, 0, '$t_cookie_string', '$c_realname')&quot;;

Once this one is corrected, the bug 0009387 shows up.

f_theile

f_theile

2008-11-25 09:28

reporter   ~0020030

Last edited: 2008-11-25 09:30

I think the reasons for this and other Postgres-boolean-related bugs are the funtions db_query_bound() and db_prepare_bool().

http://www.postgresql.org/docs/8.3/interactive/datatype-boolean.html states, that "Using the key words TRUE and FALSE is preferred (and SQL-compliant)" for boolean type in Postgres.

This patch for <MANTIS_ROOT>\core\database_api.php would fix it:

287c287,291
< $arr_parms[$i] = 0;

          $arr_parms[$i] = 'FALSE';
      } else {
          if ( $arr_parms[$i] === true ) {
              $arr_parms[$i] = 'TRUE';
          }

742c746,753
< return (int) (bool) $p_bool;

if (db_is_pgsql()) {
if ( $p_bool === false )
return 'FALSE';
if ( $p_bool === true )
return 'TRUE';
} else {
return (int)(bool)$p_bool;
}

grangeway

grangeway

2009-07-25 20:15

reporter   ~0022555

Hello,

This functionality works in 1.2.x

Paul

grangeway

grangeway

2014-05-16 15:02

reporter   ~0040541

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
Paul