Project

General

Profile

Defect #37268 » sql_with_visible_condition.sql

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

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