Skip to content

Index name case sensitivity issue when inserting record #285

@inkvizytor

Description

@inkvizytor

Bug Description

pg_textsearch extension fails to find BM25 indexes created with quoted identifiers due to case sensitivity mismatch. When creating an index with a quoted name like "IX_aaa_content", subsequent INSERT operations fail with a "index not found" error because the extension appears to search for the lowercase version of the index name.

Environment

  • PostgreSQL version: 18.3
  • pg_textsearch version: 0.6.0
  • Operating system: Debian 13.3

Steps to Reproduce

  1. Create a table with a text column
  2. Create a BM25 index with quoted identifier (uppercase)
  3. Insert a record into the table
CREATE TABLE aaa
(
    id      SERIAL PRIMARY KEY,
    content TEXT
);

CREATE INDEX "IX_aaa_content" ON aaa USING bm25(content) WITH (text_config='english');

INSERT INTO aaa (content) VALUES ('lorem ipsum');

Expected Behavior

The INSERT operation should succeed normally, with the BM25 index being updated properly.

Actual Behavior

The extension cannot locate the index despite it being created successfully. The issue appears to be case sensitivity - pg_textsearch likely searches for ix_aaa_content (lowercase) internally while the index exists as IX_aaa_content.

[42P01] ERROR: index "public.IX_aaa_content" not found

Additional Context

  • Works fine when using unquoted index names (lowercase by default)
  • Confirmed the index exists: SELECT * FROM pg_indexes WHERE indexname = 'IX_aaa_content'; returns the index
  • Issue specific to quoted identifiers with uppercase letters

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions