Yep, that's how it works. If you put a gem in two groups (production AND heroku) and you only skip one of them (heroku), you will still get every gem that is in production. Naturally.
No, that's not what you're doing. This puts the 'pg' gem in BOTH production and heroku groups:
group :production, :heroku do
If you then run `bundle install --without heroku`, it will of course install pg, because you are asking bundler to install the production group (which pg is also in).