View Issue Details

IDProjectCategoryView StatusLast Update
0009951mantisbtinstallationpublic2019-12-13 18:06
Reporterrgomes1997 Assigned Todregad  
PrioritynormalSeveritytweakReproducibilityalways
Status closedResolutionno change required 
PlatformPostgreSQLOSn/a 
Product Version1.2.0a2 
Summary0009951: Database creation under PostgreSQL fails to create a new database
Description

When creating a new database by the installer script, it fails to assign the correct ownership to the newly created database. This behavior prevents other SQL commands to properly populate the database.

Steps To Reproduce

When creating a new database by the installer script, it fails to assign the correct ownership to the newly created database. This behavior prevents other SQL commands to properly populate the database.

Use Case 1: no previous database present.

a) Using pgadmin3, I make sure I dont have database "mantisbt".

b) Parameters in admin/install.php page

Type of Database : PGSQL
Hostname (for Database Server) : localhost
Username (for Database) : mantisuser
Password (for Database) : mantisuserpw
Database name (for Database) : mantisdb
Admin Username (to create Database if required) : admin
Admin Password (to create Database if required) : adminpw

Results:

--> Database "mantisdb" is created under owner "admin" (the database administrator, which is not what we need!)

Checking for register_globals are off for mantis GOOD
Attempting to connect to database as user GOOD
checking ability to SELECT records BAD
Database user doesn't have SELECT access to the database ( ERROR: permission denied for relation mantis_config_table )
checking ability to INSERT records BAD
Database user doesn't have INSERT access to the database ( ERROR: permission denied for relation mantis_config_table )
checking ability to UPDATE records BAD
Database user doesn't have UPDATE access to the database ( ERROR: permission denied for relation mantis_config_table )
checking ability to DELETE records BAD
Database user doesn't have DELETE access to the database ( ERROR: permission denied for relation mantis_config_table )
Checks Failed...

Use Case 2: Database create by hand in pgadmin3

a) Using pgadmin3, I create a database "mantisdb" owned by "mantisuser".

b) Parameters in admin/install.php page

Type of Database : PGSQL
Hostname (for Database Server) : localhost
Username (for Database) : mantisuser
Password (for Database) : mantisuserpw
Database name (for Database) : mantisdb
Admin Username (to create Database if required) : mantisuser
Admin Password (to create Database if required) : mantisuserpw

Results: database is populated successfully

TagsNo tags attached.

Relationships

related to 0014151 closeddregad Failed install on PostgreSQL 

Activities

jreese

jreese

2008-12-09 11:20

reporter   ~0020308

Can you please test against the latest development snapshot of 1.2.x? There have been a couple changes targetting Postgres recently.

http://git.mantisbt.org/

Thank you.

rgomes1997

rgomes1997

2009-01-16 18:25

reporter   ~0020648

Hi, sorry for delay. I was not monitoring this issue :/

No. It's not working yet. I've tried using the yesterday's nightly build.

The problem is that the database is owned by the administrator account instead of being owned by the mantis user account. The same applies to tables and other objects.

Below you see an example where we could immediately assign the correct owner to the database and other objects. The mantis account ("mantisuser" in the example) must be used instead the database administrator.

CREATE DATABASE bugtracker
WITH OWNER = mantisuser
ENCODING = 'UTF8';

CREATE TABLE mantis_bug_file_table
(
id serial NOT NULL,
bug_id integer NOT NULL DEFAULT 0,
title character varying(250) NOT NULL DEFAULT ''::character varying,
description character varying(250) NOT NULL DEFAULT ''::character varying,
diskfile character varying(250) NOT NULL DEFAULT ''::character varying,
filename character varying(250) NOT NULL DEFAULT ''::character varying,
folder character varying(250) NOT NULL DEFAULT ''::character varying,
filesize integer NOT NULL DEFAULT 0,
file_type character varying(250) NOT NULL DEFAULT ''::character varying,
date_added timestamp without time zone NOT NULL DEFAULT '1970-01-01 00:00:01'::timestamp without time zone,
"content" bytea NOT NULL,
CONSTRAINT mantis_bug_file_table_pkey PRIMARY KEY (id)
)
WITH (OIDS=FALSE);
ALTER TABLE mantis_bug_file_table OWNER TO mantisuser;

Cheers :)

Richard Gomes
http://www.jquantlib.org/index.php/User:RichardGomes

thraxisp

thraxisp

2009-01-17 22:57

reporter   ~0020650

It looks like the ADODB Datadict doesn't support the "OWNER" clauses directly. I'll have to look into this more. As I recall, if you create the database first the "mantis user" can create the rest of the information.

rgomes1997

rgomes1997

2009-01-22 17:59

reporter   ~0020689

Last edited: 2009-01-22 18:08

Hi,

There's another strategy which is trying to use a superuser account if provided. These are the steps:

  1. Try to create a 'mantisuser' using the superuser account. This command eventually will fail if 'mantisuser' was already created. This failure can be safely ignored.

  2. If step (1) succeded, superuser must assign the informed password to 'mantisuser' account. Abort if fails.

  3. If step (1) succeded (yes, step 1!), enough rights must be granted to 'mantisuser'. Abort if fails.

  4. Create 'mantisdb' using the superuser account, if it was provided. Otherwise, try to create the database using 'mantisuser' account. This step eventually will fail if superuser account is not provided but 'mantisuser' exists but does not have enough rights to create the database. Abort if fails.

  5. Superuser change database ownership to 'mantisuser'. Abort if fails.

  6. Create all database objects using 'mantisuser' account and provided passord. This step eventually will fail if provided 'mantisuser' does not have enough rights to create database objects. Abort if fails.

A good source of information is Mediawiki. It does exactly like this, I mean: you have the possibility of creating the 'wikiuser' account and 'wikidb' database in one go and everything runs smoothly.

Thanks

dregad

dregad

2019-12-03 10:48

developer   ~0063185

We are resolving this issue as "no change required", because it was reported against an old version of MantisBT which is no longer supported.

We recommend that you upgrade to the latest stable version [1]; if after doing so the problem still exists, do not hesitate to reopen the issue.

[1] http://www.mantisbt.org/download.php

Issue History

Date Modified Username Field Change
2008-12-09 10:48 rgomes1997 New Issue
2008-12-09 11:20 jreese Note Added: 0020308
2008-12-09 11:20 jreese Status new => feedback
2009-01-16 18:25 rgomes1997 Note Added: 0020648
2009-01-17 22:57 thraxisp Note Added: 0020650
2009-01-22 17:59 rgomes1997 Note Added: 0020689
2009-01-22 18:08 rgomes1997 Note Edited: 0020689
2012-04-16 05:02 dregad Relationship added related to 0014151
2019-12-03 10:48 dregad Assigned To => dregad
2019-12-03 10:48 dregad Status feedback => resolved
2019-12-03 10:48 dregad Resolution open => no change required
2019-12-03 10:48 dregad Note Added: 0063185
2019-12-13 18:06 atrol Status resolved => closed