CreateTranscriptionEntities should return a 400 when the name is too large for index
Refs https://redmine.teklia.com/issues/9438
When a API user publishes super-long entity names, the index entity_list_index
does not support it (depending on value) and raise:
psycopg2.errors.ProgramLimitExceeded: index row size 2712 exceeds btree version 4 maximum 2704 for index "entity_list_index"
DETAIL: Index row references tuple (19369958,1) in relation "documents_entity".
HINT: Values larger than 1/3 of a buffer page cannot be indexed.
Consider a function index of an MD5 hash of the value, or use full text indexing.
As the max length is dynamic and depending on content, we cannot just limit on a specific length.
To be nicer with API users, we need to raise a 400 with an explicit error message when psycopg2.errors.ProgramLimitExceeded
is raised in that endpoint.
Please add an API unit test using content from the linked redmine issue (asserting a 400 is returned and no entities are created in DB)