aboutsummaryrefslogtreecommitdiff
path: root/src/datastore/plugin_datastore_postgres.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/datastore/plugin_datastore_postgres.c')
-rw-r--r--src/datastore/plugin_datastore_postgres.c8
1 files 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 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
@@ -153,7 +153,11 @@ init_connection (struct Plugin *plugin)
153 "SELECT hash FROM gn090", 153 "SELECT hash FROM gn090",
154 0), 154 0),
155 GNUNET_PQ_make_prepare ("estimate_size", 155 GNUNET_PQ_make_prepare ("estimate_size",
156 "SELECT SUM(LENGTH(value))+256*COUNT(*) AS total FROM gn090", 156 "SELECT CASE WHEN NOT EXISTS"
157 " (SELECT 1 FROM gn090)"
158 " THEN 0"
159 " ELSE (SELECT SUM(LENGTH(value))+256*COUNT(*) FROM gn090)"
160 "END AS total",
157 0), 161 0),
158 GNUNET_PQ_PREPARED_STATEMENT_END 162 GNUNET_PQ_PREPARED_STATEMENT_END
159 }; 163 };