gue icon indicating copy to clipboard operation
gue copied to clipboard

when using custom schema relation "gue_jobs" does not exist

Open kulak opened this issue 4 years ago • 5 comments

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 avatar Mar 30 '21 15:03 kulak

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 avatar Mar 30 '21 16:03 kulak

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.

kulak avatar Mar 30 '21 16:03 kulak

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.

vgarvardt avatar Mar 31 '21 14:03 vgarvardt

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.

kulak avatar Mar 31 '21 20:03 kulak

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",
}

dosco avatar Feb 18 '22 08:02 dosco