QueryFailedError: operator does not exist: vectors.vector <=> unknown #2204

Closed
opened 2026-02-05 05:40:10 +03:00 by OVERLORD · 17 comments
Owner

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

The bug

I have completed the upgrade to 1.95.1 though I know I kinda screwed up on the pgvectors upgrade so i'm not 100% certain its an immich issue.

Whenever I do a search right now, I'm getting a bunch of logs in the immich container.

immich-5d8546874f-c2bkx main [Nest] 7  - 02/21/2024, 7:57:45 AM   ERROR [QueryFailedError: operator does not exist: vectors.vector <=> unknown
immich-5d8546874f-c2bkx main     at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19)
immich-5d8546874f-c2bkx main     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
immich-5d8546874f-c2bkx main     at async SelectQueryBuilder.loadRawResults (/usr/src/app/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2192:25)
immich-5d8546874f-c2bkx main     at async SelectQueryBuilder.executeEntitiesAndRawResults (/usr/src/app/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2040:26)
immich-5d8546874f-c2bkx main     at async SelectQueryBuilder.getRawAndEntities (/usr/src/app/node_modules/typeorm/query-builder/SelectQueryBuilder.js:684:29)
immich-5d8546874f-c2bkx main     at async SelectQueryBuilder.getMany (/usr/src/app/node_modules/typeorm/query-builder/SelectQueryBuilder.js:750:25)
immich-5d8546874f-c2bkx main     at async paginatedBuilder (/usr/src/app/dist/infra/infra.utils.js:49:19)
immich-5d8546874f-c2bkx main     at async /usr/src/app/dist/infra/repositories/search.repository.js:74:23
immich-5d8546874f-c2bkx main     at async EntityManager.transaction (/usr/src/app/node_modules/typeorm/entity-manager/EntityManager.js:73:28)
immich-5d8546874f-c2bkx main     at async SearchRepository.searchSmart (/usr/src/app/dist/infra/repositories/search.repository.js:65:9)] Failed to search smart
immich-5d8546874f-c2bkx main [Nest] 7  - 02/21/2024, 7:57:45 AM   ERROR [QueryFailedError: operator does not exist: vectors.vector <=> unknown
immich-5d8546874f-c2bkx main     at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19)
immich-5d8546874f-c2bkx main     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
immich-5d8546874f-c2bkx main     at async SelectQueryBuilder.loadRawResults (/usr/src/app/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2192:25)
immich-5d8546874f-c2bkx main     at async SelectQueryBuilder.executeEntitiesAndRawResults (/usr/src/app/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2040:26)
immich-5d8546874f-c2bkx main     at async SelectQueryBuilder.getRawAndEntities (/usr/src/app/node_modules/typeorm/query-builder/SelectQueryBuilder.js:684:29)
immich-5d8546874f-c2bkx main     at async SelectQueryBuilder.getMany (/usr/src/app/node_modules/typeorm/query-builder/SelectQueryBuilder.js:750:25)
immich-5d8546874f-c2bkx main     at async paginatedBuilder (/usr/src/app/dist/infra/infra.utils.js:49:19)
immich-5d8546874f-c2bkx main     at async /usr/src/app/dist/infra/repositories/search.repository.js:74:23
immich-5d8546874f-c2bkx main     at async EntityManager.transaction (/usr/src/app/node_modules/typeorm/entity-manager/EntityManager.js:73:28)
immich-5d8546874f-c2bkx main     at async SearchRepository.searchSmart (/usr/src/app/dist/infra/repositories/search.repository.js:65:9)] QueryFailedError: operator does not exist: vectors.vector <=> unknown

The OS that Immich Server is running on

k3s, k8s 1.29.0 with debian nodes

Version of Immich Server

1.95.1

Version of Immich Mobile App

N/A

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "9"
  creationTimestamp: "2024-01-14T07:40:02Z"
  generation: 12
  labels:
    app.kubernetes.io/component: main
    app.kubernetes.io/instance: immich
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: immich
    argocd.argoproj.io/instance: immich
    helm.sh/chart: app-template-2.6.0
  name: immich
  namespace: immich
  resourceVersion: "24730841"
  uid: ee3791b5-2619-4ea1-b2b4-1ceac77c9c37
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 3
  selector:
    matchLabels:
      app.kubernetes.io/component: main
      app.kubernetes.io/instance: immich
      app.kubernetes.io/name: immich
  strategy:
    type: Recreate
  template:
    metadata:
      annotations:
        checksum/secrets: c4255ad46baaffbe8daad885946060135ca431eb09b66f2d7db8cb05fff06be5
      creationTimestamp: null
      labels:
        app.kubernetes.io/component: main
        app.kubernetes.io/instance: immich
        app.kubernetes.io/name: immich
    spec:
      automountServiceAccountToken: true
      containers:
      - args:
        - ./start-server.sh
        command:
        - /bin/sh
        env:
        - name: DB_DATABASE_NAME
          valueFrom:
            secretKeyRef:
              key: DB_DATABASE_NAME
              name: immich-secret
        - name: DB_HOSTNAME
          valueFrom:
            secretKeyRef:
              key: DB_HOSTNAME
              name: immich-secret
        - name: DB_PASSWORD
          valueFrom:
            secretKeyRef:
              key: DB_PASSWORD
              name: immich-secret
        - name: DB_URL
          valueFrom:
            secretKeyRef:
              key: POSTGRES_URL
              name: immich-immich-user
        - name: DB_USERNAME
          valueFrom:
            secretKeyRef:
              key: DB_USERNAME
              name: immich-secret
        - name: IMMICH_MACHINE_LEARNING_URL
          valueFrom:
            secretKeyRef:
              key: IMMICH_MACHINE_LEARNING_URL
              name: immich-secret
        - name: REDIS_HOSTNAME
          valueFrom:
            secretKeyRef:
              key: REDIS_HOSTNAME
              name: immich-secret
        - name: SERVER_PORT
          value: "3001"
        - name: TYPESENSE_API_KEY
          valueFrom:
            secretKeyRef:
              key: TYPESENSE_API_KEY
              name: immich-secret
        image: ghcr.io/immich-app/immich-server:v1.95.1
        imagePullPolicy: IfNotPresent
        livenessProbe:
          failureThreshold: 3
          periodSeconds: 10
          successThreshold: 1
          tcpSocket:
            port: 3001
          timeoutSeconds: 1
        name: main
        readinessProbe:
          failureThreshold: 3
          periodSeconds: 10
          successThreshold: 1
          tcpSocket:
            port: 3001
          timeoutSeconds: 1
        resources: {}
        startupProbe:
          failureThreshold: 30
          periodSeconds: 5
          successThreshold: 1
          tcpSocket:
            port: 3001
          timeoutSeconds: 1
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /usr/src/app/.reverse-geocoding-dump
          name: geocoding-dump
        - mountPath: /usr/src/app/upload
          name: library
        - mountPath: /usr/src/app/.transformers_cache
          name: transformers-cache
      dnsPolicy: ClusterFirst
      enableServiceLinks: true
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      serviceAccount: default
      serviceAccountName: default
      terminationGracePeriodSeconds: 30
      volumes:
      - emptyDir: {}
        name: geocoding-dump
      - name: library
        nfs:
          path: /volume1/Apps/immich
          server: 192.168.0.10
      - emptyDir: {}
        name: transformers-cache

Your .env content

N/A

Reproduction steps

1. Login to immich web
2. Search something (eg cars)
3. 
Error: 500 - 500
ie@https://immich.g4v.dev/_app/immutable/chunks/fetch-client.VozrW5mA.js:1:2905
ce@https://immich.g4v.dev/_app/immutable/chunks/fetch-client.VozrW5mA.js:1:2829


### Additional information

_No response_
Originally created by @halkeye on GitHub (Feb 21, 2024). ### The bug I have completed the upgrade to 1.95.1 though I know I kinda screwed up on the pgvectors upgrade so i'm not 100% certain its an immich issue. Whenever I do a search right now, I'm getting a bunch of logs in the immich container. ``` immich-5d8546874f-c2bkx main [Nest] 7 - 02/21/2024, 7:57:45 AM ERROR [QueryFailedError: operator does not exist: vectors.vector <=> unknown immich-5d8546874f-c2bkx main at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19) immich-5d8546874f-c2bkx main at process.processTicksAndRejections (node:internal/process/task_queues:95:5) immich-5d8546874f-c2bkx main at async SelectQueryBuilder.loadRawResults (/usr/src/app/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2192:25) immich-5d8546874f-c2bkx main at async SelectQueryBuilder.executeEntitiesAndRawResults (/usr/src/app/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2040:26) immich-5d8546874f-c2bkx main at async SelectQueryBuilder.getRawAndEntities (/usr/src/app/node_modules/typeorm/query-builder/SelectQueryBuilder.js:684:29) immich-5d8546874f-c2bkx main at async SelectQueryBuilder.getMany (/usr/src/app/node_modules/typeorm/query-builder/SelectQueryBuilder.js:750:25) immich-5d8546874f-c2bkx main at async paginatedBuilder (/usr/src/app/dist/infra/infra.utils.js:49:19) immich-5d8546874f-c2bkx main at async /usr/src/app/dist/infra/repositories/search.repository.js:74:23 immich-5d8546874f-c2bkx main at async EntityManager.transaction (/usr/src/app/node_modules/typeorm/entity-manager/EntityManager.js:73:28) immich-5d8546874f-c2bkx main at async SearchRepository.searchSmart (/usr/src/app/dist/infra/repositories/search.repository.js:65:9)] Failed to search smart immich-5d8546874f-c2bkx main [Nest] 7 - 02/21/2024, 7:57:45 AM ERROR [QueryFailedError: operator does not exist: vectors.vector <=> unknown immich-5d8546874f-c2bkx main at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19) immich-5d8546874f-c2bkx main at process.processTicksAndRejections (node:internal/process/task_queues:95:5) immich-5d8546874f-c2bkx main at async SelectQueryBuilder.loadRawResults (/usr/src/app/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2192:25) immich-5d8546874f-c2bkx main at async SelectQueryBuilder.executeEntitiesAndRawResults (/usr/src/app/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2040:26) immich-5d8546874f-c2bkx main at async SelectQueryBuilder.getRawAndEntities (/usr/src/app/node_modules/typeorm/query-builder/SelectQueryBuilder.js:684:29) immich-5d8546874f-c2bkx main at async SelectQueryBuilder.getMany (/usr/src/app/node_modules/typeorm/query-builder/SelectQueryBuilder.js:750:25) immich-5d8546874f-c2bkx main at async paginatedBuilder (/usr/src/app/dist/infra/infra.utils.js:49:19) immich-5d8546874f-c2bkx main at async /usr/src/app/dist/infra/repositories/search.repository.js:74:23 immich-5d8546874f-c2bkx main at async EntityManager.transaction (/usr/src/app/node_modules/typeorm/entity-manager/EntityManager.js:73:28) immich-5d8546874f-c2bkx main at async SearchRepository.searchSmart (/usr/src/app/dist/infra/repositories/search.repository.js:65:9)] QueryFailedError: operator does not exist: vectors.vector <=> unknown ``` ### The OS that Immich Server is running on k3s, k8s 1.29.0 with debian nodes ### Version of Immich Server 1.95.1 ### Version of Immich Mobile App N/A ### Platform with the issue - [X] Server - [X] Web - [ ] Mobile ### Your docker-compose.yml content ```YAML apiVersion: apps/v1 kind: Deployment metadata: annotations: deployment.kubernetes.io/revision: "9" creationTimestamp: "2024-01-14T07:40:02Z" generation: 12 labels: app.kubernetes.io/component: main app.kubernetes.io/instance: immich app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: immich argocd.argoproj.io/instance: immich helm.sh/chart: app-template-2.6.0 name: immich namespace: immich resourceVersion: "24730841" uid: ee3791b5-2619-4ea1-b2b4-1ceac77c9c37 spec: progressDeadlineSeconds: 600 replicas: 1 revisionHistoryLimit: 3 selector: matchLabels: app.kubernetes.io/component: main app.kubernetes.io/instance: immich app.kubernetes.io/name: immich strategy: type: Recreate template: metadata: annotations: checksum/secrets: c4255ad46baaffbe8daad885946060135ca431eb09b66f2d7db8cb05fff06be5 creationTimestamp: null labels: app.kubernetes.io/component: main app.kubernetes.io/instance: immich app.kubernetes.io/name: immich spec: automountServiceAccountToken: true containers: - args: - ./start-server.sh command: - /bin/sh env: - name: DB_DATABASE_NAME valueFrom: secretKeyRef: key: DB_DATABASE_NAME name: immich-secret - name: DB_HOSTNAME valueFrom: secretKeyRef: key: DB_HOSTNAME name: immich-secret - name: DB_PASSWORD valueFrom: secretKeyRef: key: DB_PASSWORD name: immich-secret - name: DB_URL valueFrom: secretKeyRef: key: POSTGRES_URL name: immich-immich-user - name: DB_USERNAME valueFrom: secretKeyRef: key: DB_USERNAME name: immich-secret - name: IMMICH_MACHINE_LEARNING_URL valueFrom: secretKeyRef: key: IMMICH_MACHINE_LEARNING_URL name: immich-secret - name: REDIS_HOSTNAME valueFrom: secretKeyRef: key: REDIS_HOSTNAME name: immich-secret - name: SERVER_PORT value: "3001" - name: TYPESENSE_API_KEY valueFrom: secretKeyRef: key: TYPESENSE_API_KEY name: immich-secret image: ghcr.io/immich-app/immich-server:v1.95.1 imagePullPolicy: IfNotPresent livenessProbe: failureThreshold: 3 periodSeconds: 10 successThreshold: 1 tcpSocket: port: 3001 timeoutSeconds: 1 name: main readinessProbe: failureThreshold: 3 periodSeconds: 10 successThreshold: 1 tcpSocket: port: 3001 timeoutSeconds: 1 resources: {} startupProbe: failureThreshold: 30 periodSeconds: 5 successThreshold: 1 tcpSocket: port: 3001 timeoutSeconds: 1 terminationMessagePath: /dev/termination-log terminationMessagePolicy: File volumeMounts: - mountPath: /usr/src/app/.reverse-geocoding-dump name: geocoding-dump - mountPath: /usr/src/app/upload name: library - mountPath: /usr/src/app/.transformers_cache name: transformers-cache dnsPolicy: ClusterFirst enableServiceLinks: true restartPolicy: Always schedulerName: default-scheduler securityContext: {} serviceAccount: default serviceAccountName: default terminationGracePeriodSeconds: 30 volumes: - emptyDir: {} name: geocoding-dump - name: library nfs: path: /volume1/Apps/immich server: 192.168.0.10 - emptyDir: {} name: transformers-cache ``` ### Your .env content ```Shell N/A ``` ### Reproduction steps ```bash 1. Login to immich web 2. Search something (eg cars) 3. Error: 500 - 500 ie@https://immich.g4v.dev/_app/immutable/chunks/fetch-client.VozrW5mA.js:1:2905 ce@https://immich.g4v.dev/_app/immutable/chunks/fetch-client.VozrW5mA.js:1:2829 ``` ``` ### Additional information _No response_
Author
Owner

