Postgres error message: "ERROR: relation 'pg_vector_index_stat' does not exist at character 45." #2212

Closed
opened 2026-02-05 05:43:05 +03:00 by OVERLORD · 3 comments
Owner

Originally created by @63936 on GitHub (Feb 21, 2024).

The bug

Upgrading Immich from 1.94.1 to 1.95.1, after starting Postgres, the following error message is displayed:

2024-02-21 11:31:53.987 UTC [43] ERROR:  relation "pg_vector_index_stat" does not exist at character 45
2024-02-21 11:31:53.987 UTC [43] STATEMENT:
                  SELECT idx_status
                  FROM pg_vector_index_stat
                  WHERE indexname = $1

However, the Immich server is able to run normally.

The OS that Immich Server is running on

Docker

Version of Immich Server

v1.95.1

Version of Immich Mobile App

1.95.0

Platform with the issue

  • Server
  • Web
  • Mobile

Reproduction steps

Translate into formal English:

  1. Upgrade Immich to 1.95.1, upgrade tensorchord/pgvecto-rs to v0.2.0;
  2. Enter the following commands in Postgres:
BEGIN;

CREATE SCHEMA IF NOT EXISTS vectors;
ALTER DATABASE immichdb SET search_path TO "$user", public, vectors;
SET search_path TO "$user", public, vectors;

UPDATE pg_catalog.pg_extension SET extversion = '0.1.11' WHERE extname = 'vectors';
UPDATE pg_catalog.pg_extension SET extrelocatable = true WHERE extname = 'vectors';
ALTER EXTENSION vectors SET SCHEMA vectors;
UPDATE pg_catalog.pg_extension SET extrelocatable = false WHERE extname = 'vectors';
ALTER EXTENSION vectors UPDATE TO '0.2.0';

SELECT pgvectors_upgrade();

COMMIT;
  1. Start the container.

Additional information

_No response_
Originally created by @63936 on GitHub (Feb 21, 2024). ### The bug Upgrading Immich from 1.94.1 to 1.95.1, after starting Postgres, the following error message is displayed: ``` 2024-02-21 11:31:53.987 UTC [43] ERROR: relation "pg_vector_index_stat" does not exist at character 45 2024-02-21 11:31:53.987 UTC [43] STATEMENT: SELECT idx_status FROM pg_vector_index_stat WHERE indexname = $1 ``` However, the Immich server is able to run normally. ### The OS that Immich Server is running on Docker ### Version of Immich Server v1.95.1 ### Version of Immich Mobile App 1.95.0 ### Platform with the issue - [x] Server - [ ] Web - [ ] Mobile ### Reproduction steps Translate into formal English: 1. Upgrade `Immich` to 1.95.1, upgrade `tensorchord/pgvecto-rs` to v0.2.0; 2. Enter the following commands in Postgres: ```bash BEGIN; CREATE SCHEMA IF NOT EXISTS vectors; ALTER DATABASE immichdb SET search_path TO "$user", public, vectors; SET search_path TO "$user", public, vectors; UPDATE pg_catalog.pg_extension SET extversion = '0.1.11' WHERE extname = 'vectors'; UPDATE pg_catalog.pg_extension SET extrelocatable = true WHERE extname = 'vectors'; ALTER EXTENSION vectors SET SCHEMA vectors; UPDATE pg_catalog.pg_extension SET extrelocatable = false WHERE extname = 'vectors'; ALTER EXTENSION vectors UPDATE TO '0.2.0'; SELECT pgvectors_upgrade(); COMMIT; ``` 3. Start the container. ### Additional information ``` _No response_ ```
Author
Owner

@VS-X commented on GitHub (Feb 21, 2024):

I just upgraded and had this error on repeat, but it was also paired with must be owner of database immich

postgres    | 2024-02-21 17:21:24.359 EET [129] ERROR:  relation "pg_vector_index_stat" does not exist at character 45
postgres    | 2024-02-21 17:21:24.359 EET [129] STATEMENT:
postgres    | 	          SELECT idx_status
postgres    | 	          FROM pg_vector_index_stat
postgres    | 	          WHERE indexname = $1
postgres    | 2024-02-21 17:21:24.375 EET [129] ERROR:  must be owner of database immich
postgres    | 2024-02-21 17:21:24.375 EET [129] STATEMENT:  ALTER DATABASE "immich" SET search_path TO "$user", public, vectors

So I ran this query on my Postgres db:

ALTER DATABASE immich OWNER TO immich

and after a few seconds both errors stopped coming.

Check if you have some other error around relation "pg_vector_index_stat" does not exist at character 45, that could be the main culprit

