1

I'm trying to implement the Simple Avatar Uploader on my User domain class but I seem to have encountered a conflicting issue with grails implementation of byte[] and PostgreSQL. I have implemented it exactly as the plugin page suggests but on compilation I get the error:

Error: Error executing SQL ALTER TABLE user ADD avatar bytea(16384): ERROR: type modifier is not allowed for type "bytea"

I have found some help suggesting that PostgreSQL does not accept a size modifier but removing the maxSize: 16384 constraint only leads to the exact same error with a different size:

Error: Error executing SQL ALTER TABLE user ADD avatar bytea(255): ERROR: type modifier is not allowed for type "bytea"

So it seems that grails will automatically set the size to 255 if no maxSize is provided. Is there a way to override this? Or perhaps a more suitable data type for byte arrays?

Thanks!

1 Answer 1

1

Not sure if it was directly responsible or not but we are using Grails Database Migration and we solved the issue by editing the latest migration script changing the line

column(name: "avatar", type: "bytea(255)")

to

column(name: "avatar", type: "bytea")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.