View Issue Details

IDProjectCategoryView StatusLast Update
0004871mantisbtsqlpublic2005-04-18 10:26
Reportergizmo Assigned Tograngeway  
PrioritynormalSeverityfeatureReproducibilityalways
Status closedResolutionfixed 
PlatformAllOSAllOS VersionAll
Product Version0.19.1 
Summary0004871: New SQL script for PostgreSQL port
Description

The actual version of pgSQL script has some fileds and table missing or incompatible. So i decide to convert the actual MySQL script into a compatible PgSQL one.

The proposed new version is a bit tricky because the creation of a user add "any" value in some integer type, so I convert them into varchar(3), but it seems to works fine.

A next step would be to add integrity constraint but as I didn't look the entire php code, I'm not sure it would cause trouble for the moment.

Steps To Reproduce

To use this new script, simply use psql to load it into your PgSQL database and add

$g_db_typ = 'pgsql';

to your confing_inc.php file.

TagsNo tags attached.
Attached Files
pgsql_db_generate.sql (43,654 bytes)
pgsql_db_generate_2.sql (43,678 bytes)

Relationships

child of 0005289 closedgrangeway Use ADODB DataDict for DB Creation / Upgrade 

Activities

gizmo

gizmo

2004-11-18 06:35

reporter   ~0008358

More information about connections:
If you don't use the standard 5432 port for PgSQL, the script will refuse to connect.

To quickly bypass this problem, change the connection variables like this:

In the host, place the classical pgsql connection string (host=... port=... dbname=... user=... password=...)

Then, in the core/database_api.php file, find the db_connect function and change is call to "Connect($p_hostname, $p_username, $p_password, $g_database_name );" into "Connect($p_hostname);"

I know this is dirty, but if you're in a hurry, it works...

gizmo

gizmo

2004-11-18 07:37

reporter   ~0008359

Bug fix: I didn't notice that when a user preference is unchecked, the empty string is send as an update for the integer, which is unable for PostgreSQL, so I make a fix in the second attachement file converting all the guilty integer fields into varchar fields.

grangeway

grangeway

2004-11-18 13:39

reporter   ~0008362

You should use INT's not varchar(3).

Latest CVS version of mantis fixes the user_pref's to supply 0 for any instead of 'any'

This is for exactly the same reason you hit - mysql 'supports' any meaning 0.
mssql/pgsql are rather more sensible in only allowing integer's into INT column's, not strings.

Paul

grangeway

grangeway

2004-11-18 13:42

reporter   ~0008363

regarding, the other point:

What's wrong with just setting in the config:
$g_hostname = "host=... port=... dbname=... user=... password=...";

Paul

gizmo

gizmo

2004-11-19 03:26

reporter   ~0008372

I didn't choose CVS version cause the tracker must be use in production and my chief does only accept official release for this.

Anyway, 'any' values are not the only "false" values accept by mysql. mysql also accept empty string as an integer, what is done when you uncheck some user preference. PostgreSQL don't. So, until mantis doesn't convert empty string to default integer value, postgresql will refuse to update the mantis_user_pref_table.

For the second point, if you simply update the g_hostname string without chaging signature of the Connect function, the others argument seems to be taken in account and it result in the fact that the connection failed. I try this first, but it didn't work until I update the call to the function.

regards,
Olivier

grangeway

grangeway

2005-02-28 05:26

reporter   ~0009398

Both the mssql.sql and pgsql.sql are out of date.

For the next release, i'm hoping to get an adodb data dict schema defined which will generate the mssql/pgsql tables. As adodb's datadict is generic, this means that we won't have to keep multiple schema files in check. It also means that it may be possible to use other db's that are supported by adodb's datadict with mantis.

If this functionality goes into the next release, the mssql/pgsql.sql files will become redundant.

Notes:

  1. The aim is to have the generated adodb schema match the existing schema's created by the sql files.
  2. Once the code is added to CVS, it would be interesting to get some feedback, or any differences in the schema to the existing databases you are using

I'm going to use issue 0005289 to track the datadict stuff, so closing this issue now.