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

When using Postgres for persistent tasks, check if libpq-table includes schema name #383

Open
jaronwest opened this issue Nov 21, 2023 · 1 comment

Comments

@jaronwest
Copy link

jaronwest commented Nov 21, 2023

When running gearman using Postgres, currently only the default schema can be used when specifying the table name.
If --libpq-table=someschema.gearman_table were used it would correctly generate the table on deploy in the specified schema, but the next time it is run again, it will check for table name in INFORMATION_SCHEMA.TABLES rather than breaking it into schema and table name, then generate an error that the resource already exists when it tries to create it.
A possible fix is to check before this query if the table name contains a dot (.) character and if so, break it apart and run query as TABLE_SCHEMA = and TABLE_NAME =
https://github.com/gearman/gearmand/blob/master/libgearman-server/plugins/queue/postgres/queue.cc#L207

@jaronwest jaronwest changed the title When using Postgres for persistent tasks, check if libpg-table includes schema name When using Postgres for persistent tasks, check if libpq-table includes schema name Nov 21, 2023
@esabol
Copy link
Member

esabol commented Nov 21, 2023

A possible fix is to check before this query if the table name contains a dot (.) character and if so, break it apart and run query as TABLE_SCHEMA = and TABLE_NAME =
https://github.com/gearman/gearmand/blob/master/libgearman-server/plugins/queue/postgres/queue.cc#L207

Yep. Would you be willing to contribute a PR to do that, @jaronwest ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants