2026-02-22, 02:28 AM
MyBB only has rudimentary postgres support. This takes a significant step at making it a first class citizen.
Patch: http://pastebin.irixnet.org/view.php?id=klTaH5Jl
Scope of Testing:
Tested on a clean MyBB 1.8.x install.
Might require more extensive teaching. I don't have any Postgres systems to test on in production.
Patch touches the following:
1. inc/functions_search.php - Two new functions appended
2. search.php - Dispatch logic updated (2 locations)
3. inc/db/PostgresPdoDbDriver.php - Five methods updated/added
New Setting (optional):
pgsql_fts_config - Text search configuration name (default: 'english')
Set to 'simple', 'german', 'french', etc. for
non-English forums.
Required Database Indices:
CREATE INDEX idx_posts_message_fts ON mybb_posts
USING gin(to_tsvector('english', message));
CREATE INDEX idx_posts_subject_fts ON mybb_posts
USING gin(to_tsvector('english', subject));
CREATE INDEX idx_threads_subject_fts ON mybb_threads
USING gin(to_tsvector('english', subject));
User Input MySQL Boolean FT PgSQL tsquery
hello world | +hello +world | 'hello' & 'world'
hello or world | hello world | 'hello' | 'world'
hello and world | +hello +world | 'hello' & 'world'
not spam | -spam | !'spam'
hello -spam | +hello -spam | 'hello' & !'spam'
"exact phrase" | +"exact phrase" | ('exact' <-> 'phrase')
test* | +test* | 'test':*
"quick fox" and lazy | +"quick fox" +lazy | ('quick' <-> 'fox') & 'lazy'
cat or dog and fish | cat +dog +fish | 'cat' | 'dog' & 'fish'
Optionally I can port this to 1.9 -- but I'd rather first have people test it.
Patch: http://pastebin.irixnet.org/view.php?id=klTaH5Jl
Scope of Testing:
Tested on a clean MyBB 1.8.x install.
Might require more extensive teaching. I don't have any Postgres systems to test on in production.
Patch touches the following:
1. inc/functions_search.php - Two new functions appended
2. search.php - Dispatch logic updated (2 locations)
3. inc/db/PostgresPdoDbDriver.php - Five methods updated/added
New Setting (optional):
pgsql_fts_config - Text search configuration name (default: 'english')
Set to 'simple', 'german', 'french', etc. for
non-English forums.
Required Database Indices:
CREATE INDEX idx_posts_message_fts ON mybb_posts
USING gin(to_tsvector('english', message));
CREATE INDEX idx_posts_subject_fts ON mybb_posts
USING gin(to_tsvector('english', subject));
CREATE INDEX idx_threads_subject_fts ON mybb_threads
USING gin(to_tsvector('english', subject));
User Input MySQL Boolean FT PgSQL tsquery
hello world | +hello +world | 'hello' & 'world'
hello or world | hello world | 'hello' | 'world'
hello and world | +hello +world | 'hello' & 'world'
not spam | -spam | !'spam'
hello -spam | +hello -spam | 'hello' & !'spam'
"exact phrase" | +"exact phrase" | ('exact' <-> 'phrase')
test* | +test* | 'test':*
"quick fox" and lazy | +"quick fox" +lazy | ('quick' <-> 'fox') & 'lazy'
cat or dog and fish | cat +dog +fish | 'cat' | 'dog' & 'fish'
Optionally I can port this to 1.9 -- but I'd rather first have people test it.