From 57e5154a8dd64ac28cf8f031650fbd3067cc0509 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Mon, 1 Oct 2012 17:50:44 +0200 Subject: [PATCH] Quote table name while querying for size. Closes #891 --- app/models/user.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/user.rb b/app/models/user.rb index ec414a663f..663bb288d0 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -273,7 +273,7 @@ class User < Sequel::Model # TODO: Without a full table scan, ignoring the_geom_webmercator, we cannot accuratly asses table size # Needs to go on a background job. def db_size_in_bytes - size = in_database(:as => :superuser).fetch("SELECT sum(pg_relation_size(table_name)) + size = in_database(:as => :superuser).fetch("SELECT sum(pg_relation_size(quote_ident(table_name))) FROM information_schema.tables WHERE table_catalog = '#{database_name}' AND table_schema = 'public' AND table_name != 'spatial_ref_sys'").first[:sum]