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 53 54 55 56 57 58 59 60
|
CREATE EXTENSION IF NOT EXISTS roaringbitmap;
NOTICE: extension "roaringbitmap" already exists, skipping
CREATE EXTENSION IF NOT EXISTS pgfaceting;
NOTICE: extension "pgfaceting" already exists, skipping
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')]
);
ERROR: Key column nonexistent not found in errorcheckss.uuid_based_docss
CONTEXT: PL/pgSQL function faceting.add_faceting_to_table(regclass,name,faceting.facet_definition[],integer,boolean,boolean) line 30 at RAISE
-- Expected error on wrong type key column
SELECT faceting.add_faceting_to_table('uuid_based_docs',
key => 'id',
facets => array[faceting.plain_facet('type')]
);
ERROR: Key column type uuid is not supported.
CONTEXT: PL/pgSQL function faceting.add_faceting_to_table(regclass,name,faceting.facet_definition[],integer,boolean,boolean) line 32 at RAISE
SELECT faceting.add_faceting_to_table('text_based_docs',
key => 'id',
facets => array[faceting.plain_facet('type')]
);
ERROR: Key column type text is not supported.
CONTEXT: PL/pgSQL function faceting.add_faceting_to_table(regclass,name,faceting.facet_definition[],integer,boolean,boolean) line 32 at RAISE
-- Wrong chunk bits
SELECT faceting.add_faceting_to_table('int4_based_docs',
key => 'id',
chunk_bits => 42,
facets => array[faceting.plain_facet('type')]
);
ERROR: Invalid number of bits per chunk: 42
CONTEXT: PL/pgSQL function faceting.add_faceting_to_table(regclass,name,faceting.facet_definition[],integer,boolean,boolean) line 19 at RAISE
-- Not faceted table
SELECT faceting.add_facets('int4_based_docs', facets => array[faceting.plain_facet('type')]);
ERROR: Table int4_based_docs is not faceted
CONTEXT: PL/pgSQL function faceting.add_facets(regclass,faceting.facet_definition[],boolean) line 12 at RAISE
-- Expected no error
SELECT faceting.add_faceting_to_table('int4_based_docs',
key => 'id',
facets => array[faceting.plain_facet('type')]
);
add_faceting_to_table
-----------------------
(1 row)
|