Skip to content

Conversation

@dylan-jung
Copy link

@dylan-jung dylan-jung commented Jan 10, 2026

Description

This pull request is an initial step toward addressing
#1934.

Currently, PgVectorStore assumes fixed column names (id, content, metadata, embedding), which makes it difficult to integrate with existing database schemas. This PR introduces a column-mapping approach that allows customizing column names, starting with the most critical paths.

What’s included in this PR

  1. Column name mapping for table creation and inserts

    • The table definition (CREATE TABLE) and insert/upsert logic now use configurable column names instead of hardcoded ones.
    • This establishes the core pattern for supporting custom schemas.
  2. Schema validation updated accordingly (todo)

    • PgVectorSchemaValidator has been updated to validate against the configured column names rather than fixed defaults.
  3. Integration tests added

    • New integration tests verify that:

      • A table is correctly created with custom column names.
      • Documents can be successfully inserted using the custom schema.
        ...(will be added after confirm)
    • Tests are implemented using the existing Testcontainers + ApplicationContextRunner style and confirm the behavior end-to-end.

What’s intentionally left out (for now)

This PR does not yet update all SQL paths (e.g. similarity search, delete, etc.).
Before expanding the change further, I wanted to confirm that this approach and API direction are acceptable to the maintainers.

If this direction looks good, I’m happy to follow up with additional PRs to:

  • Apply the same mapping to the remaining queries
  • Schema validation update
  • Refine tests and documentation as needed

Affected files

  • PgVectorStore
  • PgVectorSchemaValidator
  • New integration test(s) covering custom column names

Thank you for taking the time to review this contribution.
I’m looking forward to your feedback on the approach before continuing with the remaining changes.

Signed-off-by: Minhyeok Jung <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants