-- the limit registry (src/core/limits.h): sift._test_limits() lists it, sift.test_limits lowers a hooked limit and refuses the rest CREATE EXTENSION pg_sift; CREATE EXTENSION pg_sift_test; SELECT id, macro, dflt, effective = dflt AS unchanged, hooked FROM sift._test_limits() ORDER BY id; id | macro | dflt | unchanged | hooked ----------------------+---------------------------------+------------------+-----------+-------- any_list_rows | ANY_LIST_MAX_ROWS | 100000 | t | f arms | SIFT_AGG_MAX_ARMS | 16 | t | t array_bytes | SIFT_ARRAY_UNLIMITED | 1125899906842624 | t | t bits_set_values | MIN_BITS_VALUES | 1024 | t | t blob_bytes | BLOB_CHUNK_BYTES | 268435456 | t | t boost | SIFT_MAX_BOOST | 10000 | t | f calendar_groups | SIFT_PAGG_CAL_GROUPS | 1024 | t | f col_leaves | SIFT_COL_MAX_COLS | 128 | t | t combo_entries | COMBO_MAX_ENTRIES | 16777216 | t | t combo_leaves | SIFT_AGG_MAX_CLEAVES | 8 | t | f combos | SIFT_AGG_MAX_COMBOS | 128 | t | t cube_dims | SIFT_PAGG_MAX_DIMS | 16 | t | f cube_groups | SIFT_PAGG_DEF_GROUPS | 256 | t | f cube_measures | SIFT_PAGG_MAX_MEAS | 8 | t | f dict_bytes | SIFT_COL_DICT_MAX_BYTES | 67108864 | t | f dict_cache_kb | CDICT_CACHE_MAX_KB | 65536 | t | t dict_entry | SIFT_COL_DICT_MAX_ENTRY | 255 | t | f dict_lookup_min | CDICT_LOOKUP_MIN | 1024 | t | t dict_tsig_min | CDICT_TSIG_MIN_KB | 1024 | t | t dist_narrow_words | DIST_NARROW_WORDS | 8 | t | t doc_length | SIFT_MAX_DL | 65535 | t | f explicit_groups | SIFT_PAGG_CUBE_GROUPS | 4096 | t | f fields | SIFT_MAX_FIELDS | 14 | t | f filter_set | FILTER_MAX_SET | 8 | t | f first_keys | FIRST_MAX_KEYS | 4 | t | f first_order_cols | SIFT_AGG_MAX_FORD | 8 | t | t first_out_cols | SIFT_AGG_MAX_FOUT | 16 | t | f float_ops | SIFT_AGG_MAX_VX | 16 | t | f generic_args | SIFT_AGG_MAX_GARGS | 100 | t | f generic_leaves | SIFT_AGG_MAX_GLEAVES | 4 | t | f gord_free_rows | SIFT_CGORD_FREE_MAX | 65536 | t | t gord_mem_rows | SIFT_CGORD_MEM_MAX | 2097152 | t | t gord_pos_gap | SIFT_CGORD_POS_MAX_GAP | 1024 | t | t gord_pos_pct | SIFT_CGORD_POS_MAX_PCT | 75 | t | t gord_seek_pct | SIFT_CGORD_SEEK_MAX_PCT | 115 | t | t group_keys | SIFT_AGG_MAX_KEYS | 32 | t | t group_nospill_base | GROUP_NOSPILL_BASE | 8388608 | t | t group_nospill_factor | GROUP_NOSPILL_FACTOR | 32 | t | t group_spill_depth | SPILL_MAX_DEPTH | 8 | t | t group_spill_parts | SPILL_MAX_PARTS | 128 | t | t hash_part_combos | HASH_MAX_COMBOS | 1048576 | t | t int_digits | SIFT_COL_MAX_SCALE | 18 | t | f join_cols | SIFT_AGG_MAX_JCOLS | 16 | t | t join_index_eqs | SIFT_AGG_MAX_JIDX | 3 | t | f join_keys | SIFT_AGG_MAX_JKEYS | 3 | t | f joins | SIFT_AGG_MAX_JOINS | 32 | t | t layout_leaves | SIFT_COLSRC_MAX_LEAVES | 128 | t | f lookup_kb | - | 262144 | t | f lookup_shared_bytes | SHARE_MAX | 1073741824 | t | f lookup_shared_slots | LOOKSHM_SLOTS | 64 | t | f lst_min_units | LST_MIN_UNITS | 64 | t | t lst_share_div | LST_SHARE_DIV | 33 | t | t maint_backoff_ms | BACKOFF_MAX_MS | 3600000 | t | f max_segments | SIFT_MAX_SEGMENTS | 128 | t | t merge_disk_peak | - | 2 | t | f mirror_bytes | SEG_MIRROR_BYTES | 6144 | t | t num_in_list | AGG_MAX_NUM_IN | 64 | t | t par_build_rows | PAR_BUILD_ROWS | 150000 | t | t part_key_tests | KEYS_MAX_TESTS | 20000 | t | t partitions | SIFT_AGG_MAX_PARTS | 32768 | t | t phrase_terms | SIFT_MAX_PHRASE | 128 | t | t pre_census_units | - | 16 | t | t prefix_index | SIFT_MAX_PREFIX_INDEX | 15 | t | f presence_pct | SIFT_CSET_PRES_PCT | 3 | t | f query_bytes | SIFT_QUERY_MAX_BYTES | 262144 | t | t query_depth | SIFT_MAX_DEPTH | 32 | t | f query_leaves | SIFT_MAX_LEAVES | 256 | t | f regex_bytes | SIFT_MAX_REGEX_BYTES | 1000 | t | f rollup_dims | SIFT_PAGG_MAX_RDIMS | 6 | t | f rollup_tuples | SIFT_PAGG_ROLLUP_TUPLES | 4096 | t | f rollups | SIFT_PAGG_MAX_ROLLUPS | 8 | t | f rows_shared | SIFT_ROWS_MAX_SHARED | 32 | t | t scan_filters | SIFT_COLSRC_MAX_FILTERS | 64 | t | f segment_cache_kb | SEGCACHE_MAX_KB | 32768 | t | t semi_set | SIFT_SEMI_MAX_SET | 65536 | t | f set_keys | SIFT_CSET_LIMIT | 32 | t | f set_keys_max | SIFT_CSET_LIMIT_MAX | 1024 | t | f shred_groups | SIFT_SHRED_MAX_GROUPS | 64 | t | f shred_key_bytes | SIFT_SHRED_MAX_KEY_BYTES | 255 | t | f shred_keys | SIFT_SHRED_DEFAULT_KEYS | 65536 | t | t shred_leaves | SIFT_SHRED_MAX_COLS | 256 | t | f shred_spec_bytes | SIFT_SHRED_MAX_SPEC_BYTES | 65536 | t | f shred_steps | SIFT_SHRED_MAX_STEPS | 16 | t | f shred_text | SIFT_SHRED_MAX_TEXT | 1048576 | t | f skip_pending | GORD_PEND_MAX | 1048576 | t | t string_bytes | SIFT_COL_MAX_VALUE | 1073741823 | t | t super_fan_max | SIFT_SUPER_MAX_FAN | 256 | t | f table_vblocks | - | 4294967294 | t | f term_bytes | SIFT_MAX_TERM_BYTES | 255 | t | f term_tf | SIFT_MAX_TF | 255 | t | f text_prune | COL_MAX_STR_PRUNE | 16 | t | f tomb_log_kb | SIFT_TOMB_LOG_KB | 8388608 | t | f topn_code_entries | ORD_MAX_ENTRIES | 1048576 | t | t topn_keys | SIFT_TOPN_MAX_KEYS | 8 | t | t topn_rows | SIFT_TOPN_MAX_ROWS | 100000 | t | t unit_bytes | SIFT_COL_UNIT_MAX_BYTES | 1073741823 | t | t unit_rows | SIFT_COL_UNIT_MAX_ROWS | 74496 | t | f virtual_leaves | SIFT_AGG_MAX_VLEAVES | 16 | t | t wide_conjuncts | SIFT_AGG_MAX_WIDE | 8 | t | f wide_dict_bytes | - | 1073741823 | t | t wide_digits | SIFT_COL_MAX_WIDE_SCALE | 38 | t | f write_buffer_kb | SIFT_DEFAULT_WRITE_BUFFER_LIMIT | 4096 | t | f (102 rows) -- a hooked limit is lowered for the session and comes back with RESET SET sift.test_limits = 'query_bytes=64, phrase_terms=3'; SELECT id, dflt, effective FROM sift._test_limits() WHERE effective <> dflt ORDER BY id; id | dflt | effective --------------+--------+----------- phrase_terms | 128 | 3 query_bytes | 262144 | 64 (2 rows) CREATE TABLE items (id int, body text); INSERT INTO items SELECT i, 'alpha beta gamma delta epsilon w' || i % 7 FROM generate_series(1, 300) i; CREATE INDEX items_idx ON items USING sift (body); SELECT count(*) FROM items WHERE body @@> 'alpha'; count ------- 300 (1 row) SELECT count(*) FROM items WHERE body @@> repeat('alpha ', 20); ERROR: sift query is too long DETAIL: The query has 120 bytes, the maximum is 64. SELECT count(*) FROM items WHERE body @@> '"alpha beta gamma"'; count ------- 300 (1 row) SELECT count(*) FROM items WHERE body @@> '"alpha beta gamma delta"'; ERROR: sift query: phrase longer than 3 terms at position 1 RESET sift.test_limits; SELECT count(*) FROM items WHERE body @@> repeat('alpha ', 20); count ------- 300 (1 row) SELECT count(*) FROM items WHERE body @@> '"alpha beta gamma delta"'; count ------- 300 (1 row) SELECT count(*) FROM sift._test_limits() WHERE effective <> dflt; count ------- 0 (1 row) -- the setting rejects what would pass a test for the wrong reason SET sift.test_limits = 'no_such_limit=1'; ERROR: unknown limit "no_such_limit" in sift.test_limits HINT: The ids are the first column of SIFT_LIMITS in src/core/limits.h. SET sift.test_limits = 'arms=1'; SET sift.test_limits = 'query_bytes=-1'; ERROR: invalid value "-1" for limit "query_bytes" HINT: A value is a number from 0 to the default, 262144. SET sift.test_limits = 'query_bytes=9999999'; ERROR: invalid value "9999999" for limit "query_bytes" HINT: A value is a number from 0 to the default, 262144. SET sift.test_limits = 'query_bytes'; ERROR: invalid item "query_bytes" in sift.test_limits HINT: Use id=value, separated by commas. SET sift.test_limits = 'query_bytes=12x'; ERROR: invalid value "12x" for limit "query_bytes" HINT: A value is a number from 0 to the default, 262144. SHOW sift.test_limits; sift.test_limits ------------------ arms=1 (1 row) -- 0 is a value: a query of any length is too long SET sift.test_limits = 'query_bytes=0'; SELECT count(*) FROM items WHERE body @@> 'alpha'; ERROR: sift query is too long DETAIL: The query has 5 bytes, the maximum is 0. RESET sift.test_limits; DROP TABLE items; DROP EXTENSION pg_sift_test; DROP EXTENSION pg_sift;