﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
33435	Since django 3.0 Subquery.as_sql() generates invalid SQL	M1ha Shvn	nobody	"Since [https://github.com/django/django/commit/3a505c70e7b228bf1212c067a8f38271ca86ce09 this commit] `Subquery.as_sql(...)` method returns incorrect SQL removing first and last symbols instead of absent breakets:


{{{
from django.db import connection
from apps.models import App

q = Subquery(App.objects.all())

print(str(q.query))

# Output SQL is valid:
#  'SELECT ""apps_app"".""id"", ""apps_app"".""name"" FROM ""apps_app""'

print(q.as_sql(q.query.get_compiler('default'), connection))

# Outptut SQL is invalid (no S letter at the beggining and "" symbol at the end):
# ('(ELECT ""apps_app"".""id"", ""apps_app"".""name"" FROM ""apps_app)', ())
}}}

"	Bug	new	Database layer (models, ORM)	dev	Normal		subquery, as_sql		Unreviewed	0	0	0	0	0	0