@halkeye commented on GitHub (Feb 21, 2024):

does https://github.com/immich-app/immich/blob/main/server/src/infra/repositories/search.repository.ts#L100-L103 need a cast? or maybe asVector should force a cast? looking at https://github.com/tensorchord/pgvecto.rs/issues/108

@halkeye commented on GitHub (Feb 21, 2024): does https://github.com/immich-app/immich/blob/main/server/src/infra/repositories/search.repository.ts#L100-L103 need a cast? or maybe asVector should force a cast? looking at https://github.com/tensorchord/pgvecto.rs/issues/108
Author
Owner

@mertalev commented on GitHub (Feb 21, 2024):

You're not the first person I've seen with this issue. It's strange since this doesn't normally need a cast. The below commands seem to fix it.

DROP INDEX IF EXISTS clip_index;
ALTER TABLE smart_search ALTER COLUMN embedding SET DATA TYPE real[];
ALTER TABLE smart_search ALTER COLUMN embedding SET DATA TYPE vector(512); -- change the number here if using a non-default clip model
SET vectors.pgvector_compatibility=on;
CREATE INDEX IF NOT EXISTS clip_index ON smart_search
    USING hnsw (embedding vector_cosine_ops)
    WITH (ef_construction = 300, m = 16);

DROP INDEX IF EXISTS face_index;
ALTER TABLE asset_faces ALTER COLUMN embedding SET DATA TYPE real[];
ALTER TABLE asset_faces ALTER COLUMN embedding SET DATA TYPE vector(512);
CREATE INDEX IF NOT EXISTS face_index ON asset_faces
    USING hnsw (embedding vector_cosine_ops)
    WITH (ef_construction = 300, m = 16);
@mertalev commented on GitHub (Feb 21, 2024): You're not the first person I've seen with this issue. It's strange since this doesn't normally need a cast. The below commands seem to fix it. ```sql DROP INDEX IF EXISTS clip_index; ALTER TABLE smart_search ALTER COLUMN embedding SET DATA TYPE real[]; ALTER TABLE smart_search ALTER COLUMN embedding SET DATA TYPE vector(512); -- change the number here if using a non-default clip model SET vectors.pgvector_compatibility=on; CREATE INDEX IF NOT EXISTS clip_index ON smart_search USING hnsw (embedding vector_cosine_ops) WITH (ef_construction = 300, m = 16); DROP INDEX IF EXISTS face_index; ALTER TABLE asset_faces ALTER COLUMN embedding SET DATA TYPE real[]; ALTER TABLE asset_faces ALTER COLUMN embedding SET DATA TYPE vector(512); CREATE INDEX IF NOT EXISTS face_index ON asset_faces USING hnsw (embedding vector_cosine_ops) WITH (ef_construction = 300, m = 16); ```
Author
Owner

@ser commented on GitHub (Feb 21, 2024):

immich=# DROP INDEX IF EXISTS face_index;
NOTICE:  index "face_index" does not exist, skipping
DROP INDEX
immich=# ALTER TABLE asset_faces ALTER COLUMN embedding SET DATA TYPE real[];
ERROR:  relation "asset_faces" does not exist

in the same time i have upgraded PG from 14 to 16, vectors.rs from 0.1.11 to 0.20 and immich to 1.95.1 - it seems it was too much to handle :) after upgrade everything works but immich though

@ser commented on GitHub (Feb 21, 2024): ``` immich=# DROP INDEX IF EXISTS face_index; NOTICE: index "face_index" does not exist, skipping DROP INDEX immich=# ALTER TABLE asset_faces ALTER COLUMN embedding SET DATA TYPE real[]; ERROR: relation "asset_faces" does not exist ``` in the same time i have upgraded PG from 14 to 16, vectors.rs from 0.1.11 to 0.20 and immich to 1.95.1 - it seems it was too much to handle :) after upgrade everything works but immich though
Author
Owner

@ser commented on GitHub (Feb 21, 2024):

OK I have recreated these relations looking at the immich source code, and it fixed "operator" but now new problem arrived:

QueryFailedError: column AssetEntity__AssetEntity_faces.id does not exist                                                                                                                           

Browsing source code doesn't give me any hints how this column should be created :(

@ser commented on GitHub (Feb 21, 2024): OK I have recreated these relations looking at the immich source code, and it fixed "operator" but now new problem arrived: ``` QueryFailedError: column AssetEntity__AssetEntity_faces.id does not exist ``` Browsing source code doesn't give me any hints how this column should be created :(
Author
Owner

@mertalev commented on GitHub (Feb 21, 2024):

That error sounds like you dropped the asset_faces table. Is that right?

@mertalev commented on GitHub (Feb 21, 2024): That error sounds like you dropped the `asset_faces` table. Is that right?
Author
Owner

@ser commented on GitHub (Feb 21, 2024):

i did not drop anything, i did full dump of the database, but these vector extension thingies are above my understanding. so how can i recreate properly the asset_faces? I did it following 173b47033a/server/src/infra/migrations/1684255168091-AddFacialTables.ts and 173b47033a/server/src/infra/migrations/1700713871511-UsePgVectors.ts

@ser commented on GitHub (Feb 21, 2024): i did not drop anything, i did full dump of the database, but these vector extension thingies are above my understanding. so how can i recreate properly the `asset_faces`? I did it following https://github.com/immich-app/immich/blob/173b47033a8d5910c2d46e8ed4252eaf206d27ec/server/src/infra/migrations/1684255168091-AddFacialTables.ts and https://github.com/immich-app/immich/blob/173b47033a8d5910c2d46e8ed4252eaf206d27ec/server/src/infra/migrations/1700713871511-UsePgVectors.ts
Author
Owner

@mmomjian commented on GitHub (Feb 21, 2024):

If you followed those instructions, specifically the first link, I think you did destroy asset_faces. What exact SQL commands did you run?

Maybe you can try restoring your database dump and following the instructions here

@mmomjian commented on GitHub (Feb 21, 2024): If you followed those instructions, specifically the first link, I think you did destroy asset_faces. What exact SQL commands did you run? Maybe you can try restoring your database dump and following the instructions [here](https://github.com/immich-app/immich/discussions/7252#discussioncomment-8534336)
Author
Owner

@ser commented on GitHub (Feb 21, 2024):

OK, I will try! I must say that learning immich development multiplied by vecto.rs development is making things really complex as both projects are on the full ahead mode and do not count victims

@ser commented on GitHub (Feb 21, 2024): OK, I will try! I must say that learning immich development multiplied by vecto.rs development is making things really complex as both projects are on the `full ahead` mode and do not count victims
Author
Owner

@mmomjian commented on GitHub (Feb 21, 2024):

Yes, to an extent you are correct. In their defense, that is why Immich very clearly says: ⚠️ The project is under very active development. ⚠️ Expect bugs and breaking changes.

:)

