JarickCWAL's writeup is correct for 1st and 2nd Edition AD&D. However, in Dungeons and Dragons Third Edition the spell has some actual limits. Which I find somewhat refreshing as a game master, and the spell has actually become one that I wouldn't cringe to hear one of my players cast.
- Wish can duplicate any spell cast by an arcane spellcaster of eighth level or less. (as long as its not from a prohibited school, such as a specialist wizard would have.)
- It can duplicate any spell (arcane or divine) of sixth level or lower. (as long as its not a prohibited school.)
- It can duplicate any spell, even a prohibited school spell, of fifth level or lower.
- It can undo the harmful effects of a geas/quest spell, or insanity, remove injuries or afflictions (one wish per type, so one wish removes all poisons in all your party, and another can cure them all of all hit point damage), revive the dead (the person raised loses a level of experience, or a constitution point if only first level), or undo the misfortune of a single event (allowing you to reroll a save, damage roll, etc).
- It can create an item (permanently) of 15,000gp value or less (it doesn't seem like a lot, but it's well within the power of a ninth level spell)
- It can transport people
- Give a permanent +1 bonus to any stat (two applications together can give +2, three applications together can give +3, and so on.) This is an "inherent bonus", and the rule in D&D 3ed is that same-named bonuses do not stack. So, if something else were to grant an inherent bonus (such as various books that you can find), only the highest bonus takes effect
Anything that is outside of this rather impressive list would require a ruling by the GM. He can feel free to just say "no" or to have it fulfilled in a devious fashion. The description for the spell actually says that anything not on the list would be dangerous to wish for.
The spell requires a permanent expenditure of 5000xp, which is no trivial amount. It is a powerful spell for sure, but considering that it is only available to a 17th level wizard, or an 18th level sorcerer, and even then only to one with a 19 ability score (intelligence for wizards, charisma for sorcerers), it has definitely become a balanced spell.