Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't fail on pgvector upgrade error #231

Merged
merged 1 commit into from
Oct 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions pkg/store/postgres/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,12 @@ func enablePgVectorExtension(ctx context.Context, db *bun.DB) error {

// if this is an upgrade, we may need to update the pgvector extension
// this is a no-op if the extension is already up to date
// if this fails, Zep may not have rights to update extensions.
// this is not an issue if running on a managed service.
_, err = db.Exec("ALTER EXTENSION vector UPDATE")
if err != nil {
return fmt.Errorf("error updating pgvector extension: %w", err)
log.Errorf("error updating pgvector extension: %s. this may happen if running on a managed service without rights to update extensions.", err)
return nil
}

return nil
Expand Down Expand Up @@ -591,8 +594,7 @@ func NewPostgresConn(appState *models.AppState) (*bun.DB, error) {
// Enable pgvector extension
err := enablePgVectorExtension(ctx, db)
if err != nil {
log.Print("error enabling pgvector extension: ", err)
return nil, err
log.Errorf("error enabling pgvector extension: %s", err)
}

// IVFFLAT indexes are always available
Expand All @@ -601,7 +603,7 @@ func NewPostgresConn(appState *models.AppState) (*bun.DB, error) {
// Check if HNSW indexes are available
isHNSW, err := isHNSWAvailable(ctx, db)
if err != nil {
log.Print("error checking if hnsw indexes are available: ", err)
log.Infof("error checking if hnsw indexes are available: %s", err)
return nil, err
}
if isHNSW {
Expand Down
Loading