From: Christian Grothoff Date: Sun, 25 Jun 2017 15:05:09 +0000 (+0200) Subject: allow NULL fields for varsize X-Git-Tag: gnunet-0.11.0rc0~208 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=169f1c8c1db0a6d8cebf308ced1de064eadcdc4d;p=oweals%2Fgnunet.git allow NULL fields for varsize --- diff --git a/src/datacache/plugin_datacache_postgres.c b/src/datacache/plugin_datacache_postgres.c index 5c497cdf8..2fe6498a5 100644 --- a/src/datacache/plugin_datacache_postgres.c +++ b/src/datacache/plugin_datacache_postgres.c @@ -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)"), diff --git a/src/pq/pq_result_helper.c b/src/pq/pq_result_helper.c index d212ab1b8..045fe74b1 100644 --- a/src/pq/pq_result_helper.c +++ b/src/pq/pq_result_helper.c @@ -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 */ diff --git a/src/psycstore/plugin_psycstore_postgres.c b/src/psycstore/plugin_psycstore_postgres.c index 5bf0ba706..046daf6ea 100644 --- a/src/psycstore/plugin_psycstore_postgres.c +++ b/src/psycstore/plugin_psycstore_postgres.c @@ -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[] = {