gearman / gearmand

http://gearman.org/
Other
740 stars 137 forks source link

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

Open jaronwest opened 1 year ago

jaronwest commented 1 year ago

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

esabol commented 1 year ago

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 ?