@VS-X commented on GitHub (Feb 21, 2024): I just upgraded and had this error on repeat, but it was also paired with `must be owner of database immich` ``` postgres | 2024-02-21 17:21:24.359 EET [129] ERROR: relation "pg_vector_index_stat" does not exist at character 45 postgres | 2024-02-21 17:21:24.359 EET [129] STATEMENT: postgres | SELECT idx_status postgres | FROM pg_vector_index_stat postgres | WHERE indexname = $1 postgres | 2024-02-21 17:21:24.375 EET [129] ERROR: must be owner of database immich postgres | 2024-02-21 17:21:24.375 EET [129] STATEMENT: ALTER DATABASE "immich" SET search_path TO "$user", public, vectors ``` So I ran this query on my Postgres db: ```sql ALTER DATABASE immich OWNER TO immich ``` and after a few seconds both errors stopped coming. Check if you have some other error around `relation "pg_vector_index_stat" does not exist at character 45`, that could be the main culprit
Author
Owner

@63936 commented on GitHub (Feb 22, 2024):

In the context of the PostgreSQL log, no hints related to other errors were found.

2024-02-22 10:41:06.090 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2024-02-22 10:41:06.090 UTC [1] LOG:  listening on IPv6 address "::", port 5432
2024-02-22 10:41:06.093 UTC [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-02-22 10:41:06.112 UTC [29] LOG:  database system was shut down at 2024-02-22 10:41:04 UTC
2024-02-22 10:41:06.135 UTC [1] LOG:  database system is ready to accept connections
2024-02-22 10:41:12.605 UTC [40] ERROR:  relation "pg_vector_index_stat" does not exist at character 45
2024-02-22 10:41:12.605 UTC [40] STATEMENT:
                  SELECT idx_status
                  FROM pg_vector_index_stat
                  WHERE indexname = $1
2024-02-22 10:41:12.608 UTC [40] ERROR:  relation "pg_vector_index_stat" does not exist at character 45
2024-02-22 10:41:12.608 UTC [40] STATEMENT:
                  SELECT idx_status
                  FROM pg_vector_index_stat
                  WHERE indexname = $1
2024-02-22 10:41:12.911 UTC [43] ERROR:  relation "pg_vector_index_stat" does not exist at character 45
2024-02-22 10:41:12.911 UTC [43] STATEMENT:
                  SELECT idx_status
                  FROM pg_vector_index_stat
                  WHERE indexname = $1
2024-02-22 10:41:12.914 UTC [43] ERROR:  relation "pg_vector_index_stat" does not exist at character 45
2024-02-22 10:41:12.914 UTC [43] STATEMENT:
                  SELECT idx_status
                  FROM pg_vector_index_stat
                  WHERE indexname = $1
2024-02-22 10:41:36.276 UTC [44] ERROR:  pgvecto.rs: The index is not existing in the background worker.
        ADVICE: Drop or rebuild the index.
2024-02-22 10:41:36.276 UTC [44] CONTEXT:  while vacuuming index "clip_index" of relation "public.smart_search"
        automatic vacuum of table "immichdb.public.smart_search"
@63936 commented on GitHub (Feb 22, 2024): In the context of the PostgreSQL log, no hints related to other errors were found. ``` 2024-02-22 10:41:06.090 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432 2024-02-22 10:41:06.090 UTC [1] LOG: listening on IPv6 address "::", port 5432 2024-02-22 10:41:06.093 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" 2024-02-22 10:41:06.112 UTC [29] LOG: database system was shut down at 2024-02-22 10:41:04 UTC 2024-02-22 10:41:06.135 UTC [1] LOG: database system is ready to accept connections 2024-02-22 10:41:12.605 UTC [40] ERROR: relation "pg_vector_index_stat" does not exist at character 45 2024-02-22 10:41:12.605 UTC [40] STATEMENT: SELECT idx_status FROM pg_vector_index_stat WHERE indexname = $1 2024-02-22 10:41:12.608 UTC [40] ERROR: relation "pg_vector_index_stat" does not exist at character 45 2024-02-22 10:41:12.608 UTC [40] STATEMENT: SELECT idx_status FROM pg_vector_index_stat WHERE indexname = $1 2024-02-22 10:41:12.911 UTC [43] ERROR: relation "pg_vector_index_stat" does not exist at character 45 2024-02-22 10:41:12.911 UTC [43] STATEMENT: SELECT idx_status FROM pg_vector_index_stat WHERE indexname = $1 2024-02-22 10:41:12.914 UTC [43] ERROR: relation "pg_vector_index_stat" does not exist at character 45 2024-02-22 10:41:12.914 UTC [43] STATEMENT: SELECT idx_status FROM pg_vector_index_stat WHERE indexname = $1 2024-02-22 10:41:36.276 UTC [44] ERROR: pgvecto.rs: The index is not existing in the background worker. ADVICE: Drop or rebuild the index. 2024-02-22 10:41:36.276 UTC [44] CONTEXT: while vacuuming index "clip_index" of relation "public.smart_search" automatic vacuum of table "immichdb.public.smart_search" ```
Author
Owner

@63936 commented on GitHub (Feb 23, 2024):

After changing the Immich database's user to postgres, there were no error messages at all.

@63936 commented on GitHub (Feb 23, 2024): After changing the Immich database's user to `postgres`, there were no error messages at all.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#2212