But, the community is very happy to help. Also, 0.2.0 was a major change for pgvecto.rs, and it seems that they setup a lot of infrastructure now to make future updates much easier.

@mmomjian commented on GitHub (Feb 21, 2024): Yes, to an extent you are correct. In their defense, that is why Immich very clearly says: `⚠️ The project is under very active development. ⚠️ Expect bugs and breaking changes.` :) But, the community is very happy to help. Also, 0.2.0 was a major change for pgvecto.rs, and it seems that they setup a lot of infrastructure now to make future updates much easier.
Author
Owner

@halkeye commented on GitHub (Feb 24, 2024):

Sorry, finally had a minute to come back to this

I can somewhat understand the first two statements, which essentially reset the column type.

SET vectors.pgvector_compatibility=on;

I thought the app was built with vecto.rs in mind, so why the compatibilty?

CREATE INDEX IF NOT EXISTS clip_index ON smart_search
    USING hnsw (embedding vector_cosine_ops)
    WITH (ef_construction = 300, m = 16);

ERROR: access method "hnsw" does not exist

That might explain some of the issues.

immich=# select extname, extversion from pg_extension where extname IN ('vectors', 'vector');
 extname | extversion
---------+------------
 vectors | 0.2.0
(1 row)

I tried getting the sql from the code, and running it normally and it seems to work fine. I'm more of a mysql expert not a postgres expert, so I'm not sure, but could it be something about how it connects that it doens't know a string is a vector?

SELECT "asset"."id" AS "asset_id", "asset"."deviceAssetId" AS "asset_deviceAssetId", "asset"."ownerId" AS "asset_ownerId", "asset"."libraryId" AS "asset_libraryId", "asset"."deviceId" AS "asset_deviceId", "asset"."type" AS "asset_type", "asset"."originalPath" AS "asset_originalPath", "asset"."resizePath" AS "asset_resizePath", "asset"."webpPath" AS "asset_webpPath", "asset"."thumbhash" AS "asset_thumbhash", "asset"."encodedVideoPath" AS "asset_encodedVideoPath", "asset"."createdAt" AS "asset_createdAt", "asset"."updatedAt" AS "asset_updatedAt", "asset"."deletedAt" AS "asset_deletedAt", "asset"."fileCreatedAt" AS "asset_fileCreatedAt", "asset"."localDateTime" AS "asset_localDateTime", "asset"."fileModifiedAt" AS "asset_fileModifiedAt", "asset"."isFavorite" AS "asset_isFavorite", "asset"."isArchived" AS "asset_isArchived", "asset"."isExternal" AS "asset_isExternal", "asset"."isReadOnly" AS "asset_isReadOnly", "asset"."isOffline" AS "asset_isOffline", "asset"."checksum" AS "asset_checksum", "asset"."duration" AS "asset_duration", "asset"."isVisible" AS "asset_isVisible", "asset"."livePhotoVideoId" AS "asset_livePhotoVideoId", "asset"."originalFileName" AS "asset_originalFileName", "asset"."sidecarPath" AS "asset_sidecarPath", "asset"."stackId" AS "asset_stackId", "exifInfo"."assetId" AS "exifInfo_assetId", "exifInfo"."description" AS "exifInfo_description", "exifInfo"."exifImageWidth" AS "exifInfo_exifImageWidth", "exifInfo"."exifImageHeight" AS "exifInfo_exifImageHeight", "exifInfo"."fileSizeInByte" AS "exifInfo_fileSizeInByte", "exifInfo"."orientation" AS "exifInfo_orientation", "exifInfo"."dateTimeOriginal" AS "exifInfo_dateTimeOriginal", "exifInfo"."modifyDate" AS "exifInfo_modifyDate", "exifInfo"."timeZone" AS "exifInfo_timeZone", "exifInfo"."latitude" AS "exifInfo_latitude", "exifInfo"."longitude" AS "exifInfo_longitude", "exifInfo"."projectionType" AS "exifInfo_projectionType", "exifInfo"."city" AS "exifInfo_city", "exifInfo"."livePhotoCID" AS "exifInfo_livePhotoCID", "exifInfo"."autoStackId" AS "exifInfo_autoStackId", "exifInfo"."state" AS "exifInfo_state", "exifInfo"."country" AS "exifInfo_country", "exifInfo"."make" AS "exifInfo_make", "exifInfo"."model" AS "exifInfo_model", "exifInfo"."lensModel" AS "exifInfo_lensModel", "exifInfo"."fNumber" AS "exifInfo_fNumber", "exifInfo"."focalLength" AS "exifInfo_focalLength", "exifInfo"."iso" AS "exifInfo_iso", "exifInfo"."exposureTime" AS "exifInfo_exposureTime", "exifInfo"."profileDescription" AS "exifInfo_profileDescription", "exifInfo"."colorspace" AS "exifInfo_colorspace", "exifInfo"."bitsPerSample" AS "exifInfo_bitsPerSample", "exifInfo"."fps" AS "exifInfo_fps" FROM "assets" "asset" LEFT JOIN "exif" "exifInfo" ON "exifInfo"."assetId"="asset"."id"  INNER JOIN "smart_search" "search" ON "search"."assetId"="asset"."id" ORDER BY "search"."embedding" <=> '[0.0060486966,0.009768874,0.0035288853,0.005233917,0.0074609593,0.01844652,0.00011674518,-0.03849832,-0.0036035283,0.027404023,-0.0065704654,-0.030967163,0.013169136,-0.018281454,0.042642,-0.0059785442,0.056627057,0.009240432,-0.028199334,-0.009582041,0.038022026,0.03952954,0.01907102,-0.0019512073,-0.034832682,0.025705077,0.005842874,0.019855442,0.0063715945,0.020725567,-0.003426579,-0.027743163,0.0144901695,0.0001787382,-0.02530583,-0.01022834,-0.0039253817,0.029628351,0.023176137,0.013446532,0.010396614,0.029048542,-0.011058426,0.008122031,-0.0018129413,0.023602467,0.018738175,-0.011839007,-0.0007485338,-0.017155482,-0.012258358,0.0039221384,0.016180573,-0.0340307,-0.036527418,-0.051814668,0.020003285,-0.009113398,-0.040786985,-0.031386737,0.015631745,-0.030029086,-0.0015933489,0.022582429,-0.008478272,0.013005339,0.018502086,0.0066689844,-0.003973617,-0.02011316,-0.016115801,-0.014530212,-0.007849917,0.0146687515,0.005739634,0.000050622126,0.011369415,0.026480028,-0.00033202698,-0.018550465,-0.03086732,-0.0029936526,-0.0133567685,0.021883883,0.0219055,-0.012134877,0.01543034,-0.05686483,0.008726991,-0.021626728,0.03603936,-0.059439253,-0.13235831,0.04152966,-0.01356402,0.029336639,-0.006881329,0.013087213,0.023382805,-0.016738115,-0.0054492303,-0.015071227,0.036480732,0.0054372507,-0.041203924,0.00020370685,-0.02306033,-0.00926911,-0.0145974215,-0.013066627,-0.01698856,-0.009841226,-0.023182422,-0.0090002045,-0.0051838844,-0.019607283,0.022583287,0.05120336,-0.029894052,-0.0017047384,0.05515681,-0.038759004,-0.026863107,-0.0034450917,-0.022791661,-0.023773093,-0.039815653,-0.031755276,0.0059102387,0.02722104,0.024710301,-0.008639328,-0.017580861,0.58795387,0.024504896,-0.008522231,-0.027976135,-0.034341495,0.019284328,-0.024976091,0.00021876903,-0.019164013,-0.03384928,0.02651799,-0.03413976,-0.012082252,0.012997715,-0.010560675,-0.0008881843,-0.01964561,0.020191023,-0.0032044328,0.011662379,0.027559685,-0.028673887,0.031407002,0.016164862,-0.03869483,-0.029849932,0.004897442,-0.020728366,0.03650994,-0.013739642,-0.010376257,-0.012629424,0.017973052,0.04360613,-0.049027562,0.0050991224,0.0009483153,-0.011180188,0.0147739835,-0.015625348,0.02082274,-0.06144755,0.016449954,-0.012884111,-0.003031963,0.033748847,-0.0010292723,0.0091982735,0.04087524,-0.04438955,-0.015863378,-0.016375398,-0.0027621628,0.0019388932,-0.028666744,0.0045211967,-0.008117966,-0.010300809,0.0068415673,0.0067872764,-0.02498338,-0.036147058,0.016529895,-0.025261633,-0.0070571764,-0.0019933924,-0.022864865,-0.026078282,-0.009343328,0.03493448,0.0106634665,-0.0019994827,0.02587734,-0.017327242,-0.0434487,0.0015870093,0.030069752,0.09477261,0.038690012,0.034843326,0.0060176644,0.019751232,0.008616583,0.020846847,-0.009917328,-0.0037736418,-0.024252731,-0.011477916,-0.040869854,-0.017484691,0.011577995,0.0037214572,-0.013214444,0.0040351334,-0.009090913,-0.015102522,0.0019098566,-0.021496322,0.021401547,0.014246689,0.013708214,0.026731633,0.03082906,-0.0007700539,-0.018616553,-0.029063804,-0.027679535,-0.017108824,0.02045021,0.026145881,-0.020869235,-0.013704682,-0.0046016253,0.0129401,-0.0065996014,-0.009390609,-0.010592297,-0.017636357,0.026054125,0.039032463,0.05956301,-0.022025356,-0.0248067,-0.003955503,0.0026233185,0.008638101,0.018238895,-0.017039036,0.004758067,0.018721132,-0.0034013917,0.01584975,-0.000010444529,0.019118976,-0.023286914,0.008942267,-0.014099941,-0.009087798,0.0037993565,0.010989498,-0.0042618727,-0.005088537,-0.008143627,0.007928727,-0.002029066,0.0067183045,-0.011420877,0.026516901,-0.029993529,0.005567179,0.0055272058,-0.014271571,-0.002010232,0.020727968,0.030849114,0.053471982,0.0070274724,0.018872503,-0.028397525,0.019526534,0.029088335,-0.037207697,0.02310011,-0.071238495,-0.017594337,0.004825751,-0.0024704107,0.020892806,-0.02935248,-0.011031174,0.0039876355,-0.0018368444,-0.023114618,-0.0037236218,0.0010983949,-0.011286987,0.016744306,0.01464577,0.022070931,0.5881262,0.02016441,-0.0050207917,0.021085707,0.0012998604,0.018639868,0.059667125,-0.0029514222,0.005996795,0.047070507,0.017189069,-0.0020746794,-0.0069092107,-0.016612004,0.013541245,0.019972721,-0.014009221,-0.15313473,0.029074652,0.028020965,-0.008563584,0.018442623,0.02329679,-0.018890375,-0.01607894,-0.0031452514,-0.014648271,0.0073598614,0.00042422133,0.0041512027,0.00932262,-0.026791893,-0.0042145876,0.014047548,-0.004795796,0.026279105,0.016782261,-0.016157184,-0.032282304,0.018406125,0.021892892,0.009781943,-0.037233133,0.012999317,0.0036291992,0.01562886,0.017304696,0.024041586,0.004308645,-0.02055302,-0.0069906553,-0.014221454,-0.014898157,-0.026927464,0.0009418807,0.0065758624,0.004423506,0.00835459,-0.0019481694,0.013509642,-0.019874744,0.02755871,-0.024873462,0.009487407,-0.0012299505,-0.011615028,-0.022319999,0.015174511,-0.023295013,0.042713948,0.019479584,0.0038494763,0.026819225,0.008512796,0.0037278982,-0.011690089,-0.018357502,-0.0038855043,-0.041052457,0.04447373,-0.01395221,-0.02275553,0.01135418,0.034285452,-0.0075344867,-0.000068669906,-0.006622553,0.041763883,0.026437055,0.010137292,-0.044784088,0.022310328,-0.044167347,0.01720784,0.014068358,0.016606389,-0.0002399555,-0.0014027195,-0.021328364,0.016257718,-0.013554196,0.009925168,0.0068834126,-0.012612237,-0.0033075514,-0.019634109,-0.023425866,-0.008531506,-0.015062512,-0.017552078,0.009368133,-0.044785965,-0.010361197,-0.020905435,-0.018630436,0.0052409875,-0.0018509565,0.026241029,-0.019112512,0.002418993,-0.021497626,-0.02038699,0.0032017485,-0.023622047,-0.017058102,0.026453113,-0.012737799,0.024695754,-0.024052039,-0.0059554623,-0.0058942297,-0.043091197,-0.019553937,-0.0029777375,-0.02578314,-0.04183964,-0.02445611,0.020003537,0.011399134,0.016810508,-0.024666883,0.021959038,-0.018513309,-0.025984148,0.025741195,0.031433307,-0.005072043,-0.015799517,0.002063807,0.025492117,0.012155052,0.01693681,0.015494632,0.0067701573,0.02771366,-0.034591164,-0.016862094,0.013201297,-0.022639832,-0.04390628,0.0143880425,-0.048212104,0.024455583,0.019158658,0.00058166526,0.045549355,0.022434525,0.049816687,0.017570727,-0.087529816,0.008593835,-0.019805877,0.020331787,-0.00499048,-0.0051258733,0.0017428688,-0.015953146,-0.005186244,-0.00797339,0.008708625,-0.02239624,0.101917505,0.0073612295,-0.015816536,0.008870697,0.0116160875,-0.018606981,0.027977573,-0.0059686736,0.033387125,-0.0029925585,0.012760448,-0.02131721,-0.007935456,-0.015180696,-0.007833633,-0.008752497,-0.022417756,-0.024780653,0.010383246]' ASC;
@halkeye commented on GitHub (Feb 24, 2024): Sorry, finally had a minute to come back to this I can somewhat understand the first two statements, which essentially reset the column type. > ```sql > SET vectors.pgvector_compatibility=on; > ``` I thought the app was built with vecto.rs in mind, so why the compatibilty? > ```sql > CREATE INDEX IF NOT EXISTS clip_index ON smart_search > USING hnsw (embedding vector_cosine_ops) > WITH (ef_construction = 300, m = 16); > ``` ERROR: access method "hnsw" does not exist That might explain some of the issues. ``` immich=# select extname, extversion from pg_extension where extname IN ('vectors', 'vector'); extname | extversion ---------+------------ vectors | 0.2.0 (1 row) ``` I tried getting the sql from the code, and running it normally and it seems to work fine. I'm more of a mysql expert not a postgres expert, so I'm not sure, but could it be something about how it connects that it doens't know a string is a vector? ``` SELECT "asset"."id" AS "asset_id", "asset"."deviceAssetId" AS "asset_deviceAssetId", "asset"."ownerId" AS "asset_ownerId", "asset"."libraryId" AS "asset_libraryId", "asset"."deviceId" AS "asset_deviceId", "asset"."type" AS "asset_type", "asset"."originalPath" AS "asset_originalPath", "asset"."resizePath" AS "asset_resizePath", "asset"."webpPath" AS "asset_webpPath", "asset"."thumbhash" AS "asset_thumbhash", "asset"."encodedVideoPath" AS "asset_encodedVideoPath", "asset"."createdAt" AS "asset_createdAt", "asset"."updatedAt" AS "asset_updatedAt", "asset"."deletedAt" AS "asset_deletedAt", "asset"."fileCreatedAt" AS "asset_fileCreatedAt", "asset"."localDateTime" AS "asset_localDateTime", "asset"."fileModifiedAt" AS "asset_fileModifiedAt", "asset"."isFavorite" AS "asset_isFavorite", "asset"."isArchived" AS "asset_isArchived", "asset"."isExternal" AS "asset_isExternal", "asset"."isReadOnly" AS "asset_isReadOnly", "asset"."isOffline" AS "asset_isOffline", "asset"."checksum" AS "asset_checksum", "asset"."duration" AS "asset_duration", "asset"."isVisible" AS "asset_isVisible", "asset"."livePhotoVideoId" AS "asset_livePhotoVideoId", "asset"."originalFileName" AS "asset_originalFileName", "asset"."sidecarPath" AS "asset_sidecarPath", "asset"."stackId" AS "asset_stackId", "exifInfo"."assetId" AS "exifInfo_assetId", "exifInfo"."description" AS "exifInfo_description", "exifInfo"."exifImageWidth" AS "exifInfo_exifImageWidth", "exifInfo"."exifImageHeight" AS "exifInfo_exifImageHeight", "exifInfo"."fileSizeInByte" AS "exifInfo_fileSizeInByte", "exifInfo"."orientation" AS "exifInfo_orientation", "exifInfo"."dateTimeOriginal" AS "exifInfo_dateTimeOriginal", "exifInfo"."modifyDate" AS "exifInfo_modifyDate", "exifInfo"."timeZone" AS "exifInfo_timeZone", "exifInfo"."latitude" AS "exifInfo_latitude", "exifInfo"."longitude" AS "exifInfo_longitude", "exifInfo"."projectionType" AS "exifInfo_projectionType", "exifInfo"."city" AS "exifInfo_city", "exifInfo"."livePhotoCID" AS "exifInfo_livePhotoCID", "exifInfo"."autoStackId" AS "exifInfo_autoStackId", "exifInfo"."state" AS "exifInfo_state", "exifInfo"."country" AS "exifInfo_country", "exifInfo"."make" AS "exifInfo_make", "exifInfo"."model" AS "exifInfo_model", "exifInfo"."lensModel" AS "exifInfo_lensModel", "exifInfo"."fNumber" AS "exifInfo_fNumber", "exifInfo"."focalLength" AS "exifInfo_focalLength", "exifInfo"."iso" AS "exifInfo_iso", "exifInfo"."exposureTime" AS "exifInfo_exposureTime", "exifInfo"."profileDescription" AS "exifInfo_profileDescription", "exifInfo"."colorspace" AS "exifInfo_colorspace", "exifInfo"."bitsPerSample" AS "exifInfo_bitsPerSample", "exifInfo"."fps" AS "exifInfo_fps" FROM "assets" "asset" LEFT JOIN "exif" "exifInfo" ON "exifInfo"."assetId"="asset"."id" INNER JOIN "smart_search" "search" ON "search"."assetId"="asset"."id" ORDER BY "search"."embedding" <=> '[0.0060486966,0.009768874,0.0035288853,0.005233917,0.0074609593,0.01844652,0.00011674518,-0.03849832,-0.0036035283,0.027404023,-0.0065704654,-0.030967163,0.013169136,-0.018281454,0.042642,-0.0059785442,0.056627057,0.009240432,-0.028199334,-0.009582041,0.038022026,0.03952954,0.01907102,-0.0019512073,-0.034832682,0.025705077,0.005842874,0.019855442,0.0063715945,0.020725567,-0.003426579,-0.027743163,0.0144901695,0.0001787382,-0.02530583,-0.01022834,-0.0039253817,0.029628351,0.023176137,0.013446532,0.010396614,0.029048542,-0.011058426,0.008122031,-0.0018129413,0.023602467,0.018738175,-0.011839007,-0.0007485338,-0.017155482,-0.012258358,0.0039221384,0.016180573,-0.0340307,-0.036527418,-0.051814668,0.020003285,-0.009113398,-0.040786985,-0.031386737,0.015631745,-0.030029086,-0.0015933489,0.022582429,-0.008478272,0.013005339,0.018502086,0.0066689844,-0.003973617,-0.02011316,-0.016115801,-0.014530212,-0.007849917,0.0146687515,0.005739634,0.000050622126,0.011369415,0.026480028,-0.00033202698,-0.018550465,-0.03086732,-0.0029936526,-0.0133567685,0.021883883,0.0219055,-0.012134877,0.01543034,-0.05686483,0.008726991,-0.021626728,0.03603936,-0.059439253,-0.13235831,0.04152966,-0.01356402,0.029336639,-0.006881329,0.013087213,0.023382805,-0.016738115,-0.0054492303,-0.015071227,0.036480732,0.0054372507,-0.041203924,0.00020370685,-0.02306033,-0.00926911,-0.0145974215,-0.013066627,-0.01698856,-0.009841226,-0.023182422,-0.0090002045,-0.0051838844,-0.019607283,0.022583287,0.05120336,-0.029894052,-0.0017047384,0.05515681,-0.038759004,-0.026863107,-0.0034450917,-0.022791661,-0.023773093,-0.039815653,-0.031755276,0.0059102387,0.02722104,0.024710301,-0.008639328,-0.017580861,0.58795387,0.024504896,-0.008522231,-0.027976135,-0.034341495,0.019284328,-0.024976091,0.00021876903,-0.019164013,-0.03384928,0.02651799,-0.03413976,-0.012082252,0.012997715,-0.010560675,-0.0008881843,-0.01964561,0.020191023,-0.0032044328,0.011662379,0.027559685,-0.028673887,0.031407002,0.016164862,-0.03869483,-0.029849932,0.004897442,-0.020728366,0.03650994,-0.013739642,-0.010376257,-0.012629424,0.017973052,0.04360613,-0.049027562,0.0050991224,0.0009483153,-0.011180188,0.0147739835,-0.015625348,0.02082274,-0.06144755,0.016449954,-0.012884111,-0.003031963,0.033748847,-0.0010292723,0.0091982735,0.04087524,-0.04438955,-0.015863378,-0.016375398,-0.0027621628,0.0019388932,-0.028666744,0.0045211967,-0.008117966,-0.010300809,0.0068415673,0.0067872764,-0.02498338,-0.036147058,0.016529895,-0.025261633,-0.0070571764,-0.0019933924,-0.022864865,-0.026078282,-0.009343328,0.03493448,0.0106634665,-0.0019994827,0.02587734,-0.017327242,-0.0434487,0.0015870093,0.030069752,0.09477261,0.038690012,0.034843326,0.0060176644,0.019751232,0.008616583,0.020846847,-0.009917328,-0.0037736418,-0.024252731,-0.011477916,-0.040869854,-0.017484691,0.011577995,0.0037214572,-0.013214444,0.0040351334,-0.009090913,-0.015102522,0.0019098566,-0.021496322,0.021401547,0.014246689,0.013708214,0.026731633,0.03082906,-0.0007700539,-0.018616553,-0.029063804,-0.027679535,-0.017108824,0.02045021,0.026145881,-0.020869235,-0.013704682,-0.0046016253,0.0129401,-0.0065996014,-0.009390609,-0.010592297,-0.017636357,0.026054125,0.039032463,0.05956301,-0.022025356,-0.0248067,-0.003955503,0.0026233185,0.008638101,0.018238895,-0.017039036,0.004758067,0.018721132,-0.0034013917,0.01584975,-0.000010444529,0.019118976,-0.023286914,0.008942267,-0.014099941,-0.009087798,0.0037993565,0.010989498,-0.0042618727,-0.005088537,-0.008143627,0.007928727,-0.002029066,0.0067183045,-0.011420877,0.026516901,-0.029993529,0.005567179,0.0055272058,-0.014271571,-0.002010232,0.020727968,0.030849114,0.053471982,0.0070274724,0.018872503,-0.028397525,0.019526534,0.029088335,-0.037207697,0.02310011,-0.071238495,-0.017594337,0.004825751,-0.0024704107,0.020892806,-0.02935248,-0.011031174,0.0039876355,-0.0018368444,-0.023114618,-0.0037236218,0.0010983949,-0.011286987,0.016744306,0.01464577,0.022070931,0.5881262,0.02016441,-0.0050207917,0.021085707,0.0012998604,0.018639868,0.059667125,-0.0029514222,0.005996795,0.047070507,0.017189069,-0.0020746794,-0.0069092107,-0.016612004,0.013541245,0.019972721,-0.014009221,-0.15313473,0.029074652,0.028020965,-0.008563584,0.018442623,0.02329679,-0.018890375,-0.01607894,-0.0031452514,-0.014648271,0.0073598614,0.00042422133,0.0041512027,0.00932262,-0.026791893,-0.0042145876,0.014047548,-0.004795796,0.026279105,0.016782261,-0.016157184,-0.032282304,0.018406125,0.021892892,0.009781943,-0.037233133,0.012999317,0.0036291992,0.01562886,0.017304696,0.024041586,0.004308645,-0.02055302,-0.0069906553,-0.014221454,-0.014898157,-0.026927464,0.0009418807,0.0065758624,0.004423506,0.00835459,-0.0019481694,0.013509642,-0.019874744,0.02755871,-0.024873462,0.009487407,-0.0012299505,-0.011615028,-0.022319999,0.015174511,-0.023295013,0.042713948,0.019479584,0.0038494763,0.026819225,0.008512796,0.0037278982,-0.011690089,-0.018357502,-0.0038855043,-0.041052457,0.04447373,-0.01395221,-0.02275553,0.01135418,0.034285452,-0.0075344867,-0.000068669906,-0.006622553,0.041763883,0.026437055,0.010137292,-0.044784088,0.022310328,-0.044167347,0.01720784,0.014068358,0.016606389,-0.0002399555,-0.0014027195,-0.021328364,0.016257718,-0.013554196,0.009925168,0.0068834126,-0.012612237,-0.0033075514,-0.019634109,-0.023425866,-0.008531506,-0.015062512,-0.017552078,0.009368133,-0.044785965,-0.010361197,-0.020905435,-0.018630436,0.0052409875,-0.0018509565,0.026241029,-0.019112512,0.002418993,-0.021497626,-0.02038699,0.0032017485,-0.023622047,-0.017058102,0.026453113,-0.012737799,0.024695754,-0.024052039,-0.0059554623,-0.0058942297,-0.043091197,-0.019553937,-0.0029777375,-0.02578314,-0.04183964,-0.02445611,0.020003537,0.011399134,0.016810508,-0.024666883,0.021959038,-0.018513309,-0.025984148,0.025741195,0.031433307,-0.005072043,-0.015799517,0.002063807,0.025492117,0.012155052,0.01693681,0.015494632,0.0067701573,0.02771366,-0.034591164,-0.016862094,0.013201297,-0.022639832,-0.04390628,0.0143880425,-0.048212104,0.024455583,0.019158658,0.00058166526,0.045549355,0.022434525,0.049816687,0.017570727,-0.087529816,0.008593835,-0.019805877,0.020331787,-0.00499048,-0.0051258733,0.0017428688,-0.015953146,-0.005186244,-0.00797339,0.008708625,-0.02239624,0.101917505,0.0073612295,-0.015816536,0.008870697,0.0116160875,-0.018606981,0.027977573,-0.0059686736,0.033387125,-0.0029925585,0.012760448,-0.02131721,-0.007935456,-0.015180696,-0.007833633,-0.008752497,-0.022417756,-0.024780653,0.010383246]' ASC; ```
Author
Owner

