Index: includes/actions.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/actions.inc,v
retrieving revision 1.22
diff -u -p -r1.22 actions.inc
--- includes/actions.inc	8 Nov 2008 07:28:03 -0000	1.22
+++ includes/actions.inc	19 Nov 2008 16:59:27 -0000
@@ -236,7 +236,7 @@ function actions_function_lookup($hash) 
   }
 
   // Must be an instance; must check database.
-  return db_query("SELECT aid FROM {actions} WHERE MD5(aid) = :hash AND parameters <> ''", array(':hash' => $hash))->fetchField();
+  return db_query("SELECT aid FROM {actions} WHERE MD5(aid) = :hash AND parameters IS NOT NULL", array(':hash' => $hash))->fetchField();
 }
 
 /**
@@ -251,7 +251,7 @@ function actions_synchronize($actions_in
   if (!$actions_in_code) {
     $actions_in_code = actions_list(TRUE);
   }
-  $actions_in_db = db_query("SELECT aid, callback, description FROM {actions} WHERE parameters = ''")->fetchAllAssoc('callback', PDO::FETCH_ASSOC);
+  $actions_in_db = db_query("SELECT aid, callback, description FROM {actions} WHERE parameters IS NULL")->fetchAllAssoc('callback', PDO::FETCH_ASSOC);
 
   // Go through all the actions provided by modules.
   foreach ($actions_in_code as $callback => $array) {
@@ -269,7 +269,7 @@ function actions_synchronize($actions_in
             'aid' => $callback,
             'type' => $array['type'],
             'callback' => $callback,
-            'parameters' => '',
+            'parameters' => NULL,
             'description' => $array['description'],
             ))
           ->execute();
Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.304
diff -u -p -r1.304 form.inc
--- includes/form.inc	15 Nov 2008 15:32:36 -0000	1.304
+++ includes/form.inc	19 Nov 2008 16:59:28 -0000
@@ -2614,7 +2614,8 @@ function batch_process($redirect = NULL,
       // at least an empty string for the (not null) 'token' column.
       $batch['id'] = db_insert('batch')
         ->fields(array(
-          'token' => '',
+          // token will soon replace with db_update().
+          'token' => 'default',
           'timestamp' => REQUEST_TIME,
         ))
         ->execute();
Index: includes/locale.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/locale.inc,v
retrieving revision 1.195
diff -u -p -r1.195 locale.inc
--- includes/locale.inc	16 Nov 2008 19:41:14 -0000	1.195
+++ includes/locale.inc	19 Nov 2008 16:59:28 -0000
@@ -426,7 +426,7 @@ function locale_languages_delete_form_su
     _locale_rebuild_js($form_state['values']['langcode']);
     // Remove the language.
     db_query("DELETE FROM {languages} WHERE language = '%s'", $form_state['values']['langcode']);
-    db_query("UPDATE {node} SET language = '' WHERE language = '%s'", $form_state['values']['langcode']);
+    db_query("UPDATE {node} SET language = 'default' WHERE language = '%s'", $form_state['values']['langcode']);
     $variables = array('%locale' => $languages[$form_state['values']['langcode']]->name);
     drupal_set_message(t('The language %locale has been removed.', $variables));
     watchdog('locale', 'The language %locale has been removed.', $variables);
@@ -1215,7 +1215,7 @@ function _locale_import_message($message
  * @param $group
  *   Text group to import PO file into (eg. 'default' for interface translations)
  */
