Merge pull request #432 from citusdata/bugfix/#374-select-without-target-crash

Fix SELECT problem with no target list
pull/436/head
Ahmet Eren Basak 2016-04-13 11:43:20 +03:00
commit a3b1b8944d
3 changed files with 21 additions and 1 deletions

View File

@ -46,7 +46,7 @@ SetRangeTblExtraData(RangeTblEntry *rte, CitusRTEKind rteKind,
Const *fragmentTableData = NULL; Const *fragmentTableData = NULL;
Const *tableIdListData = NULL; Const *tableIdListData = NULL;
Assert(rte->eref && rte->eref->colnames != NIL); Assert(rte->eref);
/* store RTE kind as a plain int4 */ /* store RTE kind as a plain int4 */
rteKindData = makeNode(Const); rteKindData = makeNode(Const);

View File

@ -285,6 +285,19 @@ SELECT COUNT(*) FROM articles;
50 50
(1 row) (1 row)
-- test with empty target list
SELECT FROM articles;
--
(50 rows)
SELECT FROM articles WHERE author_id = 3737;
--
(0 rows)
SELECT FROM articles WHERE word_count = 65500;
--
(0 rows)
-- having queries unsupported in Citus -- having queries unsupported in Citus
SELECT author_id, sum(word_count) AS corpus_size FROM articles SELECT author_id, sum(word_count) AS corpus_size FROM articles
GROUP BY author_id GROUP BY author_id

View File

@ -166,6 +166,13 @@ $sharded_sql$;
-- test cross-shard queries -- test cross-shard queries
SELECT COUNT(*) FROM articles; SELECT COUNT(*) FROM articles;
-- test with empty target list
SELECT FROM articles;
SELECT FROM articles WHERE author_id = 3737;
SELECT FROM articles WHERE word_count = 65500;
-- having queries unsupported in Citus -- having queries unsupported in Citus
SELECT author_id, sum(word_count) AS corpus_size FROM articles SELECT author_id, sum(word_count) AS corpus_size FROM articles
GROUP BY author_id GROUP BY author_id