QuerySet.union() with queryset that raises EmptyResultSet results in an empty set
    
    
    
      
      
      
        
Similar and followup to ticket #28293. Tested on Django 1.11.3.
As QuerySet.union() uses the SQL UNION operator, I would expect "SET1 UNION <EMPTY SET>" to result in SET1. If the empty set is the results of EmpytResultSet being raised, the .union() result is an empty set, not SET1.
Example test case:
>>> import django
>>> django.__version__
'1.11.3'
>>> from django.contrib.auth.models import User
>>> qs1 = User.objects.all() 
>>> qs1.count()
100
>>> qs2 = User.objects.filter(pk__in=[])
>>> qs2.count()
0
>>> list(qs1.union(qs2))
[]
       
     
   
 
      
        
        
          Change History
          (10)
        
          
  
  
  
    
      | Severity: | 
      
        Normal → Release blocker
       | 
    
    
      | Triage Stage: | 
      
        Unreviewed → Accepted
       | 
    
  
 
           
          
          
          
  
  
  
    
      | Cc: | 
      
        Mariusz Felisiak added
       | 
    
  
 
           
          
  
  
  
    
      | Description: | 
      
        modified (diff)
       | 
    
  
 
           
          
  
  
  
    
      | Owner: | 
      
        changed from nobody to Mariusz Felisiak
       | 
    
    
      | Status: | 
      
        new → assigned
       | 
    
  
 
           
          
          
  
  
  
    
      | Triage Stage: | 
      
        Accepted → Ready for checkin
       | 
    
  
 
           
          
  
  
  
    
      | Resolution: | 
      
        → fixed
       | 
    
    
      | Status: | 
      
        assigned → closed
       | 
    
  
 
           
          
          
         
       
     
        
    
    
differenceis also affected.