Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgresql migration to 0.7.7. fails due to syntax (reserved word) #264

Closed
trap000d opened this issue May 19, 2024 · 0 comments
Closed

Postgresql migration to 0.7.7. fails due to syntax (reserved word) #264

trap000d opened this issue May 19, 2024 · 0 comments

Comments

@trap000d
Copy link

After update to 0.7.7 Supysonic won't start due to syntax error in SQL.

May 20 10:47:53 trap000d.trap000d gunicorn[1097785]: peewee.ProgrammingError: syntax error at or near "user"
May 20 10:47:53 trap000d.trap000d gunicorn[1097785]: LINE 1: ALTER TABLE user ADD COLUMN listenbrainz_session CHAR(36) 
May 20 10:47:53 trap000d.trap000d gunicorn[1097785]:                     ^
May 20 10:47:53 trap000d.trap000d gunicorn[1097785]: [2024-05-20 10:47:53 +1200] [1097785] [INFO] Worker exiting (pid: 1097785)
May 20 10:47:54 trap000d.trap000d gunicorn[1097781]: [2024-05-20 10:47:54 +1200] [1097781] [ERROR] Worker (pid:1097784) exited with code 3
May 20 10:47:54 trap000d.trap000d gunicorn[1097781]: [2024-05-20 10:47:54 +1200] [1097781] [ERROR] Worker (pid:1097783) was sent SIGTERM!
May 20 10:47:54 trap000d.trap000d gunicorn[1097781]: [2024-05-20 10:47:54 +1200] [1097781] [ERROR] Worker (pid:1097786) was sent SIGTERM!
May 20 10:47:54 trap000d.trap000d gunicorn[1097781]: [2024-05-20 10:47:54 +1200] [1097781] [ERROR] Worker (pid:1097785) was sent SIGTERM!
May 20 10:47:54 trap000d.trap000d gunicorn[1097781]: [2024-05-20 10:47:54 +1200] [1097781] [ERROR] Shutting down: Master
May 20 10:47:54 trap000d.trap000d gunicorn[1097781]: [2024-05-20 10:47:54 +1200] [1097781] [ERROR] Reason: Worker failed to boot.

After some googling it appeared that user is reserved word in PostgreSQL. Effectively there are two ways to fix the issue: either enclose it in quotes or use 'public' prefix for table name

schema/migration/postgres/20240318.sql:

ALTER TABLE "user" ADD COLUMN listenbrainz_session CHAR(36);
ALTER TABLE "user" ADD COLUMN listenbrainz_status BOOLEAN NOT NULL DEFAULT TRUE;
ALTER TABLE public.user ADD COLUMN listenbrainz_session CHAR(36);
ALTER TABLE public.user ADD COLUMN listenbrainz_status BOOLEAN NOT NULL DEFAULT TRUE;
@trap000d trap000d changed the title Postgesql migration to 0.7.7. fails due to syntax (reserved word) Postgresql migration to 0.7.7. fails due to syntax (reserved word) May 19, 2024
@spl0k spl0k closed this as completed in a1231e0 May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant