salsify/goldiloader

Identifier is too long

Closed this issue · 4 comments

Is it possible for me to shorten the length of the 'as' identifier to under 30 char, due to the fact of oracle having identifiers be under 30 char..

OCIError: ORA-00972: identifier is too long: SELECT "CR_AREAS".*, "T0"."CONTRACT_ID" AS ar_association_key_name_contract_id FROM "CR_AREAS" INNER JOIN "CR_AREAS_CONTRACTS" "T0" ON "CR_AREAS"."ID" = "T0"."AREA_ID" WHERE "T0"."CONTRACT_ID" IN (10437, 10438, 10428, 10429, 10543, 10552, 10553, 10555, 11532, 11495, 11419, 11601, 11602, 11615, 11617, 11619, 11432, 11518, 11852, 11855, 11877, 11878, 11879, 11880, 11901, 11908, 12396, 11951, 11909, 11778, 11819, 11438, 11443, 12266, 12267, 12268, 12269, 12273, 12289, 12291, 12292, 12299, 12300, 12306, 12307, 11986, 11823, 11822, 11824, 11825, 11829, 11830, 12108, 12619, 12839, 12842, 12871, 12872, 12873, 12874, 12880, 12898, 12899, 12760, 12796, 12544, 12517, 12537, 12565, 12454, 12655, 12721, 12768, 10006, 10010, 10011, 13326, 13346, 13351, 13352, 13366, 13171, 13172, 13193, 13194, 13195, 13196, 13197, 13198, 13199, 13200, 13201, 1, 13248, 13267, 13446, 12953, 12971, 13388, 13389, 13390, 13405, 12911, 13408, 13409, 13154, 13489, 13490, 13491, 13492, 13484, 13485, 13486, 13487, 13100, 12955, 12957, 12960, 13107, 13108, 13109, 13110, 13111, 13112, 13113, 13115, 13041, 13266, 13325)

This SQL is generated by ActiveRecord. Do you get the same error if you try to eager load this association via an includes without Goldiloader?

It works with includes, but using Goldiloader it gives my 'as' identifier to many chars. @jturkel

@Jrsnow8921 - Hmm. That's strange. Goldiloader doesn't generate any SQL. It just uses the Rails ActiveRecord::Associations::Preloader class which is the same thing Rails uses to process an eager load via includes. (See https://github.com/salsify/goldiloader/blob/master/lib/goldiloader/association_loader.rb#L23 if you're curious for more details). Do you have a reproducible test case I can take a look at?

@jturkel Well I had a a duh moment, and was testing the include in a different model than the one I was having problems with. Needless to say I just shortened my column names down and it worked, thanks for your help!