Skip to content

Conversation

spanasik
Copy link
Contributor

@spanasik spanasik commented Dec 24, 2021

when table name contains schema name like foo.bar, gearman can't find it in database because it uses query SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = ... and TABLE_NAME column data contains only bar part so each time on startup it tries to recreate it and on second start it fails PQexec:ERROR: relation "bar" already exists

this is a quick fix, correct fix is to add non-default schema support but this way it will work at least

COMPATIBILITY NOTE: IF NOT EXISTS added in Postgres 9.1

when table name contains schema name like `foo.bar`, gearman can't find it in database because it uses query `SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME  = ...` and `TABLE_NAME` column data contains only `bar` part so each time on startup it tries to recreate it and on second start it fails `PQexec:ERROR:  relation "bar" already exists`

this is a quick fix, correct fix is to add non-default schema support but this way it will work at least
@esabol
Copy link
Member

esabol commented Dec 24, 2021

I don't have a problem with this change, but it probably should be noted somewhere that CREATE TABLE IF NOT EXISTS support requires PostgreSQL 9.1 or later. Not a big deal as 9.1 was released many years ago.

@spanasik
Copy link
Contributor Author

spanasik commented Dec 24, 2021

but it probably should be noted somewhere

@esabol sorry, do you mean to mention it in readme or what ? yes, 9.1 was released on 2011-09-12, more than 10 years ago

@esabol
Copy link
Member

esabol commented Dec 24, 2021

@esabol sorry, do you mean to mention it in readme or what ?

I don't know. I probably would've put it in a comment in the code. Maybe it just being mentioned in this issue is sufficient.

@spanasik
Copy link
Contributor Author

@esabol added comment in the code and note in summary

@SpamapS SpamapS merged commit 1d404f3 into gearman:master Jun 2, 2022
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

Successfully merging this pull request may close these issues.

3 participants