gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] 04/08: fix possibility of NULL result for empty da


From: gnunet
Subject: [GNUnet-SVN] [gnunet] 04/08: fix possibility of NULL result for empty database
Date: Tue, 19 Feb 2019 02:02:06 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet.

commit 472250336a3732a1afdd7d2f53386a650b812502
Author: Christian Grothoff <address@hidden>
AuthorDate: Tue Feb 19 01:51:02 2019 +0100

    fix possibility of NULL result for empty database
---
 src/datastore/plugin_datastore_postgres.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/datastore/plugin_datastore_postgres.c 
b/src/datastore/plugin_datastore_postgres.c
index 94db6e116..0a3018411 100644
--- a/src/datastore/plugin_datastore_postgres.c
+++ b/src/datastore/plugin_datastore_postgres.c
@@ -11,7 +11,7 @@
      WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      Affero General Public License for more details.
-    
+
      You should have received a copy of the GNU Affero General Public License
      along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
@@ -153,7 +153,11 @@ init_connection (struct Plugin *plugin)
                             "SELECT hash FROM gn090",
                             0),
     GNUNET_PQ_make_prepare ("estimate_size",
-                            "SELECT SUM(LENGTH(value))+256*COUNT(*) AS total 
FROM gn090",
+                            "SELECT CASE WHEN NOT EXISTS"
+                            "  (SELECT 1 FROM gn090)"
+                            "  THEN 0"
+                            "  ELSE (SELECT SUM(LENGTH(value))+256*COUNT(*) 
FROM gn090)"
+                            "END AS total",
                             0),
     GNUNET_PQ_PREPARED_STATEMENT_END
   };

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]