-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
Checked other resources
- I added a very descriptive title to this issue.
- I searched the LangChain.js documentation with the integrated search.
- I used the GitHub search to find a similar question and didn't find it.
- I am sure that this is a bug in LangChain.js rather than my code.
- The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
Example Code
Using PgVectorStore
with a database user that has only read/write permissions (no CREATE
or ALTER
) will result in a permissions error on initialization.
Error Message and Stack Trace (if applicable)
Message: permission denied for schema ai
Stacktrace:
at /app/node_modules/pg-pool/index.js:45:11
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async PGVectorStore.ensureTableInDatabase (/app/node_modules/@langchain/community/dist/vectorstores/pgvector.cjs:674:9)
at async PGVectorStore.initialize (/app/node_modules/@langchain/community/dist/vectorstores/pgvector.cjs:338:9)
Description
When initializing a PgVectorStore
, the library always attempts to create the table and enable the vector extension via the ensureTableInDatabase function. This causes issues in environments where the database credentials are intentionally limited (e.g., no CREATE
or ALTER
privileges).
This behavior makes it impossible to use PgVectorStore
securely in production/cloud environments that follow the principle of least privilege.
System Info
platform: Docker on Linux
Node Version: 18
yarn info langchain: