1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-09 05:16:47 +01:00
immich/server/src/infra
Michael Manganiello e262298090
fix(server): Split database queries based on PostgreSQL bound params limit (#6034)
* fix(server): Split database queries based on PostgreSQL bound params limit

PostgreSQL uses a 16-bit integer to indicate the number of bound
parameters.

This means that the maximum number of parameters for any query is 65535.
Any query that tries to bind more than that (e.g. searching by a list of
IDs) requires splitting the query into multiple chunks.

This change includes refactoring every Repository that runs queries
using a list of ids, and either flattening or merging results.

Fixes #5788, #5997.

Also, potentially a fix for #4648 (at least based on
[this comment](https://github.com/immich-app/immich/issues/4648#issuecomment-1826134027)).

References:

* https://github.com/typeorm/typeorm/issues/7565
* [PostgreSQL message format - Bind](https://www.postgresql.org/docs/15/protocol-message-formats.html#PROTOCOL-MESSAGE-FORMATS-BIND)

* misc: Create Chunked decorator to simplify implementation

* feat: Add ChunkedArray/ChunkedSet decorators
2024-01-06 20:36:12 -05:00
..
entities feat(web): onboarding (#6066) 2024-01-04 05:28:32 +00:00
migrations chore(server): set onboarding for existing instances (#6229) 2024-01-06 22:18:42 +00:00
repositories fix(server): Split database queries based on PostgreSQL bound params limit (#6034) 2024-01-06 20:36:12 -05:00
sql fix(server): Execute query in AlbumRepository.removeAsset method (#6216) 2024-01-06 11:56:08 -06:00
sql-generator feat: use pgvecto.rs (#3605) 2023-12-08 11:15:46 -05:00
subscribers feat(server): asset entity audit (#3824) 2023-08-24 15:28:50 -04:00
database.config.ts feat: storage template file move hardening (#5917) 2023-12-29 18:41:33 +00:00
index.ts chore(server): refactor locks (#5953) 2023-12-27 18:36:51 -05:00
infra.config.ts test(cli): e2e testing (#5101) 2023-12-18 20:29:26 -06:00
infra.module.ts fix(server): run migrations after database checks (#5832) 2023-12-21 10:06:26 -06:00
infra.util.ts fix(server): Split database queries based on PostgreSQL bound params limit (#6034) 2024-01-06 20:36:12 -05:00
infra.utils.ts fix(server): Split database queries based on PostgreSQL bound params limit (#6034) 2024-01-06 20:36:12 -05:00
logger.ts fix(server): run migrations after database checks (#5832) 2023-12-21 10:06:26 -06:00
websocket.adapter.ts feat(server): use postgres-adapter for websockets (#5569) 2023-12-08 20:38:25 -05:00