I recently had a problem while working with Puppet exported resources.  The problem is, at this time, PuppetDB does
not support environments.  This results in any exported resources belonging to ALL your environments!
The fix.
First I updated my manifests to add a tag to my exported resources indicating the environment they are in.
Second, I updated PuppetDB’s catalog_resources table adding the new environment tag to all the existing resources.
Here is the SQL I used:
UPDATE catalog_resources
SET tags = array_append(catalog_resources.tags,concat('env_', substring(catalogs.certname,1,2)))
FROM catalogs
WHERE catalogs.id = catalog_resources.catalog_id
AND catalog_resources.exported = true

Now in my case, all my host names happen to start with the environment they are in so I used the host certificate name to generate the tag.