Project

General

Profile

Defect #37268 » sql_without_visible_condition.sql

Marius BĂLTEANU, 2022-06-27 20:52

 
1

    
2
SELECT "issues"."id" AS T0_R0,
3
	"issues"."tracker_id" AS T0_R1,
4
	"issues"."project_id" AS T0_R2,
5
	"issues"."subject" AS T0_R3,
6
	"issues"."description" AS T0_R4,
7
	"issues"."due_date" AS T0_R5,
8
	"issues"."category_id" AS T0_R6,
9
	"issues"."status_id" AS T0_R7,
10
	"issues"."assigned_to_id" AS T0_R8,
11
	"issues"."priority_id" AS T0_R9,
12
	"issues"."fixed_version_id" AS T0_R10,
13
	"issues"."author_id" AS T0_R11,
14
	"issues"."lock_version" AS T0_R12,
15
	"issues"."created_on" AS T0_R13,
16
	"issues"."updated_on" AS T0_R14,
17
	"issues"."start_date" AS T0_R15,
18
	"issues"."done_ratio" AS T0_R16,
19
	"issues"."estimated_hours" AS T0_R17,
20
	"issues"."parent_id" AS T0_R18,
21
	"issues"."root_id" AS T0_R19,
22
	"issues"."lft" AS T0_R20,
23
	"issues"."rgt" AS T0_R21,
24
	"issues"."is_private" AS T0_R22,
25
	"issues"."closed_on" AS T0_R23,
26
	"issue_statuses"."id" AS T1_R0,
27
	"issue_statuses"."name" AS T1_R1,
28
	"issue_statuses"."is_closed" AS T1_R2,
29
	"issue_statuses"."position" AS T1_R3,
30
	"issue_statuses"."default_done_ratio" AS T1_R4,
31
	"projects"."id" AS T2_R0,
32
	"projects"."name" AS T2_R1,
33
	"projects"."description" AS T2_R2,
34
	"projects"."homepage" AS T2_R3,
35
	"projects"."is_public" AS T2_R4,
36
	"projects"."parent_id" AS T2_R5,
37
	"projects"."created_on" AS T2_R6,
38
	"projects"."updated_on" AS T2_R7,
39
	"projects"."identifier" AS T2_R8,
40
	"projects"."status" AS T2_R9,
41
	"projects"."lft" AS T2_R10,
42
	"projects"."rgt" AS T2_R11,
43
	"projects"."inherit_members" AS T2_R12,
44
	"projects"."default_version_id" AS T2_R13,
45
	"projects"."default_assigned_to_id" AS T2_R14,
46
	"projects"."default_issue_query_id" AS T2_R15
47
FROM "issues"
48
INNER JOIN "projects" ON "projects"."id" = "issues"."project_id"
49
INNER JOIN "issue_statuses" ON "issue_statuses"."id" = "issues"."status_id"
50
WHERE (PROJECTS.STATUS <> 9
51
							AND PROJECTS.STATUS <> 10
52
							AND EXISTS
53
								(SELECT 1 AS ONE
54
									FROM ENABLED_MODULES EM
55
									WHERE EM.PROJECT_ID = PROJECTS.ID
56
										AND EM.NAME = 'issue_tracking'))
57
	AND ((ISSUES.STATUS_ID IN
58
								(SELECT ID
59
									FROM ISSUE_STATUSES
60
									WHERE IS_CLOSED = FALSE))
61
						AND ISSUES.ID IN
62
							(SELECT ISSUES.ID
63
								FROM ISSUES
64
								LEFT OUTER JOIN CUSTOM_VALUES ON CUSTOM_VALUES.CUSTOMIZED_TYPE = 'Issue'
65
								AND CUSTOM_VALUES.CUSTOMIZED_ID = ISSUES.ID
66
								AND CUSTOM_VALUES.CUSTOM_FIELD_ID = 13
67
								WHERE (CUSTOM_VALUES.VALUE ILIKE '%text%')
68
									AND (((1 = 1)
69
															AND (ISSUES.TRACKER_ID IN
70
																					(SELECT TRACKER_ID
71
																						FROM CUSTOM_FIELDS_TRACKERS
72
																						WHERE CUSTOM_FIELD_ID = 13))
73
															AND (EXISTS
74
																					(SELECT 1
75
																						FROM CUSTOM_FIELDS IFA
76
																						WHERE IFA.IS_FOR_ALL = TRUE
77
																							AND IFA.ID = 13)
78
																				OR ISSUES.PROJECT_ID IN
79
																					(SELECT PROJECT_ID
80
																						FROM CUSTOM_FIELDS_PROJECTS
81
																						WHERE CUSTOM_FIELD_ID = 13))))))
82
ORDER BY ISSUES.ID
(7-7/10)