@ser commented on GitHub (Feb 25, 2024):

OK, so I have upgraded first the pgvecto.rs to 0.2 on old pg14 database, then upgraded it to pg16 and now everything seem to work but search: ERROR [QueryFailedError: operator does not exist: vectors.vector <=> unknown. I have tried the fix proposed but I have the same error as OP: ERROR: access method "hnsw" does not exist.

@ser commented on GitHub (Feb 25, 2024): OK, so I have upgraded first the pgvecto.rs to 0.2 on old pg14 database, then upgraded it to pg16 and now everything seem to work but search: `ERROR [QueryFailedError: operator does not exist: vectors.vector <=> unknown`. I have tried the fix proposed but I have the same error as OP: `ERROR: access method "hnsw" does not exist`.
Author
Owner

@ser commented on GitHub (Feb 25, 2024):

OK it seems I was able to fix it!

ALTER DATABASE immich SET search_path TO immich, public, vectors;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA vectors TO immich;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO immich;
@ser commented on GitHub (Feb 25, 2024): OK it seems I was able to fix it! ``` ALTER DATABASE immich SET search_path TO immich, public, vectors; GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA vectors TO immich; GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO immich; ```
Author
Owner

@mertalev commented on GitHub (Feb 25, 2024):

Interesting, so both ERROR [QueryFailedError: operator does not exist: vectors.vector <=> unknown and ERROR: access method "hnsw" does not exist might just be permission issues.

@mertalev commented on GitHub (Feb 25, 2024): Interesting, so both `ERROR [QueryFailedError: operator does not exist: vectors.vector <=> unknown` and `ERROR: access method "hnsw" does not exist` might just be permission issues.
Author
Owner

@dnlldl commented on GitHub (Feb 26, 2024):

OK it seems I was able to fix it!

ALTER DATABASE immich SET search_path TO immich, public, vectors;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA vectors TO immich;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO immich;

Just wanna report that I have the same issue, the 2 grant commands above don't help, however alter role immich with superuser; fixes it. Obviously I'd like some better permission management here.

@dnlldl commented on GitHub (Feb 26, 2024): > OK it seems I was able to fix it! > > ``` > ALTER DATABASE immich SET search_path TO immich, public, vectors; > GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA vectors TO immich; > GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO immich; > ``` Just wanna report that I have the same issue, the 2 grant commands above don't help, however `alter role immich with superuser;` fixes it. Obviously I'd like some better permission management here.
Author
Owner

@VoVAllen commented on GitHub (Feb 26, 2024):

If you're not superuser, you may need to modify the search path for you only by ALTER ROLE username SET search_path TO "$user", public, vectors;

@VoVAllen commented on GitHub (Feb 26, 2024): If you're not superuser, you may need to modify the search path for you only by `ALTER ROLE username SET search_path TO "$user", public, vectors;`
Author
Owner

@dnlldl commented on GitHub (Feb 26, 2024):

If you're not superuser, you may need to modify the search path for you only by ALTER ROLE username SET search_path TO "$user", public, vectors;

I tried:

postgres=# alter role immich set search_path TO "$user", public, vectors;
ALTER ROLE
postgres=# alter role immich with nosuperuser;
ALTER ROLE

Back to the errors, full stack:

[Nest] 182  - 02/25/2024, 10:34:11 PM   ERROR [QueryFailedError: operator does not exist: vectors.vector <=> unknown
    at PostgresQueryRunner.query (/app/immich/server/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async SelectQueryBuilder.loadRawResults (/app/immich/server/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2192:25)
    at async SelectQueryBuilder.executeEntitiesAndRawResults (/app/immich/server/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2040:26)
    at async SelectQueryBuilder.getRawAndEntities (/app/immich/server/node_modules/typeorm/query-builder/SelectQueryBuilder.js:684:29)
    at async SelectQueryBuilder.getMany (/app/immich/server/node_modules/typeorm/query-builder/SelectQueryBuilder.js:750:25)
    at async paginatedBuilder (/app/immich/server/dist/infra/infra.utils.js:49:19)
    at async /app/immich/server/dist/infra/repositories/search.repository.js:74:23
    at async EntityManager.transaction (/app/immich/server/node_modules/typeorm/entity-manager/EntityManager.js:73:28)
    at async SearchRepository.searchSmart (/app/immich/server/dist/infra/repositories/search.repository.js:65:9)] Failed to search smart
[Nest] 182  - 02/25/2024, 10:34:11 PM   ERROR [QueryFailedError: operator does not exist: vectors.vector <=> unknown
    at PostgresQueryRunner.query (/app/immich/server/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async SelectQueryBuilder.loadRawResults (/app/immich/server/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2192:25)
    at async SelectQueryBuilder.executeEntitiesAndRawResults (/app/immich/server/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2040:26)
    at async SelectQueryBuilder.getRawAndEntities (/app/immich/server/node_modules/typeorm/query-builder/SelectQueryBuilder.js:684:29)
    at async SelectQueryBuilder.getMany (/app/immich/server/node_modules/typeorm/query-builder/SelectQueryBuilder.js:750:25)
    at async paginatedBuilder (/app/immich/server/dist/infra/infra.utils.js:49:19)
    at async /app/immich/server/dist/infra/repositories/search.repository.js:74:23
    at async EntityManager.transaction (/app/immich/server/node_modules/typeorm/entity-manager/EntityManager.js:73:28)
    at async SearchRepository.searchSmart (/app/immich/server/dist/infra/repositories/search.repository.js:65:9)] QueryFailedError: operator does not exist: vectors.vector <=> unknown

Fixed again with postgres=# alter role immich with superuser;.

@dnlldl commented on GitHub (Feb 26, 2024): > If you're not superuser, you may need to modify the search path for you only by `ALTER ROLE username SET search_path TO "$user", public, vectors;` I tried: ``` postgres=# alter role immich set search_path TO "$user", public, vectors; ALTER ROLE postgres=# alter role immich with nosuperuser; ALTER ROLE ``` Back to the errors, full stack: ``` [Nest] 182 - 02/25/2024, 10:34:11 PM ERROR [QueryFailedError: operator does not exist: vectors.vector <=> unknown at PostgresQueryRunner.query (/app/immich/server/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async SelectQueryBuilder.loadRawResults (/app/immich/server/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2192:25) at async SelectQueryBuilder.executeEntitiesAndRawResults (/app/immich/server/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2040:26) at async SelectQueryBuilder.getRawAndEntities (/app/immich/server/node_modules/typeorm/query-builder/SelectQueryBuilder.js:684:29) at async SelectQueryBuilder.getMany (/app/immich/server/node_modules/typeorm/query-builder/SelectQueryBuilder.js:750:25) at async paginatedBuilder (/app/immich/server/dist/infra/infra.utils.js:49:19) at async /app/immich/server/dist/infra/repositories/search.repository.js:74:23 at async EntityManager.transaction (/app/immich/server/node_modules/typeorm/entity-manager/EntityManager.js:73:28) at async SearchRepository.searchSmart (/app/immich/server/dist/infra/repositories/search.repository.js:65:9)] Failed to search smart [Nest] 182 - 02/25/2024, 10:34:11 PM ERROR [QueryFailedError: operator does not exist: vectors.vector <=> unknown at PostgresQueryRunner.query (/app/immich/server/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async SelectQueryBuilder.loadRawResults (/app/immich/server/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2192:25) at async SelectQueryBuilder.executeEntitiesAndRawResults (/app/immich/server/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2040:26) at async SelectQueryBuilder.getRawAndEntities (/app/immich/server/node_modules/typeorm/query-builder/SelectQueryBuilder.js:684:29) at async SelectQueryBuilder.getMany (/app/immich/server/node_modules/typeorm/query-builder/SelectQueryBuilder.js:750:25) at async paginatedBuilder (/app/immich/server/dist/infra/infra.utils.js:49:19) at async /app/immich/server/dist/infra/repositories/search.repository.js:74:23 at async EntityManager.transaction (/app/immich/server/node_modules/typeorm/entity-manager/EntityManager.js:73:28) at async SearchRepository.searchSmart (/app/immich/server/dist/infra/repositories/search.repository.js:65:9)] QueryFailedError: operator does not exist: vectors.vector <=> unknown ``` Fixed again with `postgres=# alter role immich with superuser;`.
Author
Owner

@VoVAllen commented on GitHub (Feb 26, 2024):

Thanks for your time and help. I was finally able to figure it out:
The vectors schema was owned by the postgres default user. The database in question (and debug commands run for this issue) is accessed by another user. Changing the owner of the vectors schema to my application user resolved the issues.

For my future self or other with the same issue:
ALTER SCHEMA vectors OWNER TO yourUserName.

Ref: https://github.com/tensorchord/pgvecto.rs/issues/385#issuecomment-1963823750

@VoVAllen commented on GitHub (Feb 26, 2024): > Thanks for your time and help. I was finally able to figure it out: > The vectors schema was owned by the postgres default user. The database in question (and debug commands run for this issue) is accessed by another user. Changing the owner of the vectors schema to my application user resolved the issues. > > For my future self or other with the same issue: > ALTER SCHEMA vectors OWNER TO yourUserName. Ref: https://github.com/tensorchord/pgvecto.rs/issues/385#issuecomment-1963823750
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#2204