@@ -220,4 +220,68 @@ SELECT ts_filter('base hidden rebel spaceship strike'::tsvector2, '{a}');
220220
221221SELECT ts_filter('base hidden rebel spaceship strike'::tsvector2, '{a,b,NULL}');
222222ERROR: weight array may not contain nulls
223+ CREATE TABLE t1(a tsvector2, t text);
224+ CREATE TRIGGER tsvectorupdate
225+ BEFORE UPDATE OR INSERT ON t1
226+ FOR EACH ROW EXECUTE PROCEDURE tsvector2_update_trigger(a, 'pg_catalog.english', t);
227+ SELECT * FROM t1;
228+ a | t
229+ ---+---
230+ (0 rows)
231+
232+ INSERT INTO t1 (t) VALUES ('345 qwerty');
233+ SELECT * FROM t1;
234+ a | t
235+ --------------------+------------
236+ '345':1 'qwerti':2 | 345 qwerty
237+ (1 row)
238+
239+ UPDATE t1 SET t = null WHERE t = '345 qwerty';
240+ SELECT * FROM t1;
241+ a | t
242+ ---+---
243+ |
244+ (1 row)
245+
246+ INSERT INTO t1 (t) VALUES ('345 qwerty');
247+ SELECT * FROM t1;
248+ a | t
249+ --------------------+------------
250+ |
251+ '345':1 'qwerti':2 | 345 qwerty
252+ (2 rows)
253+
254+ DROP TABLE t1 CASCADE;
255+ CREATE TABLE t2(a tsvector2, t text, c regconfig);
256+ CREATE TRIGGER tsvectorupdate
257+ BEFORE UPDATE OR INSERT ON t2
258+ FOR EACH ROW EXECUTE PROCEDURE tsvector2_update_trigger_column(a, c, t);
259+ SELECT * FROM t2;
260+ a | t | c
261+ ---+---+---
262+ (0 rows)
263+
264+ INSERT INTO t2 (t, c) VALUES ('345 qwerty', 'pg_catalog.english');
265+ SELECT * FROM t2;
266+ a | t | c
267+ --------------------+------------+---------
268+ '345':1 'qwerti':2 | 345 qwerty | english
269+ (1 row)
270+
271+ UPDATE t2 SET t = null WHERE t = '345 qwerty';
272+ SELECT * FROM t2;
273+ a | t | c
274+ ---+---+---------
275+ | | english
276+ (1 row)
277+
278+ INSERT INTO t2 (t, c) VALUES ('345 qwerty', 'pg_catalog.english');
279+ SELECT * FROM t2;
280+ a | t | c
281+ --------------------+------------+---------
282+ | | english
283+ '345':1 'qwerti':2 | 345 qwerty | english
284+ (2 rows)
285+
286+ DROP TABLE t2 CASCADE;
223287drop extension tsvector2 cascade;
0 commit comments