Index on "index_oauth_access_tokens_on_token" fails on Postgres
qnm opened this issue · 2 comments
When a user creates an oauth token, the following error is being generated by Postgres:
ERROR: index row size [NUMBER] exceeds maximum [NUMBER] for index "index_oauth_access_tokens_on_token" HINT: Values larger than [NUMBER]/[NUMBER] of a buffer page cannot be indexed. Consider a function index of an MD5 hash of the value, or use full text indexing.
The error seems to occur due to the btree index used on token
, as btree indexes can't handle data with more that 2713 bytes.
This doesn't seem to occur using doorkeeper without doorkeeper-jwt.
I've resolved the issue by replacing the hashing function of the index with an md5 function, which I've detailed on the doorkeeper wiki.
There should probably be a reference to the issue over here, for the benefit of future doorkeeper-jwt users. I'm happy for you to either reference the doorkeeper wiki, or to copy the solution - up to you.
Sorry for the delay in responding to this - no excuse for it.
Thanks for figuring this out and writing up a solution. What do you think would be the best way to reference the issue? What would make the most sense to you if you came across it?
I'd likely find this through the error itself. Certainly that's what led me to the solution.