[development] Error when install two Drupal 6.2 with PGSQL and table prefix (and patch)

Nathaniel Catchpole catch56 at googlemail.com
Thu Jun 19 14:17:40 UTC 2008


Gwen,

Please review existing issues for postgresql [1] and submit your patch to
one if appropriate, or if not, create an issue and attach it there [2].

Nat

1.
http://drupal.org/project/issues/drupal?text=postgresql&projects=3060&states=1%2C16%2C8%2C13%2C14%2C15%2C2%2C4
2. http://drupal.org/node/add/project-issue/drupal

On Thu, Jun 19, 2008 at 3:13 PM, Saint-Genest Gwenael <
gwenael.saint-genest at makina-corpus.com> wrote:

> 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
>
> --
> Gwenael Saint-Genest
> MAKINA CORPUS - www.makina-corpus.com
> 44 boulevard des Pas Enchantés FR-44230 Saint Sébastien sur Loire
> Tel : +33 (0) 2 40 94 96 08
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20080619/9898432f/attachment.htm 


More information about the development mailing list