[drupal-devel] [task] Removed plpgsql dependency for PostgreSQL users by updating (pg)SQL function definitions

Cvbge drupal-devel at drupal.org
Wed Aug 31 18:51:37 UTC 2005

Issue status update for 
Post a follow up: 

 Project:      Drupal
 Version:      cvs
 Component:    postgresql database
 Category:     tasks
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  Smirnov
 Updated by:   Cvbge
 Status:       patch (code needs review)

About function 'greatest': according to mysql documentation: 

" Before MySQL 5.0.13, GREATEST() returns NULL only if all arguments
are NULL. As of 5.0.13, it returns NULL if any argument is NULL.

Which one should PostgreSQL support? Now it supports < 5.0.13 

Also, mysql's greates() can compare any type. Postgresql's version can
only compare integer types. I don't know if it is possibile to write
function/functions that can compare any type the way mysql does it.


Previous comments:

Thu, 30 Jun 2005 16:32:34 +0000 : Smirnov

Attachment: http://drupal.org/files/issues/database.pgsql_4.patch (1.85 KB)

In /database/database.pgsql/ many of the functions such as
*greatest(integer, integer)* were defined with /plpgsql/. This patch
simply changes the definitions a bit to use regular SQL (SELECT) -- so
users won't have to load /plpgsql/ with /createlang/ anymore. 

In addition, I have updated the *IF(expr1,expr2,expr3)* function to
reflect MySQL's definition of it [1]. Before *expr1* always had to be
passed as a /boolean/, and now it is /anyelement/. Also now *expr1* is
true if it's both NOT NULL and  0. Anyways, this means that if Drupal
modules are passing integers when using the sql *IF()* function, the
query will now work.

NOTE: The IF() function is not ANSI SQL, perhaps in a later patch we
can replace all usage of it with CASE?
[1] http://dev.mysql.com/doc/mysql/en/control-flow-functions.html


Thu, 30 Jun 2005 16:33:47 +0000 : Smirnov

Attachment: http://drupal.org/files/issues/INSTALL.txt.patch (removes plpgsql) (594 bytes)

If this issue to add installation instructions for PG [2] gets approved
and committed then please use this patch to update /INSTALL.txt/ so
that it no longer mentions plpgsql.
[2] http://drupal.org/node/25792


Sun, 03 Jul 2005 15:43:28 +0000 : Dries

Waiting for a review from Adrian. I don't have a PostgreSQL setup.

More information about the drupal-devel mailing list