dosubot[bot] commented on issue #8275: URL: https://github.com/apache/incubator-devlake/issues/8275#issuecomment-2603092221
<!-- Answer --> The issue you're encountering seems to be related to the handling of the `Regex` field in PostgreSQL, specifically with the `bytea` type. This type is used for storing binary data, and it appears that the string is not being properly escaped or encoded for PostgreSQL, leading to the error. To address this, you might consider using a `BeforeUpdate` GORM hook to transform the regex pattern before saving it to the database. This hook can be used to ensure that the data is properly formatted for PostgreSQL. Here's a basic example of how you might implement such a hook: ```go func (config *JiraScopeConfig) BeforeUpdate(tx *gorm.DB) (err error) { // Transform the Regex field to ensure it's properly formatted for PostgreSQL config.Regex = transformRegexForPostgreSQL(config.Regex) return nil } func transformRegexForPostgreSQL(regex string) string { // Implement your transformation logic here // For example, you might escape certain characters or encode the string return regex } ``` This is a simplified example, and you'll need to implement the actual transformation logic based on your specific requirements. Additionally, ensure that the `Regex` field is stored as a string type in the database schema, rather than `bytea`, if it is intended to store text data. If you have existing migration scripts, you might also want to check if the `Regex` field is defined with the correct data type for PostgreSQL. Adjusting the schema might be necessary if the field is currently set to `bytea` and should be a text type instead. If you decide to proceed with a pull request, make sure to test the changes thoroughly to ensure compatibility with both MySQL and PostgreSQL. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/e547aa77-62e1-406f-aec9-18a9f97acc11?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/e547aa77-62e1-406f-aec9-18a9f97acc11?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/e547aa77-62e1-406f-aec9-18a9f97acc11?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/e547aa77-62e1-406f-aec9-18a9f97acc11?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/e547aa77-62e1-406f-aec9-18a9f97acc11?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/e547aa77-62e1-406f-aec9-18a9f97acc11?feedback_type=other)</sup> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@devlake.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org