Error creating Postgres database. Be warned that this may affect deploys
Error creating Postgres cluster: 500: ERROR: trailing junk after numeric literal at or near "03_02_" (SQLSTATE 42601)
My app name was 03-02-rest-api. I fixed this by starting the string with a letter.
So that’s the advice for future troubleshooting - start your app name with a letter.
The question: what is parsing the app name as a numeric literal, and why? Can this be changed?
Thanks for posting this! flyctl could probably catch this a lot earlier…
This is almost certainly Postgres itself:
postgres=# create database 03_02_rest_api;
ERROR: trailing junk after numeric literal at or near "03_02_"
LINE 1: create database 03_02_rest_api;
^
(The main initial clue was SQLSTATE 42601.)
It seems so, but I would advise against it. (Except as an experiment.)
Other places might be making the same syntactic assumption, and you wouldn’t want to bump into them in production.
$ fly pg create --name 03-02-pounce-api-db
$ fly pg attach 03-02-pounce-api-db --database-name meow --database-user meower -a 03-02-pounce-api
The following secret was added to 03-02-pounce-api:
DATABASE_URL=postgres://meower:<password>@03-02-pounce-api-db.flycast:5432/meow?sslmode=disable