xref: /sqlite-3.40.0/test/vtabdistinct.test (revision 697c50b9)
1# 2022-01-21
2#
3# The author disclaims copyright to this source code.  In place of
4# a legal notice, here is a blessing:
5#
6#    May you do good and not evil.
7#    May you find forgiveness for yourself and forgive others.
8#    May you share freely, never taking more than you give.
9#
10#***********************************************************************
11#
12# This file implements tests for sqlite3_vtab_distinct() interface.
13#
14
15set testdir [file dirname $argv0]
16source $testdir/tester.tcl
17set testprefix vtabdistinct
18
19ifcapable !vtab {
20  finish_test
21  return
22}
23load_static_extension db qpvtab
24
25do_execsql_test 1.1 {
26  SELECT ix FROM qpvtab WHERE vn='sqlite3_vtab_distinct';
27} {0}
28do_execsql_test 1.2 {
29  SELECT DISTINCT ix FROM qpvtab WHERE vn='sqlite3_vtab_distinct';
30} {2}
31do_execsql_test 1.3 {
32  SELECT distinct vn, ix FROM qpvtab(3)
33   WHERE +vn IN ('sqlite3_vtab_distinct','nOrderBy');
34} {nOrderBy 2 sqlite3_vtab_distinct 2}
35do_execsql_test 1.4 {
36  SELECT vn, ix FROM qpvtab
37   GROUP BY vn
38  HAVING vn='sqlite3_vtab_distinct';
39} {sqlite3_vtab_distinct 1}
40
41finish_test
42