|   | 38 | 2. | 
          
          
            |   | 39 |  Consider the following models: | 
          
          
            |   | 40 |   | 
          
          
            |   | 41 | {{{ | 
          
          
            |   | 42 | class A(models.Model): | 
          
          
            |   | 43 |     field1 = models.IntegerField() | 
          
          
            |   | 44 |  | 
          
          
            |   | 45 | class B(A): | 
          
          
            |   | 46 |      field2 = models.IntegerField() | 
          
          
            |   | 47 |   | 
          
          
            |   | 48 | class C(B): | 
          
          
            |   | 49 |     field_c = models.IntegerField() | 
          
          
            |   | 50 | }}} | 
          
          
            |   | 51 |  | 
          
          
            |   | 52 | {{{ | 
          
          
            |   | 53 | queryset = C.objects.all().select_for_update(of=('b_ptr', 'b_ptr__a_ptr')) | 
          
          
            |   | 54 | }}} | 
          
          
            |   | 55 |   | 
          
          
            |   | 56 | The above queryset crashes with the following crashlog:  | 
          
          
            |   | 57 |  | 
          
          
            |   | 58 | {{{ | 
          
          
            |   | 59 | Traceback (most recent call last): | 
          
          
            |   | 60 |   File "/home/abhijeet/git-repos/django/django/core/management/base.py", line 328, in run_from_argv | 
          
          
            |   | 61 |     self.execute(*args, **cmd_options) | 
          
          
            |   | 62 |   File "/home/abhijeet/git-repos/django/django/core/management/base.py", line 369, in execute | 
          
          
            |   | 63 |    output = self.handle(*args, **options) | 
          
          
            |   | 64 |   File "/home/abhijeet/django_contrib/selectforupdate/management/commands/debug.py", line 12, in handle | 
          
          
            |   | 65 |     print(queryset.query) | 
          
          
            |   | 66 |   File "/home/abhijeet/git-repos/django/django/db/models/sql/query.py", line 257, in __str__ | 
          
          
            |   | 67 |     sql, params = self.sql_with_params() | 
          
          
            |   | 68 |   File "/home/abhijeet/git-repos/django/django/db/models/sql/query.py", line 265, in sql_with_params | 
          
          
            |   | 69 |     return self.get_compiler(DEFAULT_DB_ALIAS).as_sql() | 
          
          
            |   | 70 |   File "/home/abhijeet/git-repos/django/django/db/models/sql/compiler.py", line 555, in as_sql | 
          
          
            |   | 71 |     of=self.get_select_for_update_of_arguments(), | 
          
          
            |   | 72 |   File "/home/abhijeet/git-repos/django/django/db/models/sql/compiler.py", line 1036, in get_select_for_update_of_arguments | 
          
          
            |   | 73 |     select_index = klass_info['select_fields'][0] | 
          
          
            |   | 74 | IndexError: list index out of range | 
          
          
            |   | 75 | }}} | 
          
          
            |   | 76 |  |