-function _locale_import_one_string($op, $value = NULL, $mode = NULL, $lang = NULL, $file = NULL, $group = 'default') {
+function _locale_import_one_string($op, $value = NULL, $mode = NULL, $lang = 'default', $file = NULL, $group = 'default') {
   static $report = array(0, 0, 0);
   static $headerdone = FALSE;
   static $strings = array();
Index: includes/path.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/path.inc,v
retrieving revision 1.28
diff -u -p -r1.28 path.inc
--- includes/path.inc	14 Oct 2008 11:01:08 -0000	1.28
+++ includes/path.inc	19 Nov 2008 16:59:28 -0000
@@ -43,12 +43,12 @@ function drupal_init_path() {
  *   Either a Drupal system path, an aliased path, or FALSE if no path was
  *   found.
  */
-function drupal_lookup_path($action, $path = '', $path_language = '') {
+function drupal_lookup_path($action, $path = '', $path_language = 'default') {
   global $language;
   // $map is an array with language keys, holding arrays of Drupal paths to alias relations
   static $map = array(), $no_src = array(), $count;
 
-  $path_language = $path_language ? $path_language : $language->language;
+  $path_language = ($path_language != 'default') ? $path_language : $language->language;
 
   // Use $count to avoid looking up paths in subsequent calls if there simply are no aliases
   if (!isset($count)) {
@@ -66,7 +66,7 @@ function drupal_lookup_path($action, $pa
         return $map[$path_language][$path];
       }
       // Get the most fitting result falling back with alias without language
-      $alias = db_result(db_query("SELECT dst FROM {url_alias} WHERE src = '%s' AND language IN('%s', '') ORDER BY language DESC", $path, $path_language));
+      $alias = db_result(db_query("SELECT dst FROM {url_alias} WHERE src = '%s' AND language IN('%s', 'default') ORDER BY language DESC", $path, $path_language));
       $map[$path_language][$path] = $alias;
       return $alias;
     }
@@ -77,7 +77,7 @@ function drupal_lookup_path($action, $pa
       $src = '';
       if (!isset($map[$path_language]) || !($src = array_search($path, $map[$path_language]))) {
         // Get the most fitting result falling back with alias without language
-        if ($src = db_result(db_query("SELECT src FROM {url_alias} WHERE dst = '%s' AND language IN('%s', '') ORDER BY language DESC", $path, $path_language))) {
+        if ($src = db_result(db_query("SELECT src FROM {url_alias} WHERE dst = '%s' AND language IN('%s', 'default') ORDER BY language DESC", $path, $path_language))) {
           $map[$path_language][$src] = $path;
         }
         else {
@@ -106,7 +106,7 @@ function drupal_lookup_path($action, $pa
  *   An aliased path if one was found, or the original path if no alias was
  *   found.
  */
-function drupal_get_path_alias($path, $path_language = '') {
+function drupal_get_path_alias($path, $path_language = 'default') {
   $result = $path;
   if ($alias = drupal_lookup_path('alias', $path, $path_language)) {
     $result = $alias;
@@ -126,7 +126,7 @@ function drupal_get_path_alias($path, $p
  *   The internal path represented by the alias, or the original alias if no
  *   internal path was found.
  */
-function drupal_get_normal_path($path, $path_language = '') {
+function drupal_get_normal_path($path, $path_language = 'default') {
   $result = $path;
   if ($src = drupal_lookup_path('source', $path, $path_language)) {
     $result = $src;
Index: includes/database/database.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database/database.inc,v
retrieving revision 1.28
diff -u -p -r1.28 database.inc
--- includes/database/database.inc	15 Nov 2008 08:23:06 -0000	1.28
+++ includes/database/database.inc	19 Nov 2008 16:59:28 -0000
@@ -224,6 +224,8 @@ abstract class DatabaseConnection extend
 
     // Because the other methods don't seem to work right.
     $driver_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
+    // Empty string is converted to NULL.
+    $driver_options[PDO::ATTR_ORACLE_NULLS] = PDO::NULL_EMPTY_STRING;
 
     // Call PDO::__construct and PDO::setAttribute.
     parent::__construct($dsn, $username, $password, $driver_options);
@@ -454,6 +456,12 @@ abstract class DatabaseConnection extend
     // Use default values if not already set.
     $options += $this->defaultOptions();
 
+    foreach ($args as &$arg) {
+      if ($arg === '') {
+        $arg = NULL;
+      }
+    }
+
     try {
       // We allow either a pre-bound statement object or a literal string.
       // In either case, we want to end up with an executed statement object,
@@ -2243,6 +2251,23 @@ function _db_query_process_args($query, 
     $options['target'] = 'default';
   }
 
+  // TODO: temporary replace '' as NULL here.
+  foreach ($args as &$arg) {
+    if ($arg === '') {
+      $arg = NULL;
+    }
+  }
+
+  // TODO: remove debug
+  openlog("drupal", LOG_PID | LOG_PERROR, LOG_LOCAL0);
+  if (preg_match("/''/", $query)) {
+    syslog(LOG_ERR, "INLINE EMPTY STRING: " . $query);
+  }
+  if (in_array('', $args, TRUE)) {
+    syslog(LOG_ERR, "ARGS EMPTY STRING: " . $query . ' ' . array_search('', $args, TRUE));
+  }
+  closelog();
+
   // Temporary backward-compatibliity hacks.  Remove later.
   $old_query = $query;
   $query = str_replace(array('%n', '%d', '%f', '%b', "'%s'", '%s'), '?', $old_query);
Index: includes/database/mysql/schema.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database/mysql/schema.inc,v
retrieving revision 1.6
diff -u -p -r1.6 schema.inc
--- includes/database/mysql/schema.inc	13 Nov 2008 20:52:13 -0000	1.6
+++ includes/database/mysql/schema.inc	19 Nov 2008 16:59:28 -0000
@@ -73,6 +73,18 @@ class DatabaseSchema_mysql extends Datab
   protected function createFieldSql($name, $spec) {
     $sql = "`" . $name . "` " . $spec['mysql_type'];
 
+    if ($spec['type'] == 'char' || $spec['type'] == 'varchar' || $spec['type'] == 'text' || $spec['type'] == 'blob') {
+      // Not allow default with '', so switch field as nullable.
+      if (isset($spec['default']) && $spec['default'] == '') {
+        unset($spec['default']);
+        $spec['not null'] = FALSE;
+      }
+      // Set field as nullable if no valid default value.
+      if (!isset($spec['default']) && !empty($spec['not null'])) {
+        $spec['not null'] = FALSE;
+      }
+    }
+
     if (isset($spec['length'])) {
       $sql .= '(' . $spec['length'] . ')';
     }
Index: includes/database/pgsql/schema.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database/pgsql/schema.inc,v
retrieving revision 1.2
diff -u -p -r1.2 schema.inc
--- includes/database/pgsql/schema.inc	15 Sep 2008 20:48:07 -0000	1.2
+++ includes/database/pgsql/schema.inc	19 Nov 2008 16:59:28 -0000
@@ -80,6 +80,18 @@ class DatabaseSchema_pgsql extends Datab
   protected function createFieldSql($name, $spec) {
     $sql = $name . ' ' . $spec['pgsql_type'];
 
+    if ($spec['type'] == 'char' || $spec['type'] == 'varchar' || $spec['type'] == 'text' || $spec['type'] == 'blob') {
+      // Not allow default with '', so switch field as nullable.
+      if (isset($spec['default']) && $spec['default'] == '') {
+        unset($spec['default']);
+        $spec['not null'] = FALSE;
+      }
+      // Set field as nullable if no valid default value.
+      if (!isset($spec['default']) && !empty($spec['not null'])) {
+        $spec['not null'] = FALSE;
+      }
+    }
+
     if ($spec['type'] == 'serial') {
       unset($spec['not null']);
     }
Index: modules/node/node.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.admin.inc,v
retrieving revision 1.29
diff -u -p -r1.29 node.admin.inc
--- modules/node/node.admin.inc	10 Nov 2008 05:22:59 -0000	1.29
+++ modules/node/node.admin.inc	19 Nov 2008 16:59:28 -0000
@@ -452,7 +452,7 @@ function node_admin_content($form_state)
 function node_admin_nodes() {
   // Enable language column if translation module is enabled
   // or if we have any node with language.
-  $multilanguage = (module_exists('translation') || db_result(db_query("SELECT COUNT(*) FROM {node} WHERE language != ''")));
+  $multilanguage = (module_exists('translation') || db_result(db_query("SELECT COUNT(*) FROM {node} WHERE language <> 'default'")));
 
   // Build the sortable table header.
   $header = array();
Index: modules/node/node.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v
retrieving revision 1.45
diff -u -p -r1.45 node.pages.inc
--- modules/node/node.pages.inc	13 Oct 2008 00:33:03 -0000	1.45
+++ modules/node/node.pages.inc	19 Nov 2008 16:59:28 -0000
@@ -57,7 +57,7 @@ function node_add($type) {
   // If a node type has been specified, validate its existence.
   if (isset($types[$type]) && node_access('create', $type)) {
     // Initialize settings:
-    $node = array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => $type, 'language' => '');
+    $node = array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => $type, 'language' => 'default');
 
     drupal_set_title(t('Create @name', array('@name' => $types[$type]->name)), PASS_THROUGH);
     $output = drupal_get_form($type . '_node_form', $node);
Index: modules/path/path.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/path/path.admin.inc,v
retrieving revision 1.14
diff -u -p -r1.14 path.admin.inc
--- modules/path/path.admin.inc	13 Oct 2008 00:33:03 -0000	1.14
+++ modules/path/path.admin.inc	19 Nov 2008 16:59:28 -0000
@@ -15,7 +15,7 @@ function path_admin_overview($keys = NUL
   // Add the filter form above the overview table.
   $output = drupal_get_form('path_admin_filter_form', $keys);
   // Enable language column if locale is enabled or if we have any alias with language
-  $count = db_result(db_query("SELECT COUNT(*) FROM {url_alias} WHERE language != ''"));
+  $count = db_result(db_query("SELECT COUNT(*) FROM {url_alias} WHERE language <> 'default'"));
   $multilanguage = (module_exists('locale') || $count);
 
   if ($keys) {
@@ -83,7 +83,7 @@ function path_admin_edit($pid = 0) {
  * @see path_admin_form_validate()
  * @see path_admin_form_submit()
  */
-function path_admin_form(&$form_state, $edit = array('src' => '', 'dst' => '', 'language' => '', 'pid' => NULL)) {
+function path_admin_form(&$form_state, $edit = array('src' => '', 'dst' => '', 'language' => 'default', 'pid' => NULL)) {
 
   $form['#alias'] = $edit;
 
@@ -132,7 +132,7 @@ function path_admin_form_validate($form,
   $dst = $form_state['values']['dst'];
   $pid = isset($form_state['values']['pid']) ? $form_state['values']['pid'] : 0;
   // Language is only set if locale module is enabled, otherwise save for all languages.
-  $language = isset($form_state['values']['language']) ? $form_state['values']['language'] : '';
+  $language = $form_state['values']['language'];
 
   if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE pid != %d AND dst = '%s' AND language = '%s'", $pid, $dst, $language))) {
     form_set_error('dst', t('The alias %alias is already in use in this language.', array('%alias' => $dst)));
@@ -148,7 +148,7 @@ function path_admin_form_validate($form,
  */
 function path_admin_form_submit($form, &$form_state) {
   // Language is only set if locale module is enabled
-  path_set_alias($form_state['values']['src'], $form_state['values']['dst'], isset($form_state['values']['pid']) ? $form_state['values']['pid'] : 0, isset($form_state['values']['language']) ? $form_state['values']['language'] : '');
+  path_set_alias($form_state['values']['src'], $form_state['values']['dst'], isset($form_state['values']['pid']) ? $form_state['values']['pid'] : 0, $form_state['values']['language']);
 
   drupal_set_message(t('The alias has been saved.'));
   $form_state['redirect'] = 'admin/build/path';
Index: modules/path/path.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/path/path.module,v
retrieving revision 1.149
diff -u -p -r1.149 path.module
--- modules/path/path.module	12 Oct 2008 04:30:06 -0000	1.149
+++ modules/path/path.module	19 Nov 2008 16:59:28 -0000
@@ -78,7 +78,7 @@ function path_admin_delete($pid = 0) {
 /**
  * Set an aliased path for a given Drupal path, preventing duplicates.
  */
-function path_set_alias($path = NULL, $alias = NULL, $pid = NULL, $language = '') {
+function path_set_alias($path = NULL, $alias = NULL, $pid = NULL, $language = 'default') {
   $path = urldecode($path);
   $alias = urldecode($alias);
   // First we check if we deal with an existing alias and delete or modify it based on pid.
@@ -123,7 +123,7 @@ function path_set_alias($path = NULL, $a
 function path_nodeapi_validate(&$node, $arg) {
   if (user_access('create url aliases') || user_access('administer url aliases')) {
     if (isset($node->path)) {
-      $language = isset($node->language) ? $node->language : '';
+      $language = ($node->language != 'default') ? $node->language : 'default';
       $node->path = trim($node->path);
       if (db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE dst = '%s' AND src != '%s' AND language = '%s'", $node->path, "node/$node->nid", $language))) {
         form_set_error('path', t('The path is already in use.'));
@@ -136,7 +136,7 @@ function path_nodeapi_validate(&$node, $
  * Implementation of hook_nodeapi_load().
  */
 function path_nodeapi_load(&$node, $arg) {
-  $language = isset($node->language) ? $node->language : '';
+  $language = ($node->language != 'default') ? $node->language : 'default';
   $path = 'node/' . $node->nid;
   $alias = drupal_get_path_alias($path, $language);
   if ($path != $alias) {
@@ -149,7 +149,7 @@ function path_nodeapi_load(&$node, $arg)
  */
 function path_nodeapi_insert(&$node, $arg) {
   if (user_access('create url aliases') || user_access('administer url aliases')) {
-    $language = isset($node->language) ? $node->language : '';
+    $language = ($node->language != 'default') ? $node->language : 'default';
     // Don't try to insert if path is NULL. We may have already set
     // the alias ahead of time.
     if (isset($node->path)) {
@@ -163,7 +163,7 @@ function path_nodeapi_insert(&$node, $ar
  */
 function path_nodeapi_update(&$node, $arg) {
   if (user_access('create url aliases') || user_access('administer url aliases')) {
-    $language = isset($node->language) ? $node->language : '';
+    $language = ($node->language != 'default') ? $node->language : 'default';
     path_set_alias('node/' . $node->nid, isset($node->path) ? $node->path : NULL, isset($node->pid) ? $node->pid : NULL, $language);
   }
 }
@@ -173,7 +173,6 @@ function path_nodeapi_update(&$node, $ar
  */
 function path_nodeapi_delete(&$node, $arg) {
   if (user_access('create url aliases') || user_access('administer url aliases')) {
-    $language = isset($node->language) ? $node->language : '';
     $path = 'node/' . $node->nid;
     if (drupal_get_path_alias($path) != $path) {
       path_set_alias($path);
Index: modules/system/system.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v
retrieving revision 1.104
diff -u -p -r1.104 system.admin.inc
--- modules/system/system.admin.inc	11 Nov 2008 22:39:59 -0000	1.104
+++ modules/system/system.admin.inc	19 Nov 2008 16:59:28 -0000
@@ -1772,7 +1772,7 @@ function system_status($check = FALSE) {
   }
   // MySQL import might have set the uid of the anonymous user to autoincrement
   // value. Let's try fixing it. See http://drupal.org/node/204411
-  db_query("UPDATE {users} SET uid = uid - uid WHERE name = '' AND pass = '' AND status = 0");
+  db_query("UPDATE {users} SET uid = uid - uid WHERE name IS NULL AND pass IS NULL AND status = 0");
 
   return theme('status_report', $requirements);
 }
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.638
diff -u -p -r1.638 system.module
--- modules/system/system.module	15 Nov 2008 08:23:07 -0000	1.638
+++ modules/system/system.module	19 Nov 2008 16:59:29 -0000
@@ -1526,7 +1526,7 @@ function system_actions_manage() {
   }
 
   $row = array();
-  $instances_present = db_fetch_object(db_query("SELECT aid FROM {actions} WHERE parameters <> ''"));
+  $instances_present = db_fetch_object(db_query("SELECT aid FROM {actions} WHERE parameters IS NOT NULL"));
   $header = array(
     array('data' => t('Action type'), 'field' => 'type'),
     array('data' => t('Description'), 'field' => 'description'),
Index: modules/user/user.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.test,v
retrieving revision 1.19
diff -u -p -r1.19 user.test
--- modules/user/user.test	18 Nov 2008 15:06:47 -0000	1.19
+++ modules/user/user.test	19 Nov 2008 16:59:29 -0000
@@ -46,7 +46,7 @@ class UserRegistrationTestCase extends D
     $this->assertTrue(($user->created > REQUEST_TIME - 20 ), t('Correct creation time.'));
     $this->assertEqual($user->status, variable_get('user_register', 1) == 1 ? 1 : 0, t('Correct status field.'));
     $this->assertEqual($user->timezone, variable_get('date_default_timezone', NULL), t('Correct timezone field.'));
-    $this->assertEqual($user->language, '', t('Correct language field.'));
+    $this->assertEqual($user->language, 'default', t('Correct language field.'));
     $this->assertEqual($user->picture, '', t('Correct picture field.'));
     $this->assertEqual($user->init, $mail, t('Correct init field.'));
 
