vgarvardt / gue

Golang queue on top of PostgreSQL
MIT License
277 stars 23 forks source link

when using custom schema relation "gue_jobs" does not exist #31

Open kulak opened 3 years ago

kulak commented 3 years ago

Worker failed to lock a job level=error worker-pool-id=959ce5 worker-id=959ce5/worker-0 error=could not lock a job (rollback result: ): ERROR: relation "gue_jobs" does not exist (SQLSTATE 42P01)

kulak commented 3 years ago

I did not have a chance to look deep into it. So, that's just a guess.

When &search_path= method is appended to connection string, it does not impact some of the queries.

kulak commented 3 years ago

Test cases might be giving false positive, because there is table in "public" schema. It is something that I was not sure how to address in abandoned #28.

vgarvardt commented 3 years ago

Can you reproduce this using test? E.g. add one more DB to services specifically for the test purpose and cover the scenario that should fail.

kulak commented 3 years ago

I am not sure how much I am interested in troubleshooting of this case. My fork https://github.com/Kulak/gue/commits/feat-schema with explicit schema implementation does not have an issue like that.

Unfortunately I did not think about a chance to re-introduce #28 and added package rename yesterday. It is also how I know that #28 works.

dosco commented 2 years ago

You have to set the schema on Postgres when opening a new connection. The schema is also called search_path. For example when using the pgx driver you can do this

config, _ := pgx.ParseConfig("host=local port=5432 user=blah password=blah dbname=db sslmode=disable")
config.RuntimeParams = map[string]string{
"application_name": "my app",
"search_path":  "custom_schema_name",
}