Merge pull request #2089 from citusdata/fix_size_query

Fix issue preventing multiple size function calls per query
pull/2085/merge
Marco Slot 2018-04-12 14:44:34 +02:00 committed by GitHub
commit b4c9e2c1ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 0 deletions

View File

@ -214,6 +214,7 @@ DistributedTableSizeOnWorker(WorkerNode *workerNode, Oid relationId, char *sizeQ
PGresult *result = NULL;
int queryResult = 0;
List *sizeList = NIL;
bool raiseErrors = true;
List *shardIntervalsOnNode = ShardIntervalsOnWorkerGroup(workerNode, relationId);
@ -235,6 +236,8 @@ DistributedTableSizeOnWorker(WorkerNode *workerNode, Oid relationId, char *sizeQ
tableSizeString = tableSizeStringInfo->data;
tableSize = atol(tableSizeString);
ClearResults(connection, raiseErrors);
return tableSize;
}

View File

@ -49,6 +49,15 @@ SELECT citus_total_relation_size('customer_copy_hash');
1597440
(1 row)
-- Make sure we can get multiple sizes in a single query
SELECT citus_table_size('customer_copy_hash'),
citus_table_size('customer_copy_hash'),
citus_table_size('supplier');
citus_table_size | citus_table_size | citus_table_size
------------------+------------------+------------------
548864 | 548864 | 401408
(1 row)
CREATE INDEX index_1 on customer_copy_hash(c_custkey);
VACUUM (FULL) customer_copy_hash;
-- Tests on distributed table with index.

View File

@ -32,6 +32,11 @@ SELECT citus_table_size('customer_copy_hash');
SELECT citus_relation_size('customer_copy_hash');
SELECT citus_total_relation_size('customer_copy_hash');
-- Make sure we can get multiple sizes in a single query
SELECT citus_table_size('customer_copy_hash'),
citus_table_size('customer_copy_hash'),
citus_table_size('supplier');
CREATE INDEX index_1 on customer_copy_hash(c_custkey);
VACUUM (FULL) customer_copy_hash;