Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.0b4

Bug #7731 PostgreSQL - alterTable
Submitted: 2006-05-26 10:12 UTC
From: decombe at unisolution dot de Assigned: lsmith
Status: Closed Package: MDB2_Driver_pgsql (version 2.0.3)
PHP Version: 4.3.10 OS: Suse 9.3
Roadmaps: (Not assigned)    

 [2006-05-26 10:12 UTC] decombe at unisolution dot de (Chris)
Description: ------------ I wanted to use MDB2 to modify a Columnsize in my Database PostgreSQL. I use the function alterTable. PostgreSQL give back a error because the Query is false. MDB2 2.0.3 stable MDB2_Driver_mysql 1.0.3 stable MDB2_Driver_pgsql 1.0.3 stable MDB2_Schema 0.5.0 beta Test script: --------------- $table = 'data_users'; $change = Array ( [change] => Array ( [user_version] => Array ( [type] => text [definition] => Array ( [type] => text [length] => 10 ) ) ) ) ; $this->manager->alterTable($table, $change, false); Actual result: -------------- _doQuery: Could not execute statement[Native message: ERROR: parser: parse error at or near "TYPE" at character 43 ] mdb2_error Object ( [error_message_prefix] => [mode] => 1 [level] => 1024 [code] => -2 Query - ALTER TABLE data_users ALTER user_version TYPE VARCHAR(10)


 [2006-05-26 10:25 UTC] lsmith (Lukas Smith)
what version of postgresql are you using? i probably need to add some code that checks the version ..
 [2006-05-26 10:32 UTC] decombe at unisolution dot de
I use PostgreSQL 7.3.4
 [2006-05-26 10:34 UTC] lsmith (Lukas Smith)
Yeah that explains it .. that version of postgresql simply does not support this alteration :-/ I will expand the code to give more meaningful error messages by using a version check.
 [2006-05-26 10:41 UTC] decombe at unisolution dot de
Ok. what do you mean exactly ? Will you modify the function for the code to work with my version of PostgreSQL or do you only write a meaningful error ? For which dedicated version of Pgsql are you developping the functions ?
 [2006-05-26 10:44 UTC] lsmith (Lukas Smith)
I will add version checks so that you get a meaninful error (this type alterations not supported for versions below x.y). I develop on pgsql 8.1, but I am trying to support as far down as possible (realistically down to 7.x). Also note emulating alterations missing is very non trivial and probably not really feasible either.
 [2006-05-31 14:40 UTC] lsmith (Lukas Smith)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.