That is the law in many places, California being one. Companies generally own anything you do related to their business. Related is up to a judge to decide if it gets to that point but some arguably obvious examples: making a game on the side while working for a game company. Making an email website while working for a company that makes an email website.
Why it makes sense IMO. Without the company owning work related to their business outside of work hours that would seem to make something along these lines legal.
Employee is at home, after work hours, and thinks of solution to problem at work on his project. The next day he comes to work and demands if the company wants this solution he must be compensated for work he did on his own time that belongs to him.
Your bartender case I have no idea how a judge would take that. The judge might see it as common sense. On the other hand if the bartender took a second job bartending a judge might decide that's not okay. Examples: Bartender invents new drink in Bar #2. Does Bar #2 own that? Can Bar #2 trademark the new drink? Can Bar #1 claim bartender has a conflict of interest because while working at Bar #2 it's arguably his job to lure people away from Bar #1.
Here's a quote from Nolo: "
Moonlighting
Generally speaking, working more than one job is lawful. However, an employer has the right to limit after-hours work that is in conflict with the employer's own business. For instance, going to work for the competition could provide grounds for discipline or discharge.
"
http://www.nolo.com/legal-encyclopedia/off-duty-conduct-empl...
Here's another
"Employees Owe a Duty of Loyalty to Their Employers
...
Thus, an employee who improperly competes with his employer, assists a competitor during the course of employment, or makes use of the employer's confidential information to compete with the employer after termination may have breached the duty of loyalty.
"
etc..
http://shawvalenza.com/publications.php?id=68