1.133.0 SQL `PostgresError: syntax error at or near "."` Database name is not escaped properly

2025-05-22 12:43:15.074 CEST [1] LOG: starting PostgreSQL 14.17 (Debian 14.17-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
2025-05-22 12:43:15.074 CEST [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2025-05-22 12:43:15.074 CEST [1] LOG: listening on IPv6 address "::", port 5432
2025-05-22 12:43:15.082 CEST [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2025-05-22 12:43:15.098 CEST [29] LOG: database system was shut down at 2025-05-22 12:30:32 CEST
[2025-05-22T10:43:15Z INFO service::utils::clean] Find directory "pg_vectors/indexes/801329".
[2025-05-22T10:43:15Z INFO service::utils::clean] Find directory "pg_vectors/indexes/953291".
[2025-05-22T10:43:15Z INFO service::utils::clean] Find directory "pg_vectors/indexes/801329/segments/84076b9f-16f3-4367-a4c8-9b8bce008069".
2025-05-22 12:43:15.113 CEST [1] LOG: database system is ready to accept connections
[2025-05-22T10:43:15Z INFO service::utils::clean] Find directory "pg_vectors/indexes/953291/segments/14b0f86d-9e6d-4ae1-a519-9695c8c381fb".
2025-05-22 12:43:43.054 CEST [67] FATAL: role "root" does not exist
2025-05-22 12:43:43.160 CEST [69] FATAL: role "root" does not exist
2025-05-22 12:44:13.284 CEST [78] FATAL: role "root" does not exist
2025-05-22 12:44:13.341 CEST [80] FATAL: role "root" does not exist
2025-05-22 12:44:43.461 CEST [90] FATAL: role "root" does not exist
2025-05-22 12:44:43.509 CEST [92] FATAL: role "root" does not exist
2025-05-22 12:45:13.631 CEST [101] FATAL: role "root" does not exist
2025-05-22 12:45:13.681 CEST [103] FATAL: role "root" does not exist
2025-05-22 12:45:43.809 CEST [113] FATAL: role "root" does not exist
2025-05-22 12:45:43.857 CEST [115] FATAL: role "root" does not exist
2025-05-22 12:46:13.992 CEST [124] FATAL: role "root" does not exist
2025-05-22 12:46:14.045 CEST [126] FATAL: role "root" does not exist
2025-05-22 12:46:44.189 CEST [136] FATAL: role "root" does not exist
2025-05-22 12:46:44.238 CEST [138] FATAL: role "root" does not exist
2025-05-22 12:47:14.364 CEST [147] FATAL: role "root" does not exist
2025-05-22 12:47:14.413 CEST [149] FATAL: role "root" does not exist
2025-05-22 12:47:44.537 CEST [159] FATAL: role "root" does not exist
2025-05-22 12:47:44.588 CEST [161] FATAL: role "root" does not exist
2025-05-22 12:43:15.074 CEST [1] LOG: starting PostgreSQL 14.17 (Debian 14.17-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
2025-05-22 12:43:15.074 CEST [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
2025-05-22 12:43:15.074 CEST [1] LOG: listening on IPv6 address "::", port 5432
2025-05-22 12:43:15.082 CEST [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2025-05-22 12:43:15.098 CEST [29] LOG: database system was shut down at 2025-05-22 12:30:32 CEST
[2025-05-22T10:43:15Z INFO service::utils::clean] Find directory "pg_vectors/indexes/801329".
[2025-05-22T10:43:15Z INFO service::utils::clean] Find directory "pg_vectors/indexes/953291".
[2025-05-22T10:43:15Z INFO service::utils::clean] Find directory "pg_vectors/indexes/801329/segments/84076b9f-16f3-4367-a4c8-9b8bce008069".
2025-05-22 12:43:15.113 CEST [1] LOG: database system is ready to accept connections
[2025-05-22T10:43:15Z INFO service::utils::clean] Find directory "pg_vectors/indexes/953291/segments/14b0f86d-9e6d-4ae1-a519-9695c8c381fb".
2025-05-22 12:43:43.054 CEST [67] FATAL: role "root" does not exist
2025-05-22 12:43:43.160 CEST [69] FATAL: role "root" does not exist
2025-05-22 12:44:13.284 CEST [78] FATAL: role "root" does not exist
2025-05-22 12:44:13.341 CEST [80] FATAL: role "root" does not exist
2025-05-22 12:44:43.461 CEST [90] FATAL: role "root" does not exist
2025-05-22 12:44:43.509 CEST [92] FATAL: role "root" does not exist
2025-05-22 12:45:13.631 CEST [101] FATAL: role "root" does not exist
2025-05-22 12:45:13.681 CEST [103] FATAL: role "root" does not exist
2025-05-22 12:45:43.809 CEST [113] FATAL: role "root" does not exist
2025-05-22 12:45:43.857 CEST [115] FATAL: role "root" does not exist
2025-05-22 12:46:13.992 CEST [124] FATAL: role "root" does not exist
2025-05-22 12:46:14.045 CEST [126] FATAL: role "root" does not exist
2025-05-22 12:46:44.189 CEST [136] FATAL: role "root" does not exist
2025-05-22 12:46:44.238 CEST [138] FATAL: role "root" does not exist
2025-05-22 12:47:14.364 CEST [147] FATAL: role "root" does not exist
2025-05-22 12:47:14.413 CEST [149] FATAL: role "root" does not exist
2025-05-22 12:47:44.537 CEST [159] FATAL: role "root" does not exist
2025-05-22 12:47:44.588 CEST [161] FATAL: role "root" does not exist
How can I create the role in sql?
51 Replies
Immich
Immich3w ago
:wave: Hey @raldone01, Thanks for reaching out to us. Please carefully read this message and follow the recommended actions. This will help us be more effective in our support effort and leave more time for building Immich :immich:. References - Container Logs: docker compose logs docs - Container Status: docker ps -a docs - Reverse Proxy: https://immich.app/docs/administration/reverse-proxy - Code Formatting https://support.discord.com/hc/en-us/articles/210298617-Markdown-Text-101-Chat-Formatting-Bold-Italic-Underline#h_01GY0DAKGXDEHE263BCAYEGFJA Checklist I have... 1. :ballot_box_with_check: verified I'm on the latest release(note that mobile app releases may take some time). 2. :ballot_box_with_check: read applicable release notes. 3. :ballot_box_with_check: reviewed the FAQs for known issues. 4. :ballot_box_with_check: reviewed Github for known issues. 5. :ballot_box_with_check: tried accessing Immich via local ip (without a custom reverse proxy). 6. :ballot_box_with_check: uploaded the relevant information (see below). 7. :ballot_box_with_check: tried an incognito window, disabled extensions, cleared mobile app cache, logged out and back in, different browsers, etc. as applicable (an item can be marked as "complete" by reacting with the appropriate number) Information In order to be able to effectively help you, we need you to provide clear information to show what the problem is. The exact details needed vary per case, but here is a list of things to consider: - Your docker-compose.yml and .env files. - Logs from all the containers and their status (see above). - All the troubleshooting steps you've tried so far. - Any recent changes you've made to Immich or your system. - Details about your system (both software/OS and hardware). - Details about your storage (filesystems, type of disks, output of commands like fdisk -l and df -h). - The version of the Immich server, mobile app, and other relevant pieces. - Any other information that you think might be relevant. Please paste files and logs with proper code formatting, and especially avoid blurry screenshots. Without the right information we can't work out what the problem is. Help us help you ;) If this ticket can be closed you can use the /close command, and re-open it later if needed. Successfully submitted, a tag has been added to inform contributors. :white_check_mark:
raldone01
raldone01OP3w ago
I am using ghcr.io/immich-app/postgres:14-vectorchord0.3.0-pgvectors0.2.0
bo0tzz
bo0tzz3w ago
Please post more detail. Is this a new install or an update? If the latter, what did you change?
raldone01
raldone01OP3w ago
Update I just pulled and changed:
tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:739cdd626151ff1f796dc95a6591b55a714f341c737e27f045019ceabf8e8c52
tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:739cdd626151ff1f796dc95a6591b55a714f341c737e27f045019ceabf8e8c52
to ghcr.io/immich-app/postgres:14-vectorchord0.3.0-pgvectors0.2.0 I am still on redis:6.2-alpine@sha256:148bb5411c184abd288d9aaed139c98123eeb8824c5d3fce03cf721db58066d8 if that matters. I still had command: ["postgres", "-c" ,"shared_preload_libraries=vectors.so", "-c", 'search_path="$$user", public, vectors', "-c", "logging_collector=on", "-c", "max_wal_size=2GB", "-c", "shared_buffers=512MB", "-c", "wal_compression=on"] from the previous production yaml. I removed that and the db logs now look more reasonable.
❯ docker compose up immich-db
[+] Running 1/1
✔ Container docker_featherink-immich-db-1 Recreated 1.9s
Attaching to immich-db-1
immich-db-1 | Using SSD storage
immich-db-1 |
immich-db-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
immich-db-1 |
immich-db-1 | 2025-05-22 11:02:49.318 GMT [1] LOG: skipping missing configuration file "/var/lib/postgresql/data/postgresql.override.conf"
immich-db-1 | 2025-05-22 11:02:49.319 GMT [1] LOG: skipping missing configuration file "/var/lib/postgresql/data/postgresql.override.conf"
immich-db-1 | 2025-05-22 13:02:52.300 CEST [1] LOG: starting PostgreSQL 14.17 (Debian 14.17-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
immich-db-1 | 2025-05-22 13:02:52.300 CEST [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
immich-db-1 | 2025-05-22 13:02:52.300 CEST [1] LOG: listening on IPv6 address "::", port 5432
immich-db-1 | 2025-05-22 13:02:52.308 CEST [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
immich-db-1 | 2025-05-22 13:02:52.322 CEST [28] LOG: database system was shut down at 2025-05-22 13:02:46 CEST
immich-db-1 | [2025-05-22T11:02:52Z INFO service::utils::clean] Find directory "pg_vectors/indexes/801329".
immich-db-1 | [2025-05-22T11:02:52Z INFO service::utils::clean] Find directory "pg_vectors/indexes/953291".
immich-db-1 | [2025-05-22T11:02:52Z INFO service::utils::clean] Find directory "pg_vectors/indexes/801329/segments/84076b9f-16f3-4367-a4c8-9b8bce008069".
immich-db-1 | 2025-05-22 13:02:52.339 CEST [1] LOG: database system is ready to accept connections
immich-db-1 | [2025-05-22T11:02:52Z INFO service::utils::clean] Find directory "pg_vectors/indexes/953291/segments/14b0f86d-9e6d-4ae1-a519-9695c8c381fb".
immich-db-1 | 2025-05-22 13:03:18.584 CEST [66] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 13:03:18.677 CEST [68] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 13:03:48.799 CEST [78] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 13:03:48.857 CEST [80] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 13:04:18.983 CEST [90] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 13:04:19.033 CEST [92] FATAL: role "root" does not exist
❯ docker compose up immich-db
[+] Running 1/1
✔ Container docker_featherink-immich-db-1 Recreated 1.9s
Attaching to immich-db-1
immich-db-1 | Using SSD storage
immich-db-1 |
immich-db-1 | PostgreSQL Database directory appears to contain a database; Skipping initialization
immich-db-1 |
immich-db-1 | 2025-05-22 11:02:49.318 GMT [1] LOG: skipping missing configuration file "/var/lib/postgresql/data/postgresql.override.conf"
immich-db-1 | 2025-05-22 11:02:49.319 GMT [1] LOG: skipping missing configuration file "/var/lib/postgresql/data/postgresql.override.conf"
immich-db-1 | 2025-05-22 13:02:52.300 CEST [1] LOG: starting PostgreSQL 14.17 (Debian 14.17-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
immich-db-1 | 2025-05-22 13:02:52.300 CEST [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
immich-db-1 | 2025-05-22 13:02:52.300 CEST [1] LOG: listening on IPv6 address "::", port 5432
immich-db-1 | 2025-05-22 13:02:52.308 CEST [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
immich-db-1 | 2025-05-22 13:02:52.322 CEST [28] LOG: database system was shut down at 2025-05-22 13:02:46 CEST
immich-db-1 | [2025-05-22T11:02:52Z INFO service::utils::clean] Find directory "pg_vectors/indexes/801329".
immich-db-1 | [2025-05-22T11:02:52Z INFO service::utils::clean] Find directory "pg_vectors/indexes/953291".
immich-db-1 | [2025-05-22T11:02:52Z INFO service::utils::clean] Find directory "pg_vectors/indexes/801329/segments/84076b9f-16f3-4367-a4c8-9b8bce008069".
immich-db-1 | 2025-05-22 13:02:52.339 CEST [1] LOG: database system is ready to accept connections
immich-db-1 | [2025-05-22T11:02:52Z INFO service::utils::clean] Find directory "pg_vectors/indexes/953291/segments/14b0f86d-9e6d-4ae1-a519-9695c8c381fb".
immich-db-1 | 2025-05-22 13:03:18.584 CEST [66] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 13:03:18.677 CEST [68] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 13:03:48.799 CEST [78] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 13:03:48.857 CEST [80] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 13:04:18.983 CEST [90] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 13:04:19.033 CEST [92] FATAL: role "root" does not exist
I get no output at all from immich-server though which is very weird.
❯ docker compose up immich-server
[+] Running 2/2
✔ Container docker_featherink-immich-redis-1 Running 0.0s
✔ Container docker_featherink-immich-db-1 Running 0.0s
Attaching to immich-server-1
❯ docker compose up immich-server
[+] Running 2/2
✔ Container docker_featherink-immich-redis-1 Running 0.0s
✔ Container docker_featherink-immich-db-1 Running 0.0s
Attaching to immich-server-1
Also immich-server refuses to stop. All other containers are fine. (via compose) I can force it with the normal docker cli. It might not be immichs fault. I found segfaults in dmesg. Nvidia broke the container toolkit on arch linux with their latest release: https://github.com/NVIDIA/nvidia-container-toolkit/issues/1101 I have now downgraded and will try again. Okay it was nvidias fault.
raldone01
raldone01OP3w ago
❯ docker compose logs --tail 400 --follow immich-server
Initializing Immich v1.133.0
Detected CPU Cores: 72
Starting api worker
Starting microservices worker
[Nest] 7 - 05/22/2025, 1:20:12 PM LOG [Microservices:EventRepository] Initialized websocket server
[Nest] 7 - 05/22/2025, 1:20:12 PM LOG [Microservices:DatabaseRepository] Creating VectorChord extension
Query failed : {
durationMs: 2.101156999999148,
error: PostgresError: syntax error at or near "."
at ErrorResponse (/usr/src/app/node_modules/postgres/cjs/src/connection.js:790:26)
at handle (/usr/src/app/node_modules/postgres/cjs/src/connection.js:476:6)
at Socket.data (/usr/src/app/node_modules/postgres/cjs/src/connection.js:315:9)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Readable.push (node:internal/streams/readable:392:5)
at TCP.onStreamRead (node:internal/stream_base_commons:189:23) {
severity_local: 'ERROR',
severity: 'ERROR',
code: '42601',
position: '49',
file: 'scan.l',
line: '1176',
routine: 'scanner_yyerror'
},
[Nest] 7 - 05/22/2025, 1:20:12 PM FATAL [Microservices:DatabaseService] Failed to activate VectorChord extension.
Please ensure the Postgres instance has VectorChord installed.

If the Postgres instance already has VectorChord installed, Immich may not have the necessary permissions to activate it.
In this case, please run 'CREATE EXTENSION IF NOT EXISTS vchord CASCADE' manually as a superuser.
See https://immich.app/docs/guides/database-queries for how to query the database.
sql: 'ALTER DATABASE "2Izuz2a_X)F}~8H<86*R~L_r`sx<<Yf"."" SET vchordrq.prewarm_dim = \'512,640,768,1024,1152,1536\'',
params: []
}
PostgresError: syntax error at or near "."
at ErrorResponse (/usr/src/app/node_modules/postgres/cjs/src/connection.js:790:26)
at handle (/usr/src/app/node_modules/postgres/cjs/src/connection.js:476:6)
at Socket.data (/usr/src/app/node_modules/postgres/cjs/src/connection.js:315:9)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Readable.push (node:internal/streams/readable:392:5)
at TCP.onStreamRead (node:internal/stream_base_commons:189:23) {
severity_local: 'ERROR',
severity: 'ERROR',
code: '42601',
position: '49',
file: 'scan.l',
line: '1176',
routine: 'scanner_yyerror'
}
microservices worker error: PostgresError: syntax error at or near ".", stack: PostgresError: syntax error at or near "."
at ErrorResponse (/usr/src/app/node_modules/postgres/cjs/src/connection.js:790:26)
at handle (/usr/src/app/node_modules/postgres/cjs/src/connection.js:476:6)
at Socket.data (/usr/src/app/node_modules/postgres/cjs/src/connection.js:315:9)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Readable.push (node:internal/streams/readable:392:5)
at TCP.onStreamRead (node:internal/stream_base_commons:189:23)
microservices worker exited with code 1
Killing api process
Initializing Immich v1.133.0
Detected CPU Cores: 72
Starting api worker
Starting microservices worker
Rest is looking good
❯ docker compose logs --tail 400 --follow immich-server
Initializing Immich v1.133.0
Detected CPU Cores: 72
Starting api worker
Starting microservices worker
[Nest] 7 - 05/22/2025, 1:20:12 PM LOG [Microservices:EventRepository] Initialized websocket server
[Nest] 7 - 05/22/2025, 1:20:12 PM LOG [Microservices:DatabaseRepository] Creating VectorChord extension
Query failed : {
durationMs: 2.101156999999148,
error: PostgresError: syntax error at or near "."
at ErrorResponse (/usr/src/app/node_modules/postgres/cjs/src/connection.js:790:26)
at handle (/usr/src/app/node_modules/postgres/cjs/src/connection.js:476:6)
at Socket.data (/usr/src/app/node_modules/postgres/cjs/src/connection.js:315:9)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Readable.push (node:internal/streams/readable:392:5)
at TCP.onStreamRead (node:internal/stream_base_commons:189:23) {
severity_local: 'ERROR',
severity: 'ERROR',
code: '42601',
position: '49',
file: 'scan.l',
line: '1176',
routine: 'scanner_yyerror'
},
[Nest] 7 - 05/22/2025, 1:20:12 PM FATAL [Microservices:DatabaseService] Failed to activate VectorChord extension.
Please ensure the Postgres instance has VectorChord installed.

If the Postgres instance already has VectorChord installed, Immich may not have the necessary permissions to activate it.
In this case, please run 'CREATE EXTENSION IF NOT EXISTS vchord CASCADE' manually as a superuser.
See https://immich.app/docs/guides/database-queries for how to query the database.
sql: 'ALTER DATABASE "2Izuz2a_X)F}~8H<86*R~L_r`sx<<Yf"."" SET vchordrq.prewarm_dim = \'512,640,768,1024,1152,1536\'',
params: []
}
PostgresError: syntax error at or near "."
at ErrorResponse (/usr/src/app/node_modules/postgres/cjs/src/connection.js:790:26)
at handle (/usr/src/app/node_modules/postgres/cjs/src/connection.js:476:6)
at Socket.data (/usr/src/app/node_modules/postgres/cjs/src/connection.js:315:9)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Readable.push (node:internal/streams/readable:392:5)
at TCP.onStreamRead (node:internal/stream_base_commons:189:23) {
severity_local: 'ERROR',
severity: 'ERROR',
code: '42601',
position: '49',
file: 'scan.l',
line: '1176',
routine: 'scanner_yyerror'
}
microservices worker error: PostgresError: syntax error at or near ".", stack: PostgresError: syntax error at or near "."
at ErrorResponse (/usr/src/app/node_modules/postgres/cjs/src/connection.js:790:26)
at handle (/usr/src/app/node_modules/postgres/cjs/src/connection.js:476:6)
at Socket.data (/usr/src/app/node_modules/postgres/cjs/src/connection.js:315:9)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Readable.push (node:internal/streams/readable:392:5)
at TCP.onStreamRead (node:internal/stream_base_commons:189:23)
microservices worker exited with code 1
Killing api process
Initializing Immich v1.133.0
Detected CPU Cores: 72
Starting api worker
Starting microservices worker
Rest is looking good
There is some postgres escaping mistake in the migration I assume.
raldone01
raldone01OP3w ago
Seems like the database name is not properly escaped.
Zack
Zack3w ago
What is your database name for immich?
raldone01
raldone01OP3w ago
2Izuz2a_X)F}~8H<86*R~L_r`sx<<Yf.
Zack
Zack3w ago
Why...
raldone01
raldone01OP3w ago
🙃
Zack
Zack3w ago
Are you like, trying to cause problems? :KEKW:
raldone01
raldone01OP3w ago
It's funny I actually never had any issues with all the other apps I selfhost. When I first started selfhosting I thought that having a difficult to guess database name was good security practise.
Zack
Zack3w ago
We should handle it, and we will make a fix probably to support it But my god
raldone01
raldone01OP3w ago
Thanks you're the best. Also ghcr.io/immich-app/postgres:14-vectorchord0.3.0-pgvectors0.2.0 is pinned to posgres-14-vectorchord0.3.0. Updating postgres in docker between releases is a huge pain for users. Are there plans to support auto updates to the db? I switched to pgautoupgrade/pgautoupgrade:17-debian to update all may dbs scattered from version 13-16 to one unifed pg version. Should i wait for the fix or connect manually and run some commands?
Zack
Zack3w ago
Yes, we plan to update postgres to pg18 when that releases, and we plan to have an automated postgres update flow for people that follow our default installation
Daniel
Daniel3w ago
LOL
Zack
Zack3w ago
Patch release will probably be today, not sure if this is my highest priority for a fix right now though 🤣 If you rename your database you could get it working right now 😉
Immich
Immich3w ago
await sql\`ALTER DATABASE ${dbName} SET vchordrq.prewarm_dim = '512,640,768,1024,1152,1536'\`.execute(this.db);
await sql\`ALTER DATABASE ${dbName} SET vchordrq.prewarm_dim = '512,640,768,1024,1152,1536'\`.execute(this.db);

await sql\`ALTER DATABASE ${dbName} SET vchordrq.probes = 1\`.execute(this.db);
await sql\`ALTER DATABASE ${dbName} SET vchordrq.probes = 1\`.execute(this.db);
Zack
Zack3w ago
Btw, given you are getting "role "root" does not exist", do you not have a POSTGRES_PASSWORD env set on the database container?
raldone01
raldone01OP3w ago
immich-db-1 | 2025-05-22 14:25:00.018 CEST [561] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 14:25:00.071 CEST [563] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 14:30:00.202 CEST [586] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 14:30:00.258 CEST [588] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 14:35:00.380 CEST [611] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 14:35:00.431 CEST [613] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 14:40:00.562 CEST [636] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 14:40:00.615 CEST [638] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 14:45:00.736 CEST [661] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 14:45:00.787 CEST [663] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 14:25:00.018 CEST [561] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 14:25:00.071 CEST [563] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 14:30:00.202 CEST [586] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 14:30:00.258 CEST [588] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 14:35:00.380 CEST [611] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 14:35:00.431 CEST [613] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 14:40:00.562 CEST [636] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 14:40:00.615 CEST [638] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 14:45:00.736 CEST [661] FATAL: role "root" does not exist
immich-db-1 | 2025-05-22 14:45:00.787 CEST [663] FATAL: role "root" does not exist
Still getting it like clockwork. (Discord is very annyoing with their short message limits.) Btw base service is just
services:
base_service: &base_service
restart: unless-stopped
volumes:
- /etc/localtime:/etc/localtime:ro
environment:
- TZ=Europe/Vienna
services:
base_service: &base_service
restart: unless-stopped
volumes:
- /etc/localtime:/etc/localtime:ro
environment:
- TZ=Europe/Vienna
Zack
Zack3w ago
Yea it'll be because you use the USER_FILE and such
raldone01
raldone01OP3w ago
its the damn heath check again
Zack
Zack3w ago
The healthcheck specifically subs in the username from the POSTGRES_USER env var You can just override the healthcheck if you want those errors to go away
raldone01
raldone01OP3w ago
https://github.com/pgautoupgrade/docker-pgautoupgrade/issues/93 And here I was excited for:
Why are so many lines removed from the docker-compose.yml file? Does this mean the health check is removed?

These lines are now incorporated into the image itself along with some additional tuning.
Why are so many lines removed from the docker-compose.yml file? Does this mean the health check is removed?

These lines are now incorporated into the image itself along with some additional tuning.
Zack
Zack3w ago
We can probably add support to the _FILE style vars in future
raldone01
raldone01OP3w ago
wait is your new image not supporting them at all?
Zack
Zack3w ago
It'll support whatever the base postgres container supports But the healthcheck doesn't support them
raldone01
raldone01OP3w ago
:phew: Actually working healthcheck:
healthcheck:
test: bash -c 'pg_isready --dbname "$$( <"$$POSTGRES_DB_FILE" )" -U "$$( <"$$POSTGRES_USER_FILE" )" || exit 1'
interval: 5m
start_interval: 30s
start_period: 5m
healthcheck:
test: bash -c 'pg_isready --dbname "$$( <"$$POSTGRES_DB_FILE" )" -U "$$( <"$$POSTGRES_USER_FILE" )" || exit 1'
interval: 5m
start_interval: 30s
start_period: 5m
That was painful. Double $ is needed for docker compose
Zack
Zack3w ago
So when I try to reproduce this locally, the command fails the first time it runs, but when I restart the service, it succeeds the second time 🤔
Immich
Immich3w ago
[Pull Request] Properly sql escape database name. (immich-app/immich#18559)
raldone01
raldone01OP3w ago
I don't know if I would be a great help but I can try to help you figure it out.
Zeus
Zeus3w ago
I’m not fond of merging this
Zeus
Zeus3w ago
PostgreSQL Documentation
4.1. Lexical Structure
4.1.&nbsp;Lexical Structure # 4.1.1. Identifiers and Key Words 4.1.2. Constants 4.1.3. Operators 4.1.4. Special Characters 4.1.5. Comments 4.1.6. Operator Precedence …
Zeus
Zeus3w ago
“SQL identifiers and key words must begin with a letter (a-z, but also letters with diacritical marks and non-Latin letters) or an underscore (_). Subsequent characters in an identifier or key word can be letters, underscores, digits (0-9), or dollar signs ($)” So per the Postgres docs your DB starting with a number is not lexically correct Ah, I see “Quoted identifiers can contain any character, except the character with code zero. (To include a double quote, write two double quotes.) This allows constructing table or column names that would otherwise not be possible, such as ones containing spaces or ampersands. The length limitation still applies.” Still feels like a lot for such an edge case to me
sogan
sogan3w ago
That’s weird, sql.table is supposed to escape this already
sogan
sogan3w ago
💀
No description
Zack
Zack3w ago
Might be something to raise with kysely What was happening before was it seemed that it got confused by the period So it was putting extra quotes around that, I think it was treating it like a reference? So like you would have tableName.columnName
sogan
sogan3w ago
Yeah I think that’s the issue So it is escaping it, it’s just not handling the period correctly
Zack
Zack3w ago
Which would need to turn into "tableName"."columnName" So it's adding that extra "." In this case, which is incorrect But also nobody should have periods in their damn database names 🤣
Zeus
Zeus3w ago
Kysely after they patch this: https://xkcd.com/1172/
xkcd: Workflow
From An unknown user
There are probably children out there holding down spacebar to stay warm in the winter! YOUR UPDATE MURDERS CHILDREN.
sogan
sogan3w ago
For now we could probably change it to sql.raw surrounded by double quotes instead of using sql.table
Zack
Zack3w ago
I'd rather just not And have it fixed upstream
sogan
sogan3w ago
Maybe, Im just wondering if it might be difficult for them to fix it if there are valid uses of sql.table that have the period that’s supposed to work like that. I guess we can make an issue and see where it goes
Zack
Zack3w ago
That'd be my preference It only affects people who have put a period in their database name Of which we currently have one user We can just direct people to not do that lol
sogan
sogan3w ago
Yeah that’s fair lmao
raldone01
raldone01OP3w ago
Hhahah an issue is fine. I have since renamed the db anyways. :D When you create one link it here. I am curious. https://github.com/kysely-org/kysely/issues/1468 I create a minimal reproducer. Sorry for bugging you with this.
Immich
Immich2w ago
[Pull Request] feat: handle docker secrets in postgres healthcheck (immich-app/base-images#228)

Did you find this page helpful?