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

Smirnov drupal-devel at drupal.org
Thu Jun 30 16:32:35 UTC 2005


Issue status update for http://drupal.org/node/26091

 Project:      Drupal
 Version:      cvs
 Component:    postgresql database
 Category:     tasks
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  Smirnov
 Updated by:   Smirnov
 Status:       patch
 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




Smirnov




More information about the drupal-devel mailing list