File: error_checks.sql

package info (click to toggle)
pgfaceting 0.2.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 160 kB
  • sloc: sql: 811; makefile: 12; sh: 1
file content (52 lines) | stat: -rw-r--r-- 1,358 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
CREATE EXTENSION IF NOT EXISTS roaringbitmap;
CREATE EXTENSION IF NOT EXISTS pgfaceting;

CREATE SCHEMA errorchecks;
SET SEARCH_PATH = 'errorchecks', 'public';

CREATE TABLE uuid_based_docs (
    id uuid primary key,
    type text
);

CREATE TABLE text_based_docs (
    id text primary key,
    type text
);

CREATE TABLE int4_based_docs (
    id int4 primary key,
    type text
);

-- Expected error on key col not existing
SELECT faceting.add_faceting_to_table('uuid_based_docs',
        key => 'nonexistent',
        facets => array[faceting.plain_facet('type')]
    );

-- Expected error on wrong type key column
SELECT faceting.add_faceting_to_table('uuid_based_docs',
        key => 'id',
        facets => array[faceting.plain_facet('type')]
    );
SELECT faceting.add_faceting_to_table('text_based_docs',
        key => 'id',
        facets => array[faceting.plain_facet('type')]
    );

-- Wrong chunk bits
SELECT faceting.add_faceting_to_table('int4_based_docs',
        key => 'id',
        chunk_bits => 42,
        facets => array[faceting.plain_facet('type')]
    );

-- Not faceted table
SELECT faceting.add_facets('int4_based_docs', facets => array[faceting.plain_facet('type')]);

-- Expected no error
SELECT faceting.add_faceting_to_table('int4_based_docs',
        key => 'id',
        facets => array[faceting.plain_facet('type')]
    );