Skip to content

backend: add pg_bigm for CJK full text search - #82

Open
exoego wants to merge 1 commit into
electric-sql:REL_18_3-pglitefrom
exoego:exoego/pg_bigm
Open

backend: add pg_bigm for CJK full text search#82
exoego wants to merge 1 commit into
electric-sql:REL_18_3-pglitefrom
exoego:exoego/pg_bigm

Conversation

@exoego

@exoego exoego commented Aug 2, 2026

Copy link
Copy Markdown

Motivation

pg_bigm is a community extension widely adopted in Asian market. It indexes text as 2-grams instead of pg_trgm's 3-grams. That is what makes LIKE '%...%' searches usable on Asian language texts (Chinese, Japanese and Korean), where search terms are commonly one or two characters long.

Solution

Adds pg_big to pglite/other_extensions so it is built and packaged alongside the other third-party extensions.

Every other extension here includes PGXS unconditionally. pg_bigm gates it behind USE_PGXS and otherwise assumes it lives in the postgres tree as contrib/pg_bigm, which resolves contrib-global.mk to a path that does not exist from other_extensions.

Rather than patch the submodule, the flag is set for its build and packaging targets only:
all-pg_bigm-recurse pg_bigm.tar.gz: export USE_PGXS = 1

Happy to take a different approach here if you would rather not special-case it.

I will open a PR on https://github.com/electric-sql/pglite side if accepted.

Notes

  • No new dependencies in pglite/builder/Dockerfile. pg_bigm is two C files with no external libraries.
  • Builds clean against PG 18.3 with the pinned electricsql/pglite-builder:3.1.74-7.
  • Output is dist/extensions/other/pg_bigm.tar.gz, 5.6 KB.
  • pg_bigm is under the PostgreSQL License.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Add pg_bigm as a submodule under pglite/other_extensions and build it
alongside the other third-party extensions. pg_bigm provides full text
search based on 2-grams, which indexes CJK text effectively where the
3-gram based pg_trgm cannot.

Unlike every other extension here, pg_bigm's Makefile only includes PGXS
when USE_PGXS is set, and otherwise assumes it lives in the postgres tree
as contrib/pg_bigm. That path resolves contrib-global.mk to a location
that does not exist from other_extensions, so set the flag for its build
and packaging targets.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ff747da42f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

# behind USE_PGXS and otherwise assumes it sits in the postgres tree as
# contrib/pg_bigm, which resolves contrib-global.mk to a path that does not
# exist from here. Set the flag for its build and its packaging step only.
all-pg_bigm-recurse pg_bigm.tar.gz: export USE_PGXS = 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Export USE_PGXS for every pg_bigm recursive target

When make -C pglite/other_extensions clean, distclean, install, or another standard recursive target is run, $(recurse) still enters pg_bigm, but this target-specific export applies only to all and the packaging target. Those sub-makes therefore take pg_bigm's in-tree branch and try to include the nonexistent contrib/pg_bigm build files described immediately above, causing otherwise supported Makefile targets to fail. Apply the export to all pg_bigm recursive targets (or arrange for the flag to be set inside the submodule invocation generally).

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant