Changes between Version 3 and Version 4 of Ticket #32690, comment 3


Ignore:
Timestamp:
Apr 28, 2021, 7:33:27 PM (3 years ago)
Author:
allen-munsch

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #32690, comment 3

    v3 v4  
    55Yes. Let me know if there is anything else that I can help with in the reproduction.
    66
    7 edit: added the attachment
    8 
    9 edit2:
    10 
    11 Inside of the ticket32690.django.proj.tar.gz readme.md, also my bad, the RealmAccess field for "property_group" should have been renamed, and migrated:
     7Inside of the ticket32690.django.proj.tar.gz readme.md:
    128
    139
     
    3228From inside the django shell
    3329
    34 ```example
    35 07:11:24 (.env) jmunsch@pop-os ticket32690 → ./manage.py shell
     30```
     3107:30:35 (.env) jmunsch@pop-os ticket32690 → ./manage.py shell
    3632Python 3.8.9 (default, Apr 14 2021, 18:54:59)
    3733[GCC 9.3.0] on linux
     
    5854       "things_thing"."actor_id",
    5955       "things_thing"."realms",
    60        COUNT("things_actorrealmaccess"."property_group_id") AS "actor__realm_access__count"
     56       COUNT("things_actorrealmaccess"."realm_access_id") AS "actor__realm_access__count"
    6157FROM "things_thing"
    6258INNER JOIN "things_actor" ON ("things_thing"."actor_id" = "things_actor"."id")
     
    6460LEFT OUTER JOIN "things_actorrealmaccess" T5 ON ("things_actor"."id" = T5."actor_id")
    6561GROUP BY "things_thing"."id",
    66          T5."property_group_id",
     62         T5."realm_access_id",
    6763  (SELECT U0."id",
    6864          U0."created",
     
    7268          U0."name"
    7369   FROM "things_realmaccess" U0
    74    INNER JOIN "things_actorrealmaccess" U1 ON (U0."id" = U1."property_group_id")
     70   INNER JOIN "things_actorrealmaccess" U1 ON (U0."id" = U1."realm_access_id")
    7571   WHERE U1."actor_id" = 2)
    76 HAVING (T5."property_group_id" IN
     72HAVING (T5."realm_access_id" IN
    7773          (SELECT U0."id"
    7874           FROM "things_realmaccess" U0
    79            INNER JOIN "things_actorrealmaccess" U1 ON (U0."id" = U1."property_group_id")
     75           INNER JOIN "things_actorrealmaccess" U1 ON (U0."id" = U1."realm_access_id")
    8076           WHERE U1."actor_id" = 2)
    81         OR COUNT("things_actorrealmaccess"."property_group_id") = 0)
     77        OR COUNT("things_actorrealmaccess"."realm_access_id") = 0)
    8278Traceback (most recent call last):
    8379  File "/home/jmunsch/PycharmProjects/test-django/.env/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    8480    return self.cursor.execute(sql, params)
    8581psycopg2.errors.SyntaxError: subquery must return only one column
    86 LINE 1: ...P BY "things_thing"."id", T5."property_group_id", (SELECT U0...
     82LINE 1: ...OUP BY "things_thing"."id", T5."realm_access_id", (SELECT U0...
    8783                                                             ^
     84
     85
     86The above exception was the direct cause of the following exception:
     87
     88Traceback (most recent call last):
     89  File "<console>", line 1, in <module>
     90  File "/home/jmunsch/PycharmProjects/test-django/.env/lib/python3.8/site-packages/django/db/models/query.py", line 256, in __repr__
     91    data = list(self[:REPR_OUTPUT_SIZE + 1])
     92  File "/home/jmunsch/PycharmProjects/test-django/.env/lib/python3.8/site-packages/django/db/models/query.py", line 262, in __len__
     93    self._fetch_all()
     94  File "/home/jmunsch/PycharmProjects/test-django/.env/lib/python3.8/site-packages/django/db/models/query.py", line 1324, in _fetch_all
     95    self._result_cache = list(self._iterable_class(self))
     96  File "/home/jmunsch/PycharmProjects/test-django/.env/lib/python3.8/site-packages/django/db/models/query.py", line 51, in __iter__
     97    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
     98  File "/home/jmunsch/PycharmProjects/test-django/.env/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1169, in execute_sql
     99    cursor.execute(sql, params)
     100  File "/home/jmunsch/PycharmProjects/test-django/.env/lib/python3.8/site-packages/django/db/backends/utils.py", line 98, in execute
     101    return super().execute(sql, params)
     102  File "/home/jmunsch/PycharmProjects/test-django/.env/lib/python3.8/site-packages/django/db/backends/utils.py", line 66, in execute
     103    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
     104  File "/home/jmunsch/PycharmProjects/test-django/.env/lib/python3.8/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
     105    return executor(sql, params, many, context)
     106  File "/home/jmunsch/PycharmProjects/test-django/.env/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
     107    return self.cursor.execute(sql, params)
     108  File "/home/jmunsch/PycharmProjects/test-django/.env/lib/python3.8/site-packages/django/db/utils.py", line 90, in __exit__
     109    raise dj_exc_value.with_traceback(traceback) from exc_value
     110  File "/home/jmunsch/PycharmProjects/test-django/.env/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
     111    return self.cursor.execute(sql, params)
     112django.db.utils.ProgrammingError: subquery must return only one column
     113LINE 1: ...OUP BY "things_thing"."id", T5."realm_access_id", (SELECT U0...
     114                                                             ^
     115
     116>>>
     117
    88118```
     119
    89120}}}
    90121
Back to Top