There are "trade-offs" all around with respect to barrel length ... swing, balance, ease of handling in the overgrowth, etc. - however "patterning"
is not a criteria determined vis-a-vis barrel length .
The new Benelli 24"-barrelled 12 gauge "UltraLight" auto loader, for example, is IDENTICAL in overall length to a 28" Beretta 20 gauge Silver Pigeon "C" Over & Under. However, to me, the Benelli seems overly light (particularly for a 12 gauge) and balances very muzzle-light as well. The balance point is well behind the action closing button. "Swing" is almost non-existant with the Benelli... you have to continuously push the muzzle and consciously make the effort follow through - otherwise the gun just "stops". The Silver Pigeon on the other hand swings like a dream. It balances just barely ahead of the hinge pin. No matter the cost, brand, gauge or action , I'd take the balance and handling characteristics of the Silver Pigeon for an upland gun every time.
IMHO, Trap & Waterfowl guns tend to be more beneficial with 30" or 32" barrels that are balanced to be somewhat muzzle-heavy to encourage a deliberate move and sustained swing. Sporting Clays guns and Skeet guns are better balanced to be neutral, i.e., right between the hands. Over & Under Sporters today are generally at least 30", with 32" preferred and some finding favour with barrels out to 34". Semis tend to be either 28" or 30". Skeet guns are typically 28" or 30" O/U's, with a few experimenting with 32" guns, while semi-s are generally 26" or 28", with a few shooting 30-inchers.
The vast majority will find 28" O/U's or SxS's to have the optimum swing & balance for the Uplands, however, a few will favour other lenths between 25 and 30". Most semi-auto's and pumps with 24" or 26" will perform best in the uplands ... and like everything else, some will prefer barrels ranging from 21 to 30" . Find the optimum for you and your preferences for field and/or target application - in terms of ease of handling, swing & balance.
For a rifled slug gun, the most popular length choices seem to be 20"-24"