diff options
author | Steven Wittens <steven@10.no-reply.drupal.org> | 2004-07-22 01:31:33 +0000 |
---|---|---|
committer | Steven Wittens <steven@10.no-reply.drupal.org> | 2004-07-22 01:31:33 +0000 |
commit | c16ada8c46dd66f08a0432bee7bff6a436e58584 (patch) | |
tree | 6154cf43f848a19ae6c5646ae3241d2e1de6ebca | |
parent | b8d653f1e8f5906d03d517be1fd9688b333c9102 (diff) | |
download | brdo-c16ada8c46dd66f08a0432bee7bff6a436e58584.tar.gz brdo-c16ada8c46dd66f08a0432bee7bff6a436e58584.tar.bz2 |
- #7295: Fixing issue with latest comments being incorrectly displayed on PostgreSQL
-rw-r--r-- | database/database.pgsql | 5 | ||||
-rw-r--r-- | database/updates.inc | 25 |
2 files changed, 29 insertions, 1 deletions
diff --git a/database/database.pgsql b/database/database.pgsql index 1ce84a83a..8fbf9ad24 100644 --- a/database/database.pgsql +++ b/database/database.pgsql @@ -681,8 +681,11 @@ INSERT INTO blocks(module,delta,status) VALUES('user', '1', '1'); --- Functions --- -CREATE FUNCTION "greatest"(integer, integer) RETURNS integer AS ' +CREATE FUNCTION greatest(integer, integer) RETURNS integer AS ' BEGIN + IF $2 IS NULL THEN + RETURN $1; + END IF; IF $1 > $2 THEN RETURN $1; END IF; diff --git a/database/updates.inc b/database/updates.inc index f631e121f..ef1d86968 100644 --- a/database/updates.inc +++ b/database/updates.inc @@ -65,6 +65,7 @@ $sql_updates = array( "2004-06-30" => "update_91", "2004-07-07" => "update_92", "2004-07-11" => "update_93", + "2004-07-22" => "update_94" ); function update_32() { @@ -1162,6 +1163,30 @@ function update_93() { return $ret; } +function update_94() { + /** + * Postgres only update + */ + $ret = array(); + if ($GLOBALS['db_type'] == 'pgsql') { + $ret[] = update_sql('DROP FUNCTION "greatest"(integer, integer)'); + $ret[] = update_sql(" + CREATE FUNCTION greatest(integer, integer) RETURNS integer AS ' + BEGIN + IF $2 IS NULL THEN + RETURN $1; + END IF; + IF $1 > $2 THEN + RETURN $1; + END IF; + RETURN $2; + END; + ' LANGUAGE 'plpgsql'; + "); + } + return $ret; +} + function update_sql($sql) { $edit = $_POST["edit"]; $result = db_query($sql); |