I'd say anything longer than 2 months, and autolysis becomes a risk. There's a bit of controversy here, and everyone has their own magic number for when to rack out of primary. Really, you're not likely to see much, if any, benefit from leaving your beer in primary longer than ~6 weeks. If it absolutely has to be crystal clear (blonde, kolsch, pale ale, etc...) use fining agents in the boil, gelatin, and/or rack to secondary after a month or so.
FWIW: my magic number is 1 month.