Hi,
Today, i've tried to install two sets of datas into a drupal 6.2 database (with pgsql). With a table prefix i've take an error like :
Warning: pg_query() [function.pg-query]: Query failed: ERROR: type "int_unsigned" already exists in /var/www/xxxxxx/drupal-6.2/includes/database.pgsql.inc on line 138 Warning: ERROR: type "int_unsigned" already exists query: CREATE DOMAIN int_unsigned integer CHECK (VALUE >= 0) in /var/www/xxxxxx/drupal-6.2/includes/database.pgsql.inc on line 159 Warning: pg_query() [function.pg-query]: Query failed: ERROR: type "smallint_unsigned" already exists in /var/www/xxxxxx/drupal-6.2/includes/database.pgsql.inc on line 138 Warning: ERROR: type "smallint_unsigned" already exists query: CREATE DOMAIN smallint_unsigned smallint CHECK (VALUE >= 0) in /var/www/xxxxxx/drupal-6.2/includes/database.pgsql.inc on line 159 Warning: pg_query() [function.pg-query]: Query failed: ERROR: type "bigint_unsigned" already exists in /var/www/xxxxxx/drupal-6.2/includes/database.pgsql.inc on line 138 Warning: ERROR: type "bigint_unsigned" already exists query: CREATE DOMAIN bigint_unsigned bigint CHECK (VALUE >= 0) in /var/www/xxxxxx/drupal-6.2/includes/database.pgsql.inc on line 159
Ok ... Drupal try to create data types two times ... and crash :(
If anyone else has the same error, this patch can solve this problem :
--=={ snip }==-- --- drupal-6.2-ref/modules/system/system.install 2008-06-19 10:19:36.000000000 +0200 +++ drupal-6.2/modules/system/system.install 2008-06-19 15:53:28.000000000 +0200 @@ -302,9 +302,15 @@ function system_install() { if ($GLOBALS['db_type'] == 'pgsql') { // Create unsigned types. - db_query("CREATE DOMAIN int_unsigned integer CHECK (VALUE >= 0)"); - db_query("CREATE DOMAIN smallint_unsigned smallint CHECK (VALUE >= 0)"); - db_query("CREATE DOMAIN bigint_unsigned bigint CHECK (VALUE >= 0)"); + if (!db_result(db_query("SELECT COUNT(*) FROM pg_type WHERE typname = 'int_unsigned'"))) { + db_query("CREATE DOMAIN int_unsigned integer CHECK (VALUE >= 0)"); + } + if (!db_result(db_query("SELECT COUNT(*) FROM pg_type WHERE typname = 'smallint_unsigned'"))) { + db_query("CREATE DOMAIN smallint_unsigned smallint CHECK (VALUE
= 0)");
+ } + if (!db_result(db_query("SELECT COUNT(*) FROM pg_type WHERE typname = 'bigint_unsigned'"))) { + db_query("CREATE DOMAIN bigint_unsigned bigint CHECK (VALUE >= 0)"); + }
// Create functions. db_query('CREATE OR REPLACE FUNCTION "greatest"(numeric, numeric) RETURNS numeric AS --=={ snip }==--
Gwen