Last active
          June 14, 2023 14:11 
        
      - 
      
- 
        Save toreriklinnerud/0f8d96f5bb3f85e84b95fd6c384d72b1 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | 1. Grab the DB dump | |
| curl -L "https://www.dropbox.com/s/k1ai0765gc2k98f/bug5.sql?dl=1" -o bug5.sql | |
| 2. Create an empty database and restore the dump and wait a bit: | |
| createdb bug5 && psql -d bug5 -f bug5.sql && psql -d bug5 -c "ANALYZE" | |
| 3. Run queries: | |
| psql -d bug5 -c "set enable_indexscan = 'off'; SELECT a.id FROM a JOIN b ON b.a_id = a.id JOIN c ON c.id = b.c_id WHERE c.tag = '13880'" | |
| 1 row expected, get 1 | |
| psql -d bug5 -c "set enable_indexscan = 'on'; SELECT a.id FROM a JOIN b ON b.a_id = a.id JOIN c ON c.id = b.c_id WHERE c.tag = '13880'" | |
| 1 row expected, get 0 | |
| If it doesn't reproduce, drop the DB and try again | |
| dropdb bug5 | |
        
      
            tadast
  
      
      
      commented 
        Jun 14, 2023 
      
    
  

  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment