allow NULL fields for varsize
authorChristian Grothoff <christian@grothoff.org>
Sun, 25 Jun 2017 15:05:09 +0000 (17:05 +0200)
committerChristian Grothoff <christian@grothoff.org>
Sun, 25 Jun 2017 15:05:22 +0000 (17:05 +0200)
src/datacache/plugin_datacache_postgres.c
src/pq/pq_result_helper.c
src/psycstore/plugin_psycstore_postgres.c

index 5c497cdf8eefd9084dd2754de69246a11ddb99b1..2fe6498a5149c8d9cd65014e637c5c4792a010a3 100644 (file)
@@ -68,11 +68,11 @@ init_connection (struct Plugin *plugin)
 {
   struct GNUNET_PQ_ExecuteStatement es[] = {
     GNUNET_PQ_make_execute ("CREATE TEMPORARY TABLE IF NOT EXISTS gn090dc ("
-                            "  type INTEGER NOT NULL DEFAULT 0,"
-                            "  discard_time BIGINT NOT NULL DEFAULT 0,"
-                            "  key BYTEA NOT NULL DEFAULT '',"
-                            "  value BYTEA NOT NULL DEFAULT '',"
-                            "  path BYTEA DEFAULT '')"
+                            "  type INTEGER NOT NULL,"
+                            "  discard_time BIGINT NOT NULL,"
+                            "  key BYTEA NOT NULL,"
+                            "  value BYTEA NOT NULL,"
+                            "  path BYTEA DEFAULT NULL)"
                             "WITH OIDS"),
     GNUNET_PQ_make_try_execute ("CREATE INDEX IF NOT EXISTS idx_key ON gn090dc (key)"),
     GNUNET_PQ_make_try_execute ("CREATE INDEX IF NOT EXISTS idx_dt ON gn090dc (discard_time)"),
index d212ab1b8441d80fc920d469e90c8c681c6feeb6..045fe74b14e4cb3efe020e68d6c037d01db361e4 100644 (file)
@@ -84,8 +84,8 @@ extract_varsize_blob (void *cls,
                   row,
                   fnum))
   {
-    GNUNET_break (0);
-    return GNUNET_SYSERR;
+    /* Let's allow this for varsize */
+    return GNUNET_OK;
   }
   /* if a field is null, continue but
    * remember that we now return a different result */
index 5bf0ba7062ef8ea63b8207478b5f858cffe9d791..046daf6eadcfb8271265d0cee3c4dcdea089a146 100644 (file)
@@ -514,16 +514,18 @@ postgres_membership_store (void *cls,
 
   GNUNET_assert (TRANSACTION_NONE == plugin->transaction);
 
-  if (announced_at > INT64_MAX ||
-      effective_since > INT64_MAX ||
-      group_generation > INT64_MAX)
+  if ( (announced_at > INT64_MAX) ||
+       (effective_since > INT64_MAX) ||
+       (group_generation > INT64_MAX) )
   {
     GNUNET_break (0);
     return GNUNET_SYSERR;
   }
 
-  if (GNUNET_OK != channel_key_store (plugin, channel_key)
-      || GNUNET_OK != slave_key_store (plugin, slave_key))
+  if ( (GNUNET_OK !=
+       channel_key_store (plugin, channel_key)) ||
+       (GNUNET_OK !=
+       slave_key_store (plugin, slave_key)) )
     return GNUNET_SYSERR;
 
   struct GNUNET_PQ_QueryParam params[] = {