MediaWiki doesn't support PostgreSQL < 9.2, so drop the support for older versions. At the same time, since we're messing with the DatabasePostgres::insert() code anyway, let's start using ON CONFLICT DO NOTHING for PG >= 9.5. And since we're doing that, let's do the same for DatabasePostgres::nativeInsertSelect(). Change-Id: I7bf13c3272917ebafeaff11eb116714a099afdf3
13 lines
324 B
PL/PgSQL
13 lines
324 B
PL/PgSQL
CREATE OR REPLACE FUNCTION ts2_page_title()
|
|
RETURNS TRIGGER
|
|
LANGUAGE plpgsql AS
|
|
$mw$
|
|
BEGIN
|
|
IF TG_OP = 'INSERT' THEN
|
|
NEW.titlevector = to_tsvector(REPLACE(NEW.page_title,'/',' '));
|
|
ELSIF NEW.page_title != OLD.page_title THEN
|
|
NEW.titlevector := to_tsvector(REPLACE(NEW.page_title,'/',' '));
|
|
END IF;
|
|
RETURN NEW;
|
|
END;
|
|
$mw$;
|