37 schema['state_of'].inlined = False |
37 schema['state_of'].inlined = False |
38 schema['comments'].inlined = False |
38 schema['comments'].inlined = False |
39 |
39 |
40 PARSER = [ |
40 PARSER = [ |
41 (r"Personne P WHERE P nom 'Zig\'oto';", |
41 (r"Personne P WHERE P nom 'Zig\'oto';", |
42 '''SELECT P.cw_eid |
42 '''SELECT _P.cw_eid |
43 FROM cw_Personne AS P |
43 FROM cw_Personne AS _P |
44 WHERE P.cw_nom=Zig\'oto'''), |
44 WHERE _P.cw_nom=Zig\'oto'''), |
45 |
45 |
46 (r'Personne P WHERE P nom ~= "Zig\"oto%";', |
46 (r'Personne P WHERE P nom ~= "Zig\"oto%";', |
47 '''SELECT P.cw_eid |
47 '''SELECT _P.cw_eid |
48 FROM cw_Personne AS P |
48 FROM cw_Personne AS _P |
49 WHERE P.cw_nom ILIKE Zig"oto%'''), |
49 WHERE _P.cw_nom ILIKE Zig"oto%'''), |
50 ] |
50 ] |
51 |
51 |
52 BASIC = [ |
52 BASIC = [ |
53 |
53 |
|
54 ("Any AS WHERE AS is Affaire", |
|
55 '''SELECT _AS.cw_eid |
|
56 FROM cw_Affaire AS _AS'''), |
|
57 |
54 ("Any X WHERE X is Affaire", |
58 ("Any X WHERE X is Affaire", |
55 '''SELECT X.cw_eid |
59 '''SELECT _X.cw_eid |
56 FROM cw_Affaire AS X'''), |
60 FROM cw_Affaire AS _X'''), |
57 |
61 |
58 ("Any X WHERE X eid 0", |
62 ("Any X WHERE X eid 0", |
59 '''SELECT 0'''), |
63 '''SELECT 0'''), |
60 |
64 |
61 ("Personne P", |
65 ("Personne P", |
62 '''SELECT P.cw_eid |
66 '''SELECT _P.cw_eid |
63 FROM cw_Personne AS P'''), |
67 FROM cw_Personne AS _P'''), |
64 |
68 |
65 ("Personne P WHERE P test TRUE", |
69 ("Personne P WHERE P test TRUE", |
66 '''SELECT P.cw_eid |
70 '''SELECT _P.cw_eid |
67 FROM cw_Personne AS P |
71 FROM cw_Personne AS _P |
68 WHERE P.cw_test=TRUE'''), |
72 WHERE _P.cw_test=TRUE'''), |
69 |
73 |
70 ("Personne P WHERE P test false", |
74 ("Personne P WHERE P test false", |
71 '''SELECT P.cw_eid |
75 '''SELECT _P.cw_eid |
72 FROM cw_Personne AS P |
76 FROM cw_Personne AS _P |
73 WHERE P.cw_test=FALSE'''), |
77 WHERE _P.cw_test=FALSE'''), |
74 |
78 |
75 ("Personne P WHERE P eid -1", |
79 ("Personne P WHERE P eid -1", |
76 '''SELECT -1'''), |
80 '''SELECT -1'''), |
77 |
81 |
78 ("Personne P LIMIT 20 OFFSET 10", |
82 ("Personne P LIMIT 20 OFFSET 10", |
79 '''SELECT P.cw_eid |
83 '''SELECT _P.cw_eid |
80 FROM cw_Personne AS P |
84 FROM cw_Personne AS _P |
81 LIMIT 20 |
85 LIMIT 20 |
82 OFFSET 10'''), |
86 OFFSET 10'''), |
83 |
87 |
84 ("Personne P WHERE S is Societe, P travaille S, S nom 'Logilab';", |
88 ("Personne P WHERE S is Societe, P travaille S, S nom 'Logilab';", |
85 '''SELECT rel_travaille0.eid_from |
89 '''SELECT rel_travaille0.eid_from |
86 FROM cw_Societe AS S, travaille_relation AS rel_travaille0 |
90 FROM cw_Societe AS _S, travaille_relation AS rel_travaille0 |
87 WHERE rel_travaille0.eid_to=S.cw_eid AND S.cw_nom=Logilab'''), |
91 WHERE rel_travaille0.eid_to=_S.cw_eid AND _S.cw_nom=Logilab'''), |
88 |
92 |
89 ("Personne P WHERE P concerne A, A concerne S, S nom 'Logilab', S is Societe;", |
93 ("Personne P WHERE P concerne A, A concerne S, S nom 'Logilab', S is Societe;", |
90 '''SELECT rel_concerne0.eid_from |
94 '''SELECT rel_concerne0.eid_from |
91 FROM concerne_relation AS rel_concerne0, concerne_relation AS rel_concerne1, cw_Societe AS S |
95 FROM concerne_relation AS rel_concerne0, concerne_relation AS rel_concerne1, cw_Societe AS _S |
92 WHERE rel_concerne0.eid_to=rel_concerne1.eid_from AND rel_concerne1.eid_to=S.cw_eid AND S.cw_nom=Logilab'''), |
96 WHERE rel_concerne0.eid_to=rel_concerne1.eid_from AND rel_concerne1.eid_to=_S.cw_eid AND _S.cw_nom=Logilab'''), |
93 |
97 |
94 ("Note N WHERE X evaluee N, X nom 'Logilab';", |
98 ("Note N WHERE X evaluee N, X nom 'Logilab';", |
95 '''SELECT rel_evaluee0.eid_to |
99 '''SELECT rel_evaluee0.eid_to |
96 FROM cw_Division AS X, evaluee_relation AS rel_evaluee0 |
100 FROM cw_Division AS _X, evaluee_relation AS rel_evaluee0 |
97 WHERE rel_evaluee0.eid_from=X.cw_eid AND X.cw_nom=Logilab |
101 WHERE rel_evaluee0.eid_from=_X.cw_eid AND _X.cw_nom=Logilab |
98 UNION ALL |
102 UNION ALL |
99 SELECT rel_evaluee0.eid_to |
103 SELECT rel_evaluee0.eid_to |
100 FROM cw_Personne AS X, evaluee_relation AS rel_evaluee0 |
104 FROM cw_Personne AS _X, evaluee_relation AS rel_evaluee0 |
101 WHERE rel_evaluee0.eid_from=X.cw_eid AND X.cw_nom=Logilab |
105 WHERE rel_evaluee0.eid_from=_X.cw_eid AND _X.cw_nom=Logilab |
102 UNION ALL |
106 UNION ALL |
103 SELECT rel_evaluee0.eid_to |
107 SELECT rel_evaluee0.eid_to |
104 FROM cw_Societe AS X, evaluee_relation AS rel_evaluee0 |
108 FROM cw_Societe AS _X, evaluee_relation AS rel_evaluee0 |
105 WHERE rel_evaluee0.eid_from=X.cw_eid AND X.cw_nom=Logilab |
109 WHERE rel_evaluee0.eid_from=_X.cw_eid AND _X.cw_nom=Logilab |
106 UNION ALL |
110 UNION ALL |
107 SELECT rel_evaluee0.eid_to |
111 SELECT rel_evaluee0.eid_to |
108 FROM cw_SubDivision AS X, evaluee_relation AS rel_evaluee0 |
112 FROM cw_SubDivision AS _X, evaluee_relation AS rel_evaluee0 |
109 WHERE rel_evaluee0.eid_from=X.cw_eid AND X.cw_nom=Logilab'''), |
113 WHERE rel_evaluee0.eid_from=_X.cw_eid AND _X.cw_nom=Logilab'''), |
110 |
114 |
111 ("Note N WHERE X evaluee N, X nom in ('Logilab', 'Caesium');", |
115 ("Note N WHERE X evaluee N, X nom in ('Logilab', 'Caesium');", |
112 '''SELECT rel_evaluee0.eid_to |
116 '''SELECT rel_evaluee0.eid_to |
113 FROM cw_Division AS X, evaluee_relation AS rel_evaluee0 |
117 FROM cw_Division AS _X, evaluee_relation AS rel_evaluee0 |
114 WHERE rel_evaluee0.eid_from=X.cw_eid AND X.cw_nom IN(Logilab, Caesium) |
118 WHERE rel_evaluee0.eid_from=_X.cw_eid AND _X.cw_nom IN(Logilab, Caesium) |
115 UNION ALL |
119 UNION ALL |
116 SELECT rel_evaluee0.eid_to |
120 SELECT rel_evaluee0.eid_to |
117 FROM cw_Personne AS X, evaluee_relation AS rel_evaluee0 |
121 FROM cw_Personne AS _X, evaluee_relation AS rel_evaluee0 |
118 WHERE rel_evaluee0.eid_from=X.cw_eid AND X.cw_nom IN(Logilab, Caesium) |
122 WHERE rel_evaluee0.eid_from=_X.cw_eid AND _X.cw_nom IN(Logilab, Caesium) |
119 UNION ALL |
123 UNION ALL |
120 SELECT rel_evaluee0.eid_to |
124 SELECT rel_evaluee0.eid_to |
121 FROM cw_Societe AS X, evaluee_relation AS rel_evaluee0 |
125 FROM cw_Societe AS _X, evaluee_relation AS rel_evaluee0 |
122 WHERE rel_evaluee0.eid_from=X.cw_eid AND X.cw_nom IN(Logilab, Caesium) |
126 WHERE rel_evaluee0.eid_from=_X.cw_eid AND _X.cw_nom IN(Logilab, Caesium) |
123 UNION ALL |
127 UNION ALL |
124 SELECT rel_evaluee0.eid_to |
128 SELECT rel_evaluee0.eid_to |
125 FROM cw_SubDivision AS X, evaluee_relation AS rel_evaluee0 |
129 FROM cw_SubDivision AS _X, evaluee_relation AS rel_evaluee0 |
126 WHERE rel_evaluee0.eid_from=X.cw_eid AND X.cw_nom IN(Logilab, Caesium)'''), |
130 WHERE rel_evaluee0.eid_from=_X.cw_eid AND _X.cw_nom IN(Logilab, Caesium)'''), |
127 |
131 |
128 ("Any X WHERE X creation_date TODAY, X is Affaire", |
132 ("Any X WHERE X creation_date TODAY, X is Affaire", |
129 '''SELECT X.cw_eid |
133 '''SELECT _X.cw_eid |
130 FROM cw_Affaire AS X |
134 FROM cw_Affaire AS _X |
131 WHERE DATE(X.cw_creation_date)=CURRENT_DATE'''), |
135 WHERE DATE(_X.cw_creation_date)=CURRENT_DATE'''), |
132 |
136 |
133 ("Any N WHERE G is CWGroup, G name N, E eid 12, E read_permission G", |
137 ("Any N WHERE G is CWGroup, G name N, E eid 12, E read_permission G", |
134 '''SELECT G.cw_name |
138 '''SELECT _G.cw_name |
135 FROM cw_CWGroup AS G, read_permission_relation AS rel_read_permission0 |
139 FROM cw_CWGroup AS _G, read_permission_relation AS rel_read_permission0 |
136 WHERE rel_read_permission0.eid_from=12 AND rel_read_permission0.eid_to=G.cw_eid'''), |
140 WHERE rel_read_permission0.eid_from=12 AND rel_read_permission0.eid_to=_G.cw_eid'''), |
137 |
141 |
138 ('Any Y WHERE U login "admin", U login Y', # stupid but valid... |
142 ('Any Y WHERE U login "admin", U login Y', # stupid but valid... |
139 """SELECT U.cw_login |
143 """SELECT _U.cw_login |
140 FROM cw_CWUser AS U |
144 FROM cw_CWUser AS _U |
141 WHERE U.cw_login=admin"""), |
145 WHERE _U.cw_login=admin"""), |
142 |
146 |
143 ('Any T WHERE T tags X, X is State', |
147 ('Any T WHERE T tags X, X is State', |
144 '''SELECT rel_tags0.eid_from |
148 '''SELECT rel_tags0.eid_from |
145 FROM cw_State AS X, tags_relation AS rel_tags0 |
149 FROM cw_State AS _X, tags_relation AS rel_tags0 |
146 WHERE rel_tags0.eid_to=X.cw_eid'''), |
150 WHERE rel_tags0.eid_to=_X.cw_eid'''), |
147 |
151 |
148 ('Any X,Y WHERE X eid 0, Y eid 1, X concerne Y', |
152 ('Any X,Y WHERE X eid 0, Y eid 1, X concerne Y', |
149 '''SELECT 0, 1 |
153 '''SELECT 0, 1 |
150 FROM concerne_relation AS rel_concerne0 |
154 FROM concerne_relation AS rel_concerne0 |
151 WHERE rel_concerne0.eid_from=0 AND rel_concerne0.eid_to=1'''), |
155 WHERE rel_concerne0.eid_from=0 AND rel_concerne0.eid_to=1'''), |
152 |
156 |
153 ("Any X WHERE X prenom 'lulu'," |
157 ("Any X WHERE X prenom 'lulu'," |
154 "EXISTS(X owned_by U, U in_group G, G name 'lulufanclub' OR G name 'managers');", |
158 "EXISTS(X owned_by U, U in_group G, G name 'lulufanclub' OR G name 'managers');", |
155 '''SELECT X.cw_eid |
159 '''SELECT _X.cw_eid |
156 FROM cw_Personne AS X |
160 FROM cw_Personne AS _X |
157 WHERE X.cw_prenom=lulu AND EXISTS(SELECT 1 FROM owned_by_relation AS rel_owned_by0, in_group_relation AS rel_in_group1, cw_CWGroup AS G WHERE rel_owned_by0.eid_from=X.cw_eid AND rel_in_group1.eid_from=rel_owned_by0.eid_to AND rel_in_group1.eid_to=G.cw_eid AND ((G.cw_name=lulufanclub) OR (G.cw_name=managers)))'''), |
161 WHERE _X.cw_prenom=lulu AND EXISTS(SELECT 1 FROM owned_by_relation AS rel_owned_by0, in_group_relation AS rel_in_group1, cw_CWGroup AS _G WHERE rel_owned_by0.eid_from=_X.cw_eid AND rel_in_group1.eid_from=rel_owned_by0.eid_to AND rel_in_group1.eid_to=_G.cw_eid AND ((_G.cw_name=lulufanclub) OR (_G.cw_name=managers)))'''), |
158 |
162 |
159 ("Any X WHERE X prenom 'lulu'," |
163 ("Any X WHERE X prenom 'lulu'," |
160 "NOT EXISTS(X owned_by U, U in_group G, G name 'lulufanclub' OR G name 'managers');", |
164 "NOT EXISTS(X owned_by U, U in_group G, G name 'lulufanclub' OR G name 'managers');", |
161 '''SELECT X.cw_eid |
165 '''SELECT _X.cw_eid |
162 FROM cw_Personne AS X |
166 FROM cw_Personne AS _X |
163 WHERE X.cw_prenom=lulu AND NOT EXISTS(SELECT 1 FROM owned_by_relation AS rel_owned_by0, in_group_relation AS rel_in_group1, cw_CWGroup AS G WHERE rel_owned_by0.eid_from=X.cw_eid AND rel_in_group1.eid_from=rel_owned_by0.eid_to AND rel_in_group1.eid_to=G.cw_eid AND ((G.cw_name=lulufanclub) OR (G.cw_name=managers)))'''), |
167 WHERE _X.cw_prenom=lulu AND NOT EXISTS(SELECT 1 FROM owned_by_relation AS rel_owned_by0, in_group_relation AS rel_in_group1, cw_CWGroup AS _G WHERE rel_owned_by0.eid_from=_X.cw_eid AND rel_in_group1.eid_from=rel_owned_by0.eid_to AND rel_in_group1.eid_to=_G.cw_eid AND ((_G.cw_name=lulufanclub) OR (_G.cw_name=managers)))'''), |
164 ] |
168 ] |
165 |
169 |
166 ADVANCED= [ |
170 ADVANCED= [ |
167 ("Societe S WHERE S nom 'Logilab' OR S nom 'Caesium'", |
171 ("Societe S WHERE S nom 'Logilab' OR S nom 'Caesium'", |
168 '''SELECT S.cw_eid |
172 '''SELECT _S.cw_eid |
169 FROM cw_Societe AS S |
173 FROM cw_Societe AS _S |
170 WHERE ((S.cw_nom=Logilab) OR (S.cw_nom=Caesium))'''), |
174 WHERE ((_S.cw_nom=Logilab) OR (_S.cw_nom=Caesium))'''), |
171 |
175 |
172 ('Any X WHERE X nom "toto", X eid IN (9700, 9710, 1045, 674)', |
176 ('Any X WHERE X nom "toto", X eid IN (9700, 9710, 1045, 674)', |
173 '''SELECT X.cw_eid |
177 '''SELECT _X.cw_eid |
174 FROM cw_Division AS X |
178 FROM cw_Division AS _X |
175 WHERE X.cw_nom=toto AND X.cw_eid IN(9700, 9710, 1045, 674) |
179 WHERE _X.cw_nom=toto AND _X.cw_eid IN(9700, 9710, 1045, 674) |
176 UNION ALL |
180 UNION ALL |
177 SELECT X.cw_eid |
181 SELECT _X.cw_eid |
178 FROM cw_Personne AS X |
182 FROM cw_Personne AS _X |
179 WHERE X.cw_nom=toto AND X.cw_eid IN(9700, 9710, 1045, 674) |
183 WHERE _X.cw_nom=toto AND _X.cw_eid IN(9700, 9710, 1045, 674) |
180 UNION ALL |
184 UNION ALL |
181 SELECT X.cw_eid |
185 SELECT _X.cw_eid |
182 FROM cw_Societe AS X |
186 FROM cw_Societe AS _X |
183 WHERE X.cw_nom=toto AND X.cw_eid IN(9700, 9710, 1045, 674) |
187 WHERE _X.cw_nom=toto AND _X.cw_eid IN(9700, 9710, 1045, 674) |
184 UNION ALL |
188 UNION ALL |
185 SELECT X.cw_eid |
189 SELECT _X.cw_eid |
186 FROM cw_SubDivision AS X |
190 FROM cw_SubDivision AS _X |
187 WHERE X.cw_nom=toto AND X.cw_eid IN(9700, 9710, 1045, 674)'''), |
191 WHERE _X.cw_nom=toto AND _X.cw_eid IN(9700, 9710, 1045, 674)'''), |
188 |
192 |
189 ('Any Y, COUNT(N) GROUPBY Y WHERE Y evaluee N;', |
193 ('Any Y, COUNT(N) GROUPBY Y WHERE Y evaluee N;', |
190 '''SELECT rel_evaluee0.eid_from, COUNT(rel_evaluee0.eid_to) |
194 '''SELECT rel_evaluee0.eid_from, COUNT(rel_evaluee0.eid_to) |
191 FROM evaluee_relation AS rel_evaluee0 |
195 FROM evaluee_relation AS rel_evaluee0 |
192 GROUP BY rel_evaluee0.eid_from'''), |
196 GROUP BY rel_evaluee0.eid_from'''), |
193 |
197 |
194 ("Any X WHERE X concerne B or C concerne X", |
198 ("Any X WHERE X concerne B or C concerne X", |
195 '''SELECT X.cw_eid |
199 '''SELECT _X.cw_eid |
196 FROM concerne_relation AS rel_concerne0, concerne_relation AS rel_concerne1, cw_Affaire AS X |
200 FROM concerne_relation AS rel_concerne0, concerne_relation AS rel_concerne1, cw_Affaire AS _X |
197 WHERE ((rel_concerne0.eid_from=X.cw_eid) OR (rel_concerne1.eid_to=X.cw_eid))'''), |
201 WHERE ((rel_concerne0.eid_from=_X.cw_eid) OR (rel_concerne1.eid_to=_X.cw_eid))'''), |
198 |
202 |
199 ("Any X WHERE X travaille S or X concerne A", |
203 ("Any X WHERE X travaille S or X concerne A", |
200 '''SELECT X.cw_eid |
204 '''SELECT _X.cw_eid |
201 FROM concerne_relation AS rel_concerne1, cw_Personne AS X, travaille_relation AS rel_travaille0 |
205 FROM concerne_relation AS rel_concerne1, cw_Personne AS _X, travaille_relation AS rel_travaille0 |
202 WHERE ((rel_travaille0.eid_from=X.cw_eid) OR (rel_concerne1.eid_from=X.cw_eid))'''), |
206 WHERE ((rel_travaille0.eid_from=_X.cw_eid) OR (rel_concerne1.eid_from=_X.cw_eid))'''), |
203 |
207 |
204 ("Any N WHERE A evaluee N or N ecrit_par P", |
208 ("Any N WHERE A evaluee N or N ecrit_par P", |
205 '''SELECT N.cw_eid |
209 '''SELECT _N.cw_eid |
206 FROM cw_Note AS N, evaluee_relation AS rel_evaluee0 |
210 FROM cw_Note AS _N, evaluee_relation AS rel_evaluee0 |
207 WHERE ((rel_evaluee0.eid_to=N.cw_eid) OR (N.cw_ecrit_par IS NOT NULL))'''), |
211 WHERE ((rel_evaluee0.eid_to=_N.cw_eid) OR (_N.cw_ecrit_par IS NOT NULL))'''), |
208 |
212 |
209 ("Any N WHERE A evaluee N or EXISTS(N todo_by U)", |
213 ("Any N WHERE A evaluee N or EXISTS(N todo_by U)", |
210 '''SELECT N.cw_eid |
214 '''SELECT _N.cw_eid |
211 FROM cw_Note AS N, evaluee_relation AS rel_evaluee0 |
215 FROM cw_Note AS _N, evaluee_relation AS rel_evaluee0 |
212 WHERE ((rel_evaluee0.eid_to=N.cw_eid) OR (EXISTS(SELECT 1 FROM todo_by_relation AS rel_todo_by1 WHERE rel_todo_by1.eid_from=N.cw_eid)))'''), |
216 WHERE ((rel_evaluee0.eid_to=_N.cw_eid) OR (EXISTS(SELECT 1 FROM todo_by_relation AS rel_todo_by1 WHERE rel_todo_by1.eid_from=_N.cw_eid)))'''), |
213 |
217 |
214 ("Any N WHERE A evaluee N or N todo_by U", |
218 ("Any N WHERE A evaluee N or N todo_by U", |
215 '''SELECT N.cw_eid |
219 '''SELECT _N.cw_eid |
216 FROM cw_Note AS N, evaluee_relation AS rel_evaluee0, todo_by_relation AS rel_todo_by1 |
220 FROM cw_Note AS _N, evaluee_relation AS rel_evaluee0, todo_by_relation AS rel_todo_by1 |
217 WHERE ((rel_evaluee0.eid_to=N.cw_eid) OR (rel_todo_by1.eid_from=N.cw_eid))'''), |
221 WHERE ((rel_evaluee0.eid_to=_N.cw_eid) OR (rel_todo_by1.eid_from=_N.cw_eid))'''), |
218 |
222 |
219 ("Any X WHERE X concerne B or C concerne X, B eid 12, C eid 13", |
223 ("Any X WHERE X concerne B or C concerne X, B eid 12, C eid 13", |
220 '''SELECT X.cw_eid |
224 '''SELECT _X.cw_eid |
221 FROM concerne_relation AS rel_concerne0, concerne_relation AS rel_concerne1, cw_Affaire AS X |
225 FROM concerne_relation AS rel_concerne0, concerne_relation AS rel_concerne1, cw_Affaire AS _X |
222 WHERE ((rel_concerne0.eid_from=X.cw_eid AND rel_concerne0.eid_to=12) OR (rel_concerne1.eid_from=13 AND rel_concerne1.eid_to=X.cw_eid))'''), |
226 WHERE ((rel_concerne0.eid_from=_X.cw_eid AND rel_concerne0.eid_to=12) OR (rel_concerne1.eid_from=13 AND rel_concerne1.eid_to=_X.cw_eid))'''), |
223 |
227 |
224 ('Any X WHERE X created_by U, X concerne B OR C concerne X, B eid 12, C eid 13', |
228 ('Any X WHERE X created_by U, X concerne B OR C concerne X, B eid 12, C eid 13', |
225 '''SELECT rel_created_by0.eid_from |
229 '''SELECT rel_created_by0.eid_from |
226 FROM concerne_relation AS rel_concerne1, concerne_relation AS rel_concerne2, created_by_relation AS rel_created_by0 |
230 FROM concerne_relation AS rel_concerne1, concerne_relation AS rel_concerne2, created_by_relation AS rel_created_by0 |
227 WHERE ((rel_concerne1.eid_from=rel_created_by0.eid_from AND rel_concerne1.eid_to=12) OR (rel_concerne2.eid_from=13 AND rel_concerne2.eid_to=rel_created_by0.eid_from))'''), |
231 WHERE ((rel_concerne1.eid_from=rel_created_by0.eid_from AND rel_concerne1.eid_to=12) OR (rel_concerne2.eid_from=13 AND rel_concerne2.eid_to=rel_created_by0.eid_from))'''), |
228 |
232 |
229 ('Any P WHERE P travaille_subdivision S1 OR P travaille_subdivision S2, S1 nom "logilab", S2 nom "caesium"', |
233 ('Any P WHERE P travaille_subdivision S1 OR P travaille_subdivision S2, S1 nom "logilab", S2 nom "caesium"', |
230 '''SELECT P.cw_eid |
234 '''SELECT _P.cw_eid |
231 FROM cw_Personne AS P, cw_SubDivision AS S1, cw_SubDivision AS S2, travaille_subdivision_relation AS rel_travaille_subdivision0, travaille_subdivision_relation AS rel_travaille_subdivision1 |
235 FROM cw_Personne AS _P, cw_SubDivision AS _S1, cw_SubDivision AS _S2, travaille_subdivision_relation AS rel_travaille_subdivision0, travaille_subdivision_relation AS rel_travaille_subdivision1 |
232 WHERE ((rel_travaille_subdivision0.eid_from=P.cw_eid AND rel_travaille_subdivision0.eid_to=S1.cw_eid) OR (rel_travaille_subdivision1.eid_from=P.cw_eid AND rel_travaille_subdivision1.eid_to=S2.cw_eid)) AND S1.cw_nom=logilab AND S2.cw_nom=caesium'''), |
236 WHERE ((rel_travaille_subdivision0.eid_from=_P.cw_eid AND rel_travaille_subdivision0.eid_to=_S1.cw_eid) OR (rel_travaille_subdivision1.eid_from=_P.cw_eid AND rel_travaille_subdivision1.eid_to=_S2.cw_eid)) AND _S1.cw_nom=logilab AND _S2.cw_nom=caesium'''), |
233 |
237 |
234 ('Any X WHERE T tags X', |
238 ('Any X WHERE T tags X', |
235 '''SELECT rel_tags0.eid_to |
239 '''SELECT rel_tags0.eid_to |
236 FROM tags_relation AS rel_tags0'''), |
240 FROM tags_relation AS rel_tags0'''), |
237 |
241 |
277 '''SELECT 2, rel_owned_by0.eid_to |
281 '''SELECT 2, rel_owned_by0.eid_to |
278 FROM owned_by_relation AS rel_owned_by0 |
282 FROM owned_by_relation AS rel_owned_by0 |
279 WHERE rel_owned_by0.eid_from=1 AND NOT EXISTS(SELECT 1 FROM owned_by_relation AS rel_owned_by1 WHERE rel_owned_by1.eid_from=2 AND rel_owned_by0.eid_to=rel_owned_by1.eid_to)'''), |
283 WHERE rel_owned_by0.eid_from=1 AND NOT EXISTS(SELECT 1 FROM owned_by_relation AS rel_owned_by1 WHERE rel_owned_by1.eid_from=2 AND rel_owned_by0.eid_to=rel_owned_by1.eid_to)'''), |
280 |
284 |
281 ('Any GN WHERE X in_group G, G name GN, (G name "managers" OR EXISTS(X copain T, T login in ("comme", "cochon")))', |
285 ('Any GN WHERE X in_group G, G name GN, (G name "managers" OR EXISTS(X copain T, T login in ("comme", "cochon")))', |
282 '''SELECT G.cw_name |
286 '''SELECT _G.cw_name |
283 FROM cw_CWGroup AS G, in_group_relation AS rel_in_group0 |
287 FROM cw_CWGroup AS _G, in_group_relation AS rel_in_group0 |
284 WHERE rel_in_group0.eid_to=G.cw_eid AND ((G.cw_name=managers) OR (EXISTS(SELECT 1 FROM copain_relation AS rel_copain1, cw_CWUser AS T WHERE rel_copain1.eid_from=rel_in_group0.eid_from AND rel_copain1.eid_to=T.cw_eid AND T.cw_login IN(comme, cochon))))'''), |
288 WHERE rel_in_group0.eid_to=_G.cw_eid AND ((_G.cw_name=managers) OR (EXISTS(SELECT 1 FROM copain_relation AS rel_copain1, cw_CWUser AS _T WHERE rel_copain1.eid_from=rel_in_group0.eid_from AND rel_copain1.eid_to=_T.cw_eid AND _T.cw_login IN(comme, cochon))))'''), |
285 |
289 |
286 ('Any C WHERE C is Card, EXISTS(X documented_by C)', |
290 ('Any C WHERE C is Card, EXISTS(X documented_by C)', |
287 """SELECT C.cw_eid |
291 """SELECT _C.cw_eid |
288 FROM cw_Card AS C |
292 FROM cw_Card AS _C |
289 WHERE EXISTS(SELECT 1 FROM documented_by_relation AS rel_documented_by0 WHERE rel_documented_by0.eid_to=C.cw_eid)"""), |
293 WHERE EXISTS(SELECT 1 FROM documented_by_relation AS rel_documented_by0 WHERE rel_documented_by0.eid_to=_C.cw_eid)"""), |
290 |
294 |
291 ('Any C WHERE C is Card, EXISTS(X documented_by C, X eid 12)', |
295 ('Any C WHERE C is Card, EXISTS(X documented_by C, X eid 12)', |
292 """SELECT C.cw_eid |
296 """SELECT _C.cw_eid |
293 FROM cw_Card AS C |
297 FROM cw_Card AS _C |
294 WHERE EXISTS(SELECT 1 FROM documented_by_relation AS rel_documented_by0 WHERE rel_documented_by0.eid_from=12 AND rel_documented_by0.eid_to=C.cw_eid)"""), |
298 WHERE EXISTS(SELECT 1 FROM documented_by_relation AS rel_documented_by0 WHERE rel_documented_by0.eid_from=12 AND rel_documented_by0.eid_to=_C.cw_eid)"""), |
295 |
299 |
296 ('Any T WHERE C is Card, C title T, EXISTS(X documented_by C, X eid 12)', |
300 ('Any T WHERE C is Card, C title T, EXISTS(X documented_by C, X eid 12)', |
297 """SELECT C.cw_title |
301 """SELECT _C.cw_title |
298 FROM cw_Card AS C |
302 FROM cw_Card AS _C |
299 WHERE EXISTS(SELECT 1 FROM documented_by_relation AS rel_documented_by0 WHERE rel_documented_by0.eid_from=12 AND rel_documented_by0.eid_to=C.cw_eid)"""), |
303 WHERE EXISTS(SELECT 1 FROM documented_by_relation AS rel_documented_by0 WHERE rel_documented_by0.eid_from=12 AND rel_documented_by0.eid_to=_C.cw_eid)"""), |
300 |
304 |
301 ('Any GN,L WHERE X in_group G, X login L, G name GN, EXISTS(X copain T, T login L, T login IN("comme", "cochon"))', |
305 ('Any GN,L WHERE X in_group G, X login L, G name GN, EXISTS(X copain T, T login L, T login IN("comme", "cochon"))', |
302 '''SELECT G.cw_name, X.cw_login |
306 '''SELECT _G.cw_name, _X.cw_login |
303 FROM cw_CWGroup AS G, cw_CWUser AS X, in_group_relation AS rel_in_group0 |
307 FROM cw_CWGroup AS _G, cw_CWUser AS _X, in_group_relation AS rel_in_group0 |
304 WHERE rel_in_group0.eid_from=X.cw_eid AND rel_in_group0.eid_to=G.cw_eid AND EXISTS(SELECT 1 FROM copain_relation AS rel_copain1, cw_CWUser AS T WHERE rel_copain1.eid_from=X.cw_eid AND rel_copain1.eid_to=T.cw_eid AND T.cw_login=X.cw_login AND T.cw_login IN(comme, cochon))'''), |
308 WHERE rel_in_group0.eid_from=_X.cw_eid AND rel_in_group0.eid_to=_G.cw_eid AND EXISTS(SELECT 1 FROM copain_relation AS rel_copain1, cw_CWUser AS _T WHERE rel_copain1.eid_from=_X.cw_eid AND rel_copain1.eid_to=_T.cw_eid AND _T.cw_login=_X.cw_login AND _T.cw_login IN(comme, cochon))'''), |
305 |
309 |
306 ('Any X,S, MAX(T) GROUPBY X,S ORDERBY S WHERE X is CWUser, T tags X, S eid IN(32), X in_state S', |
310 ('Any X,S, MAX(T) GROUPBY X,S ORDERBY S WHERE X is CWUser, T tags X, S eid IN(32), X in_state S', |
307 '''SELECT X.cw_eid, 32, MAX(rel_tags0.eid_from) |
311 '''SELECT _X.cw_eid, 32, MAX(rel_tags0.eid_from) |
308 FROM cw_CWUser AS X, tags_relation AS rel_tags0 |
312 FROM cw_CWUser AS _X, tags_relation AS rel_tags0 |
309 WHERE rel_tags0.eid_to=X.cw_eid AND X.cw_in_state=32 |
313 WHERE rel_tags0.eid_to=_X.cw_eid AND _X.cw_in_state=32 |
310 GROUP BY X.cw_eid'''), |
314 GROUP BY _X.cw_eid'''), |
311 |
315 |
312 ('Any COUNT(S),CS GROUPBY CS ORDERBY 1 DESC LIMIT 10 WHERE S is Affaire, C is Societe, S concerne C, C nom CS, (EXISTS(S owned_by 1)) OR (EXISTS(S documented_by N, N title "published"))', |
316 ('Any COUNT(S),CS GROUPBY CS ORDERBY 1 DESC LIMIT 10 WHERE S is Affaire, C is Societe, S concerne C, C nom CS, (EXISTS(S owned_by 1)) OR (EXISTS(S documented_by N, N title "published"))', |
313 '''SELECT COUNT(rel_concerne0.eid_from), C.cw_nom |
317 '''SELECT COUNT(rel_concerne0.eid_from), _C.cw_nom |
314 FROM concerne_relation AS rel_concerne0, cw_Societe AS C |
318 FROM concerne_relation AS rel_concerne0, cw_Societe AS _C |
315 WHERE rel_concerne0.eid_to=C.cw_eid AND ((EXISTS(SELECT 1 FROM owned_by_relation AS rel_owned_by1 WHERE rel_concerne0.eid_from=rel_owned_by1.eid_from AND rel_owned_by1.eid_to=1)) OR (EXISTS(SELECT 1 FROM documented_by_relation AS rel_documented_by2, cw_Card AS N WHERE rel_concerne0.eid_from=rel_documented_by2.eid_from AND rel_documented_by2.eid_to=N.cw_eid AND N.cw_title=published))) |
319 WHERE rel_concerne0.eid_to=_C.cw_eid AND ((EXISTS(SELECT 1 FROM owned_by_relation AS rel_owned_by1 WHERE rel_concerne0.eid_from=rel_owned_by1.eid_from AND rel_owned_by1.eid_to=1)) OR (EXISTS(SELECT 1 FROM documented_by_relation AS rel_documented_by2, cw_Card AS _N WHERE rel_concerne0.eid_from=rel_documented_by2.eid_from AND rel_documented_by2.eid_to=_N.cw_eid AND _N.cw_title=published))) |
316 GROUP BY C.cw_nom |
320 GROUP BY _C.cw_nom |
317 ORDER BY 1 DESC |
321 ORDER BY 1 DESC |
318 LIMIT 10'''), |
322 LIMIT 10'''), |
319 |
323 |
320 ('Any X WHERE Y evaluee X, Y is CWUser', |
324 ('Any X WHERE Y evaluee X, Y is CWUser', |
321 '''SELECT rel_evaluee0.eid_to |
325 '''SELECT rel_evaluee0.eid_to |
322 FROM cw_CWUser AS Y, evaluee_relation AS rel_evaluee0 |
326 FROM cw_CWUser AS _Y, evaluee_relation AS rel_evaluee0 |
323 WHERE rel_evaluee0.eid_from=Y.cw_eid'''), |
327 WHERE rel_evaluee0.eid_from=_Y.cw_eid'''), |
324 |
328 |
325 ('Any L WHERE X login "admin", X identity Y, Y login L', |
329 ('Any L WHERE X login "admin", X identity Y, Y login L', |
326 '''SELECT Y.cw_login |
330 '''SELECT _Y.cw_login |
327 FROM cw_CWUser AS X, cw_CWUser AS Y |
331 FROM cw_CWUser AS _X, cw_CWUser AS _Y |
328 WHERE X.cw_login=admin AND X.cw_eid=Y.cw_eid'''), |
332 WHERE _X.cw_login=admin AND _X.cw_eid=_Y.cw_eid'''), |
329 |
333 |
330 ('Any L WHERE X login "admin", NOT X identity Y, Y login L', |
334 ('Any L WHERE X login "admin", NOT X identity Y, Y login L', |
331 '''SELECT Y.cw_login |
335 '''SELECT _Y.cw_login |
332 FROM cw_CWUser AS X, cw_CWUser AS Y |
336 FROM cw_CWUser AS _X, cw_CWUser AS _Y |
333 WHERE X.cw_login=admin AND NOT X.cw_eid=Y.cw_eid'''), |
337 WHERE _X.cw_login=admin AND NOT _X.cw_eid=_Y.cw_eid'''), |
334 |
338 |
335 ('Any L WHERE X login "admin", X identity Y?, Y login L', |
339 ('Any L WHERE X login "admin", X identity Y?, Y login L', |
336 '''SELECT Y.cw_login |
340 '''SELECT _Y.cw_login |
337 FROM cw_CWUser AS X LEFT OUTER JOIN cw_CWUser AS Y ON (X.cw_eid=Y.cw_eid) |
341 FROM cw_CWUser AS _X LEFT OUTER JOIN cw_CWUser AS _Y ON (_X.cw_eid=_Y.cw_eid) |
338 WHERE X.cw_login=admin'''), |
342 WHERE _X.cw_login=admin'''), |
339 |
343 |
340 ('Any XN ORDERBY XN WHERE X name XN, X is IN (Basket,Folder,Tag)', |
344 ('Any XN ORDERBY XN WHERE X name XN, X is IN (Basket,Folder,Tag)', |
341 '''SELECT X.cw_name |
345 '''SELECT _X.cw_name |
342 FROM cw_Basket AS X |
346 FROM cw_Basket AS _X |
343 UNION ALL |
347 UNION ALL |
344 SELECT X.cw_name |
348 SELECT _X.cw_name |
345 FROM cw_Folder AS X |
349 FROM cw_Folder AS _X |
346 UNION ALL |
350 UNION ALL |
347 SELECT X.cw_name |
351 SELECT _X.cw_name |
348 FROM cw_Tag AS X |
352 FROM cw_Tag AS _X |
349 ORDER BY 1'''), |
353 ORDER BY 1'''), |
350 |
354 |
351 # DISTINCT, can use relation under exists scope as principal |
355 # DISTINCT, can use relation under exists scope as principal |
352 ('DISTINCT Any X,Y WHERE X name "CWGroup", Y eid IN(1, 2, 3), EXISTS(X read_permission Y)', |
356 ('DISTINCT Any X,Y WHERE X name "CWGroup", Y eid IN(1, 2, 3), EXISTS(X read_permission Y)', |
353 '''SELECT DISTINCT X.cw_eid, rel_read_permission0.eid_to |
357 '''SELECT DISTINCT _X.cw_eid, rel_read_permission0.eid_to |
354 FROM cw_CWEType AS X, read_permission_relation AS rel_read_permission0 |
358 FROM cw_CWEType AS _X, read_permission_relation AS rel_read_permission0 |
355 WHERE X.cw_name=CWGroup AND rel_read_permission0.eid_to IN(1, 2, 3) AND EXISTS(SELECT 1 WHERE rel_read_permission0.eid_from=X.cw_eid) |
359 WHERE _X.cw_name=CWGroup AND rel_read_permission0.eid_to IN(1, 2, 3) AND EXISTS(SELECT 1 WHERE rel_read_permission0.eid_from=_X.cw_eid) |
356 UNION |
360 UNION |
357 SELECT DISTINCT X.cw_eid, rel_read_permission0.eid_to |
361 SELECT DISTINCT _X.cw_eid, rel_read_permission0.eid_to |
358 FROM cw_CWRType AS X, read_permission_relation AS rel_read_permission0 |
362 FROM cw_CWRType AS _X, read_permission_relation AS rel_read_permission0 |
359 WHERE X.cw_name=CWGroup AND rel_read_permission0.eid_to IN(1, 2, 3) AND EXISTS(SELECT 1 WHERE rel_read_permission0.eid_from=X.cw_eid)'''), |
363 WHERE _X.cw_name=CWGroup AND rel_read_permission0.eid_to IN(1, 2, 3) AND EXISTS(SELECT 1 WHERE rel_read_permission0.eid_from=_X.cw_eid)'''), |
360 |
364 |
361 # no distinct, Y can't be invariant |
365 # no distinct, Y can't be invariant |
362 ('Any X,Y WHERE X name "CWGroup", Y eid IN(1, 2, 3), EXISTS(X read_permission Y)', |
366 ('Any X,Y WHERE X name "CWGroup", Y eid IN(1, 2, 3), EXISTS(X read_permission Y)', |
363 '''SELECT X.cw_eid, Y.cw_eid |
367 '''SELECT _X.cw_eid, _Y.cw_eid |
364 FROM cw_CWEType AS X, cw_CWGroup AS Y |
368 FROM cw_CWEType AS _X, cw_CWGroup AS _Y |
365 WHERE X.cw_name=CWGroup AND Y.cw_eid IN(1, 2, 3) AND EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=X.cw_eid AND rel_read_permission0.eid_to=Y.cw_eid) |
369 WHERE _X.cw_name=CWGroup AND _Y.cw_eid IN(1, 2, 3) AND EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=_X.cw_eid AND rel_read_permission0.eid_to=_Y.cw_eid) |
366 UNION ALL |
370 UNION ALL |
367 SELECT X.cw_eid, Y.cw_eid |
371 SELECT _X.cw_eid, _Y.cw_eid |
368 FROM cw_CWEType AS X, cw_RQLExpression AS Y |
372 FROM cw_CWEType AS _X, cw_RQLExpression AS _Y |
369 WHERE X.cw_name=CWGroup AND Y.cw_eid IN(1, 2, 3) AND EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=X.cw_eid AND rel_read_permission0.eid_to=Y.cw_eid) |
373 WHERE _X.cw_name=CWGroup AND _Y.cw_eid IN(1, 2, 3) AND EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=_X.cw_eid AND rel_read_permission0.eid_to=_Y.cw_eid) |
370 UNION ALL |
374 UNION ALL |
371 SELECT X.cw_eid, Y.cw_eid |
375 SELECT _X.cw_eid, _Y.cw_eid |
372 FROM cw_CWGroup AS Y, cw_CWRType AS X |
376 FROM cw_CWGroup AS _Y, cw_CWRType AS _X |
373 WHERE X.cw_name=CWGroup AND Y.cw_eid IN(1, 2, 3) AND EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=X.cw_eid AND rel_read_permission0.eid_to=Y.cw_eid) |
377 WHERE _X.cw_name=CWGroup AND _Y.cw_eid IN(1, 2, 3) AND EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=_X.cw_eid AND rel_read_permission0.eid_to=_Y.cw_eid) |
374 UNION ALL |
378 UNION ALL |
375 SELECT X.cw_eid, Y.cw_eid |
379 SELECT _X.cw_eid, _Y.cw_eid |
376 FROM cw_CWRType AS X, cw_RQLExpression AS Y |
380 FROM cw_CWRType AS _X, cw_RQLExpression AS _Y |
377 WHERE X.cw_name=CWGroup AND Y.cw_eid IN(1, 2, 3) AND EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=X.cw_eid AND rel_read_permission0.eid_to=Y.cw_eid)'''), |
381 WHERE _X.cw_name=CWGroup AND _Y.cw_eid IN(1, 2, 3) AND EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=_X.cw_eid AND rel_read_permission0.eid_to=_Y.cw_eid)'''), |
378 |
382 |
379 # DISTINCT but NEGED exists, can't be invariant |
383 # DISTINCT but NEGED exists, can't be invariant |
380 ('DISTINCT Any X,Y WHERE X name "CWGroup", Y eid IN(1, 2, 3), NOT EXISTS(X read_permission Y)', |
384 ('DISTINCT Any X,Y WHERE X name "CWGroup", Y eid IN(1, 2, 3), NOT EXISTS(X read_permission Y)', |
381 '''SELECT DISTINCT X.cw_eid, Y.cw_eid |
385 '''SELECT DISTINCT _X.cw_eid, _Y.cw_eid |
382 FROM cw_CWEType AS X, cw_CWGroup AS Y |
386 FROM cw_CWEType AS _X, cw_CWGroup AS _Y |
383 WHERE X.cw_name=CWGroup AND Y.cw_eid IN(1, 2, 3) AND NOT EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=X.cw_eid AND rel_read_permission0.eid_to=Y.cw_eid) |
387 WHERE _X.cw_name=CWGroup AND _Y.cw_eid IN(1, 2, 3) AND NOT EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=_X.cw_eid AND rel_read_permission0.eid_to=_Y.cw_eid) |
384 UNION |
388 UNION |
385 SELECT DISTINCT X.cw_eid, Y.cw_eid |
389 SELECT DISTINCT _X.cw_eid, _Y.cw_eid |
386 FROM cw_CWEType AS X, cw_RQLExpression AS Y |
390 FROM cw_CWEType AS _X, cw_RQLExpression AS _Y |
387 WHERE X.cw_name=CWGroup AND Y.cw_eid IN(1, 2, 3) AND NOT EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=X.cw_eid AND rel_read_permission0.eid_to=Y.cw_eid) |
391 WHERE _X.cw_name=CWGroup AND _Y.cw_eid IN(1, 2, 3) AND NOT EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=_X.cw_eid AND rel_read_permission0.eid_to=_Y.cw_eid) |
388 UNION |
392 UNION |
389 SELECT DISTINCT X.cw_eid, Y.cw_eid |
393 SELECT DISTINCT _X.cw_eid, _Y.cw_eid |
390 FROM cw_CWGroup AS Y, cw_CWRType AS X |
394 FROM cw_CWGroup AS _Y, cw_CWRType AS _X |
391 WHERE X.cw_name=CWGroup AND Y.cw_eid IN(1, 2, 3) AND NOT EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=X.cw_eid AND rel_read_permission0.eid_to=Y.cw_eid) |
395 WHERE _X.cw_name=CWGroup AND _Y.cw_eid IN(1, 2, 3) AND NOT EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=_X.cw_eid AND rel_read_permission0.eid_to=_Y.cw_eid) |
392 UNION |
396 UNION |
393 SELECT DISTINCT X.cw_eid, Y.cw_eid |
397 SELECT DISTINCT _X.cw_eid, _Y.cw_eid |
394 FROM cw_CWRType AS X, cw_RQLExpression AS Y |
398 FROM cw_CWRType AS _X, cw_RQLExpression AS _Y |
395 WHERE X.cw_name=CWGroup AND Y.cw_eid IN(1, 2, 3) AND NOT EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=X.cw_eid AND rel_read_permission0.eid_to=Y.cw_eid)'''), |
399 WHERE _X.cw_name=CWGroup AND _Y.cw_eid IN(1, 2, 3) AND NOT EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=_X.cw_eid AND rel_read_permission0.eid_to=_Y.cw_eid)'''), |
396 |
400 |
397 # should generate the same query as above |
401 # should generate the same query as above |
398 ('DISTINCT Any X,Y WHERE X name "CWGroup", Y eid IN(1, 2, 3), NOT X read_permission Y', |
402 ('DISTINCT Any X,Y WHERE X name "CWGroup", Y eid IN(1, 2, 3), NOT X read_permission Y', |
399 '''SELECT DISTINCT X.cw_eid, Y.cw_eid |
403 '''SELECT DISTINCT _X.cw_eid, _Y.cw_eid |
400 FROM cw_CWEType AS X, cw_CWGroup AS Y |
404 FROM cw_CWEType AS _X, cw_CWGroup AS _Y |
401 WHERE X.cw_name=CWGroup AND Y.cw_eid IN(1, 2, 3) AND NOT EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=X.cw_eid AND rel_read_permission0.eid_to=Y.cw_eid) |
405 WHERE _X.cw_name=CWGroup AND _Y.cw_eid IN(1, 2, 3) AND NOT EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=_X.cw_eid AND rel_read_permission0.eid_to=_Y.cw_eid) |
402 UNION |
406 UNION |
403 SELECT DISTINCT X.cw_eid, Y.cw_eid |
407 SELECT DISTINCT _X.cw_eid, _Y.cw_eid |
404 FROM cw_CWEType AS X, cw_RQLExpression AS Y |
408 FROM cw_CWEType AS _X, cw_RQLExpression AS _Y |
405 WHERE X.cw_name=CWGroup AND Y.cw_eid IN(1, 2, 3) AND NOT EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=X.cw_eid AND rel_read_permission0.eid_to=Y.cw_eid) |
409 WHERE _X.cw_name=CWGroup AND _Y.cw_eid IN(1, 2, 3) AND NOT EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=_X.cw_eid AND rel_read_permission0.eid_to=_Y.cw_eid) |
406 UNION |
410 UNION |
407 SELECT DISTINCT X.cw_eid, Y.cw_eid |
411 SELECT DISTINCT _X.cw_eid, _Y.cw_eid |
408 FROM cw_CWGroup AS Y, cw_CWRType AS X |
412 FROM cw_CWGroup AS _Y, cw_CWRType AS _X |
409 WHERE X.cw_name=CWGroup AND Y.cw_eid IN(1, 2, 3) AND NOT EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=X.cw_eid AND rel_read_permission0.eid_to=Y.cw_eid) |
413 WHERE _X.cw_name=CWGroup AND _Y.cw_eid IN(1, 2, 3) AND NOT EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=_X.cw_eid AND rel_read_permission0.eid_to=_Y.cw_eid) |
410 UNION |
414 UNION |
411 SELECT DISTINCT X.cw_eid, Y.cw_eid |
415 SELECT DISTINCT _X.cw_eid, _Y.cw_eid |
412 FROM cw_CWRType AS X, cw_RQLExpression AS Y |
416 FROM cw_CWRType AS _X, cw_RQLExpression AS _Y |
413 WHERE X.cw_name=CWGroup AND Y.cw_eid IN(1, 2, 3) AND NOT EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=X.cw_eid AND rel_read_permission0.eid_to=Y.cw_eid)'''), |
417 WHERE _X.cw_name=CWGroup AND _Y.cw_eid IN(1, 2, 3) AND NOT EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=_X.cw_eid AND rel_read_permission0.eid_to=_Y.cw_eid)'''), |
414 |
418 |
415 # neged relation, can't be inveriant |
419 # neged relation, can't be inveriant |
416 ('Any X,Y WHERE X name "CWGroup", Y eid IN(1, 2, 3), NOT X read_permission Y', |
420 ('Any X,Y WHERE X name "CWGroup", Y eid IN(1, 2, 3), NOT X read_permission Y', |
417 '''SELECT X.cw_eid, Y.cw_eid |
421 '''SELECT _X.cw_eid, _Y.cw_eid |
418 FROM cw_CWEType AS X, cw_CWGroup AS Y |
422 FROM cw_CWEType AS _X, cw_CWGroup AS _Y |
419 WHERE X.cw_name=CWGroup AND Y.cw_eid IN(1, 2, 3) AND NOT EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=X.cw_eid AND rel_read_permission0.eid_to=Y.cw_eid) |
423 WHERE _X.cw_name=CWGroup AND _Y.cw_eid IN(1, 2, 3) AND NOT EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=_X.cw_eid AND rel_read_permission0.eid_to=_Y.cw_eid) |
420 UNION ALL |
424 UNION ALL |
421 SELECT X.cw_eid, Y.cw_eid |
425 SELECT _X.cw_eid, _Y.cw_eid |
422 FROM cw_CWEType AS X, cw_RQLExpression AS Y |
426 FROM cw_CWEType AS _X, cw_RQLExpression AS _Y |
423 WHERE X.cw_name=CWGroup AND Y.cw_eid IN(1, 2, 3) AND NOT EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=X.cw_eid AND rel_read_permission0.eid_to=Y.cw_eid) |
427 WHERE _X.cw_name=CWGroup AND _Y.cw_eid IN(1, 2, 3) AND NOT EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=_X.cw_eid AND rel_read_permission0.eid_to=_Y.cw_eid) |
424 UNION ALL |
428 UNION ALL |
425 SELECT X.cw_eid, Y.cw_eid |
429 SELECT _X.cw_eid, _Y.cw_eid |
426 FROM cw_CWGroup AS Y, cw_CWRType AS X |
430 FROM cw_CWGroup AS _Y, cw_CWRType AS _X |
427 WHERE X.cw_name=CWGroup AND Y.cw_eid IN(1, 2, 3) AND NOT EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=X.cw_eid AND rel_read_permission0.eid_to=Y.cw_eid) |
431 WHERE _X.cw_name=CWGroup AND _Y.cw_eid IN(1, 2, 3) AND NOT EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=_X.cw_eid AND rel_read_permission0.eid_to=_Y.cw_eid) |
428 UNION ALL |
432 UNION ALL |
429 SELECT X.cw_eid, Y.cw_eid |
433 SELECT _X.cw_eid, _Y.cw_eid |
430 FROM cw_CWRType AS X, cw_RQLExpression AS Y |
434 FROM cw_CWRType AS _X, cw_RQLExpression AS _Y |
431 WHERE X.cw_name=CWGroup AND Y.cw_eid IN(1, 2, 3) AND NOT EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=X.cw_eid AND rel_read_permission0.eid_to=Y.cw_eid)'''), |
435 WHERE _X.cw_name=CWGroup AND _Y.cw_eid IN(1, 2, 3) AND NOT EXISTS(SELECT 1 FROM read_permission_relation AS rel_read_permission0 WHERE rel_read_permission0.eid_from=_X.cw_eid AND rel_read_permission0.eid_to=_Y.cw_eid)'''), |
432 |
436 |
433 ('Any MAX(X)+MIN(X), N GROUPBY N WHERE X name N, X is IN (Basket, Folder, Tag);', |
437 ('Any MAX(X)+MIN(X), N GROUPBY N WHERE X name N, X is IN (Basket, Folder, Tag);', |
434 '''SELECT (MAX(T1.C0) + MIN(T1.C0)), T1.C1 FROM (SELECT X.cw_eid AS C0, X.cw_name AS C1 |
438 '''SELECT (MAX(T1.C0) + MIN(T1.C0)), T1.C1 FROM (SELECT _X.cw_eid AS C0, _X.cw_name AS C1 |
435 FROM cw_Basket AS X |
439 FROM cw_Basket AS _X |
436 UNION ALL |
440 UNION ALL |
437 SELECT X.cw_eid AS C0, X.cw_name AS C1 |
441 SELECT _X.cw_eid AS C0, _X.cw_name AS C1 |
438 FROM cw_Folder AS X |
442 FROM cw_Folder AS _X |
439 UNION ALL |
443 UNION ALL |
440 SELECT X.cw_eid AS C0, X.cw_name AS C1 |
444 SELECT _X.cw_eid AS C0, _X.cw_name AS C1 |
441 FROM cw_Tag AS X) AS T1 |
445 FROM cw_Tag AS _X) AS T1 |
442 GROUP BY T1.C1'''), |
446 GROUP BY T1.C1'''), |
443 |
447 |
444 ('Any MAX(X)+MIN(LENGTH(D)), N GROUPBY N ORDERBY 1, N, DF WHERE X data_name N, X data D, X data_format DF;', |
448 ('Any MAX(X)+MIN(LENGTH(D)), N GROUPBY N ORDERBY 1, N, DF WHERE X data_name N, X data D, X data_format DF;', |
445 '''SELECT (MAX(T1.C1) + MIN(LENGTH(T1.C0))), T1.C2 FROM (SELECT X.cw_data AS C0, X.cw_eid AS C1, X.cw_data_name AS C2, X.cw_data_format AS C3 |
449 '''SELECT (MAX(T1.C1) + MIN(LENGTH(T1.C0))), T1.C2 FROM (SELECT _X.cw_data AS C0, _X.cw_eid AS C1, _X.cw_data_name AS C2, _X.cw_data_format AS C3 |
446 FROM cw_File AS X |
450 FROM cw_File AS _X |
447 UNION ALL |
451 UNION ALL |
448 SELECT X.cw_data AS C0, X.cw_eid AS C1, X.cw_data_name AS C2, X.cw_data_format AS C3 |
452 SELECT _X.cw_data AS C0, _X.cw_eid AS C1, _X.cw_data_name AS C2, _X.cw_data_format AS C3 |
449 FROM cw_Image AS X) AS T1 |
453 FROM cw_Image AS _X) AS T1 |
450 GROUP BY T1.C2 |
454 GROUP BY T1.C2,T1.C3 |
451 ORDER BY 1,2,T1.C3'''), |
455 ORDER BY 1,2,T1.C3'''), |
452 |
456 |
453 ('DISTINCT Any S ORDERBY R WHERE A is Affaire, A sujet S, A ref R', |
457 ('DISTINCT Any S ORDERBY R WHERE A is Affaire, A sujet S, A ref R', |
454 '''SELECT T1.C0 FROM (SELECT DISTINCT A.cw_sujet AS C0, A.cw_ref AS C1 |
458 '''SELECT T1.C0 FROM (SELECT DISTINCT _A.cw_sujet AS C0, _A.cw_ref AS C1 |
455 FROM cw_Affaire AS A |
459 FROM cw_Affaire AS _A |
456 ORDER BY 2) AS T1'''), |
460 ORDER BY 2) AS T1'''), |
457 |
461 |
458 ('DISTINCT Any MAX(X)+MIN(LENGTH(D)), N GROUPBY N ORDERBY 2, DF WHERE X data_name N, X data D, X data_format DF;', |
462 ('DISTINCT Any MAX(X)+MIN(LENGTH(D)), N GROUPBY N ORDERBY 2, DF WHERE X data_name N, X data D, X data_format DF;', |
459 '''SELECT T1.C0,T1.C1 FROM (SELECT DISTINCT (MAX(T1.C1) + MIN(LENGTH(T1.C0))) AS C0, T1.C2 AS C1, T1.C3 AS C2 FROM (SELECT DISTINCT X.cw_data AS C0, X.cw_eid AS C1, X.cw_data_name AS C2, X.cw_data_format AS C3 |
463 '''SELECT T1.C0,T1.C1 FROM (SELECT DISTINCT (MAX(T1.C1) + MIN(LENGTH(T1.C0))) AS C0, T1.C2 AS C1, T1.C3 AS C2 FROM (SELECT DISTINCT _X.cw_data AS C0, _X.cw_eid AS C1, _X.cw_data_name AS C2, _X.cw_data_format AS C3 |
460 FROM cw_File AS X |
464 FROM cw_File AS _X |
461 UNION |
465 UNION |
462 SELECT DISTINCT X.cw_data AS C0, X.cw_eid AS C1, X.cw_data_name AS C2, X.cw_data_format AS C3 |
466 SELECT DISTINCT _X.cw_data AS C0, _X.cw_eid AS C1, _X.cw_data_name AS C2, _X.cw_data_format AS C3 |
463 FROM cw_Image AS X) AS T1 |
467 FROM cw_Image AS _X) AS T1 |
464 GROUP BY T1.C2,T1.C3 |
468 GROUP BY T1.C2,T1.C3 |
465 ORDER BY 2,3) AS T1 |
469 ORDER BY 2,3) AS T1 |
466 '''), |
470 '''), |
467 |
471 |
468 # ambiguity in EXISTS() -> should union the sub-query |
472 # ambiguity in EXISTS() -> should union the sub-query |
469 ('Any T WHERE T is Tag, NOT T name in ("t1", "t2"), EXISTS(T tags X, X is IN (CWUser, CWGroup))', |
473 ('Any T WHERE T is Tag, NOT T name in ("t1", "t2"), EXISTS(T tags X, X is IN (CWUser, CWGroup))', |
470 '''SELECT T.cw_eid |
474 '''SELECT _T.cw_eid |
471 FROM cw_Tag AS T |
475 FROM cw_Tag AS _T |
472 WHERE NOT (T.cw_name IN(t1, t2)) AND EXISTS(SELECT 1 FROM tags_relation AS rel_tags0, cw_CWGroup AS X WHERE rel_tags0.eid_from=T.cw_eid AND rel_tags0.eid_to=X.cw_eid UNION SELECT 1 FROM tags_relation AS rel_tags1, cw_CWUser AS X WHERE rel_tags1.eid_from=T.cw_eid AND rel_tags1.eid_to=X.cw_eid)'''), |
476 WHERE NOT (_T.cw_name IN(t1, t2)) AND EXISTS(SELECT 1 FROM tags_relation AS rel_tags0, cw_CWGroup AS _X WHERE rel_tags0.eid_from=_T.cw_eid AND rel_tags0.eid_to=_X.cw_eid UNION SELECT 1 FROM tags_relation AS rel_tags1, cw_CWUser AS _X WHERE rel_tags1.eid_from=_T.cw_eid AND rel_tags1.eid_to=_X.cw_eid)'''), |
473 |
477 |
474 # must not use a relation in EXISTS scope to inline a variable |
478 # must not use a relation in EXISTS scope to inline a variable |
475 ('Any U WHERE U eid IN (1,2), EXISTS(X owned_by U)', |
479 ('Any U WHERE U eid IN (1,2), EXISTS(X owned_by U)', |
476 '''SELECT U.cw_eid |
480 '''SELECT _U.cw_eid |
477 FROM cw_CWUser AS U |
481 FROM cw_CWUser AS _U |
478 WHERE U.cw_eid IN(1, 2) AND EXISTS(SELECT 1 FROM owned_by_relation AS rel_owned_by0 WHERE rel_owned_by0.eid_to=U.cw_eid)'''), |
482 WHERE _U.cw_eid IN(1, 2) AND EXISTS(SELECT 1 FROM owned_by_relation AS rel_owned_by0 WHERE rel_owned_by0.eid_to=_U.cw_eid)'''), |
479 |
483 |
480 ('Any U WHERE EXISTS(U eid IN (1,2), X owned_by U)', |
484 ('Any U WHERE EXISTS(U eid IN (1,2), X owned_by U)', |
481 '''SELECT U.cw_eid |
485 '''SELECT _U.cw_eid |
482 FROM cw_CWUser AS U |
486 FROM cw_CWUser AS _U |
483 WHERE EXISTS(SELECT 1 FROM owned_by_relation AS rel_owned_by0 WHERE U.cw_eid IN(1, 2) AND rel_owned_by0.eid_to=U.cw_eid)'''), |
487 WHERE EXISTS(SELECT 1 FROM owned_by_relation AS rel_owned_by0 WHERE _U.cw_eid IN(1, 2) AND rel_owned_by0.eid_to=_U.cw_eid)'''), |
484 |
488 |
485 ('Any COUNT(U) WHERE EXISTS (P owned_by U, P is IN (Note, Affaire))', |
489 ('Any COUNT(U) WHERE EXISTS (P owned_by U, P is IN (Note, Affaire))', |
486 '''SELECT COUNT(U.cw_eid) |
490 '''SELECT COUNT(_U.cw_eid) |
487 FROM cw_CWUser AS U |
491 FROM cw_CWUser AS _U |
488 WHERE EXISTS(SELECT 1 FROM owned_by_relation AS rel_owned_by0, cw_Affaire AS P WHERE rel_owned_by0.eid_from=P.cw_eid AND rel_owned_by0.eid_to=U.cw_eid UNION SELECT 1 FROM owned_by_relation AS rel_owned_by1, cw_Note AS P WHERE rel_owned_by1.eid_from=P.cw_eid AND rel_owned_by1.eid_to=U.cw_eid)'''), |
492 WHERE EXISTS(SELECT 1 FROM owned_by_relation AS rel_owned_by0, cw_Affaire AS _P WHERE rel_owned_by0.eid_from=_P.cw_eid AND rel_owned_by0.eid_to=_U.cw_eid UNION SELECT 1 FROM owned_by_relation AS rel_owned_by1, cw_Note AS _P WHERE rel_owned_by1.eid_from=_P.cw_eid AND rel_owned_by1.eid_to=_U.cw_eid)'''), |
489 |
493 |
490 ('Any MAX(X)', |
494 ('Any MAX(X)', |
491 '''SELECT MAX(X.eid) |
495 '''SELECT MAX(_X.eid) |
492 FROM entities AS X'''), |
496 FROM entities AS _X'''), |
493 |
497 |
494 ('Any MAX(X) WHERE X is Note', |
498 ('Any MAX(X) WHERE X is Note', |
495 '''SELECT MAX(X.cw_eid) |
499 '''SELECT MAX(_X.cw_eid) |
496 FROM cw_Note AS X'''), |
500 FROM cw_Note AS _X'''), |
497 |
501 |
498 ('Any X WHERE X eid > 12', |
502 ('Any X WHERE X eid > 12', |
499 '''SELECT X.eid |
503 '''SELECT _X.eid |
500 FROM entities AS X |
504 FROM entities AS _X |
501 WHERE X.eid>12'''), |
505 WHERE _X.eid>12'''), |
502 |
506 |
503 ('Any X WHERE X eid > 12, X is Note', |
507 ('Any X WHERE X eid > 12, X is Note', |
504 """SELECT X.eid |
508 """SELECT _X.eid |
505 FROM entities AS X |
509 FROM entities AS _X |
506 WHERE X.type='Note' AND X.eid>12"""), |
510 WHERE _X.type='Note' AND _X.eid>12"""), |
507 |
511 |
508 ('Any X, T WHERE X eid > 12, X title T, X is IN (Bookmark, Card)', |
512 ('Any X, T WHERE X eid > 12, X title T, X is IN (Bookmark, Card)', |
509 """SELECT X.cw_eid, X.cw_title |
513 """SELECT _X.cw_eid, _X.cw_title |
510 FROM cw_Bookmark AS X |
514 FROM cw_Bookmark AS _X |
511 WHERE X.cw_eid>12 |
515 WHERE _X.cw_eid>12 |
512 UNION ALL |
516 UNION ALL |
513 SELECT X.cw_eid, X.cw_title |
517 SELECT _X.cw_eid, _X.cw_title |
514 FROM cw_Card AS X |
518 FROM cw_Card AS _X |
515 WHERE X.cw_eid>12"""), |
519 WHERE _X.cw_eid>12"""), |
516 |
520 |
517 ('Any X', |
521 ('Any X', |
518 '''SELECT X.eid |
522 '''SELECT _X.eid |
519 FROM entities AS X'''), |
523 FROM entities AS _X'''), |
520 |
524 |
521 ('Any X GROUPBY X WHERE X eid 12', |
525 ('Any X GROUPBY X WHERE X eid 12', |
522 '''SELECT 12'''), |
526 '''SELECT 12'''), |
523 |
527 |
524 ('Any X GROUPBY X ORDERBY Y WHERE X eid 12, X login Y', |
528 ('Any X GROUPBY X ORDERBY Y WHERE X eid 12, X login Y', |
525 '''SELECT X.cw_eid |
529 '''SELECT _X.cw_eid |
526 FROM cw_CWUser AS X |
530 FROM cw_CWUser AS _X |
527 WHERE X.cw_eid=12 |
531 WHERE _X.cw_eid=12 |
528 GROUP BY X.cw_eid |
532 GROUP BY _X.cw_eid,_X.cw_login |
529 ORDER BY X.cw_login'''), |
533 ORDER BY _X.cw_login'''), |
530 |
534 |
531 ('Any U,COUNT(X) GROUPBY U WHERE U eid 12, X owned_by U HAVING COUNT(X) > 10', |
535 ('Any U,COUNT(X) GROUPBY U WHERE U eid 12, X owned_by U HAVING COUNT(X) > 10', |
532 '''SELECT rel_owned_by0.eid_to, COUNT(rel_owned_by0.eid_from) |
536 '''SELECT rel_owned_by0.eid_to, COUNT(rel_owned_by0.eid_from) |
533 FROM owned_by_relation AS rel_owned_by0 |
537 FROM owned_by_relation AS rel_owned_by0 |
534 WHERE rel_owned_by0.eid_to=12 |
538 WHERE rel_owned_by0.eid_to=12 |
535 GROUP BY rel_owned_by0.eid_to |
539 GROUP BY rel_owned_by0.eid_to |
536 HAVING COUNT(rel_owned_by0.eid_from)>10'''), |
540 HAVING COUNT(rel_owned_by0.eid_from)>10'''), |
537 |
541 |
538 ('DISTINCT Any X ORDERBY stockproc(X) WHERE U login X', |
542 ('DISTINCT Any X ORDERBY stockproc(X) WHERE U login X', |
539 '''SELECT T1.C0 FROM (SELECT DISTINCT U.cw_login AS C0, STOCKPROC(U.cw_login) AS C1 |
543 '''SELECT T1.C0 FROM (SELECT DISTINCT _U.cw_login AS C0, STOCKPROC(_U.cw_login) AS C1 |
540 FROM cw_CWUser AS U |
544 FROM cw_CWUser AS _U |
541 ORDER BY 2) AS T1'''), |
545 ORDER BY 2) AS T1'''), |
542 |
546 |
543 ('DISTINCT Any X ORDERBY Y WHERE B bookmarked_by X, X login Y', |
547 ('DISTINCT Any X ORDERBY Y WHERE B bookmarked_by X, X login Y', |
544 '''SELECT T1.C0 FROM (SELECT DISTINCT X.cw_eid AS C0, X.cw_login AS C1 |
548 '''SELECT T1.C0 FROM (SELECT DISTINCT _X.cw_eid AS C0, _X.cw_login AS C1 |
545 FROM bookmarked_by_relation AS rel_bookmarked_by0, cw_CWUser AS X |
549 FROM bookmarked_by_relation AS rel_bookmarked_by0, cw_CWUser AS _X |
546 WHERE rel_bookmarked_by0.eid_to=X.cw_eid |
550 WHERE rel_bookmarked_by0.eid_to=_X.cw_eid |
547 ORDER BY 2) AS T1'''), |
551 ORDER BY 2) AS T1'''), |
548 |
552 |
549 ('DISTINCT Any X ORDERBY SN WHERE X in_state S, S name SN', |
553 ('DISTINCT Any X ORDERBY SN WHERE X in_state S, S name SN', |
550 '''SELECT T1.C0 FROM (SELECT DISTINCT X.cw_eid AS C0, S.cw_name AS C1 |
554 '''SELECT T1.C0 FROM (SELECT DISTINCT _X.cw_eid AS C0, _S.cw_name AS C1 |
551 FROM cw_Affaire AS X, cw_State AS S |
555 FROM cw_Affaire AS _X, cw_State AS _S |
552 WHERE X.cw_in_state=S.cw_eid |
556 WHERE _X.cw_in_state=_S.cw_eid |
553 UNION |
557 UNION |
554 SELECT DISTINCT X.cw_eid AS C0, S.cw_name AS C1 |
558 SELECT DISTINCT _X.cw_eid AS C0, _S.cw_name AS C1 |
555 FROM cw_CWUser AS X, cw_State AS S |
559 FROM cw_CWUser AS _X, cw_State AS _S |
556 WHERE X.cw_in_state=S.cw_eid |
560 WHERE _X.cw_in_state=_S.cw_eid |
557 UNION |
561 UNION |
558 SELECT DISTINCT X.cw_eid AS C0, S.cw_name AS C1 |
562 SELECT DISTINCT _X.cw_eid AS C0, _S.cw_name AS C1 |
559 FROM cw_Note AS X, cw_State AS S |
563 FROM cw_Note AS _X, cw_State AS _S |
560 WHERE X.cw_in_state=S.cw_eid |
564 WHERE _X.cw_in_state=_S.cw_eid |
561 ORDER BY 2) AS T1'''), |
565 ORDER BY 2) AS T1'''), |
562 |
566 |
563 ('Any O,AA,AB,AC ORDERBY AC DESC ' |
567 ('Any O,AA,AB,AC ORDERBY AC DESC ' |
564 'WHERE NOT S use_email O, S eid 1, O is EmailAddress, O address AA, O alias AB, O modification_date AC, ' |
568 'WHERE NOT S use_email O, S eid 1, O is EmailAddress, O address AA, O alias AB, O modification_date AC, ' |
565 'EXISTS(A use_email O, EXISTS(A identity B, NOT B in_group D, D name "guests", D is CWGroup), A is CWUser), B eid 2', |
569 'EXISTS(A use_email O, EXISTS(A identity B, NOT B in_group D, D name "guests", D is CWGroup), A is CWUser), B eid 2', |
566 '''SELECT O.cw_eid, O.cw_address, O.cw_alias, O.cw_modification_date |
570 '''SELECT _O.cw_eid, _O.cw_address, _O.cw_alias, _O.cw_modification_date |
567 FROM cw_EmailAddress AS O |
571 FROM cw_EmailAddress AS _O |
568 WHERE NOT EXISTS(SELECT 1 FROM use_email_relation AS rel_use_email0 WHERE rel_use_email0.eid_from=1 AND rel_use_email0.eid_to=O.cw_eid) AND EXISTS(SELECT 1 FROM use_email_relation AS rel_use_email1 WHERE rel_use_email1.eid_to=O.cw_eid AND EXISTS(SELECT 1 FROM cw_CWGroup AS D WHERE rel_use_email1.eid_from=2 AND NOT EXISTS(SELECT 1 FROM in_group_relation AS rel_in_group2 WHERE rel_in_group2.eid_from=2 AND rel_in_group2.eid_to=D.cw_eid) AND D.cw_name=guests)) |
572 WHERE NOT EXISTS(SELECT 1 FROM use_email_relation AS rel_use_email0 WHERE rel_use_email0.eid_from=1 AND rel_use_email0.eid_to=_O.cw_eid) AND EXISTS(SELECT 1 FROM use_email_relation AS rel_use_email1 WHERE rel_use_email1.eid_to=_O.cw_eid AND EXISTS(SELECT 1 FROM cw_CWGroup AS _D WHERE rel_use_email1.eid_from=2 AND NOT EXISTS(SELECT 1 FROM in_group_relation AS rel_in_group2 WHERE rel_in_group2.eid_from=2 AND rel_in_group2.eid_to=_D.cw_eid) AND _D.cw_name=guests)) |
569 ORDER BY 4 DESC'''), |
573 ORDER BY 4 DESC'''), |
570 |
574 |
571 |
575 |
572 ("Any X WHERE X eid 0, X eid 0", |
576 ("Any X WHERE X eid 0, X eid 0", |
573 '''SELECT 0'''), |
577 '''SELECT 0'''), |
574 |
578 |
575 ("Any X WHERE X eid 0, X eid 0, X test TRUE", |
579 ("Any X WHERE X eid 0, X eid 0, X test TRUE", |
576 '''SELECT X.cw_eid |
580 '''SELECT _X.cw_eid |
577 FROM cw_Personne AS X |
581 FROM cw_Personne AS _X |
578 WHERE X.cw_eid=0 AND X.cw_eid=0 AND X.cw_test='''), |
582 WHERE _X.cw_eid=0 AND _X.cw_eid=0 AND _X.cw_test=TRUE'''), |
|
583 |
|
584 ("Any X,GROUP_CONCAT(TN) GROUPBY X ORDERBY XN WHERE T tags X, X name XN, T name TN, X is CWGroup", |
|
585 '''SELECT _X.cw_eid, GROUP_CONCAT(_T.cw_name) |
|
586 FROM cw_CWGroup AS _X, cw_Tag AS _T, tags_relation AS rel_tags0 |
|
587 WHERE rel_tags0.eid_from=_T.cw_eid AND rel_tags0.eid_to=_X.cw_eid |
|
588 GROUP BY _X.cw_eid,_X.cw_name |
|
589 ORDER BY _X.cw_name'''), |
|
590 |
|
591 ("Any X,GROUP_CONCAT(TN) GROUPBY X ORDERBY XN WHERE T tags X, X name XN, T name TN", |
|
592 '''SELECT T1.C0, GROUP_CONCAT(T1.C1) FROM (SELECT _X.cw_eid AS C0, _T.cw_name AS C1, _X.cw_name AS C2 |
|
593 FROM cw_CWGroup AS _X, cw_Tag AS _T, tags_relation AS rel_tags0 |
|
594 WHERE rel_tags0.eid_from=_T.cw_eid AND rel_tags0.eid_to=_X.cw_eid |
|
595 UNION ALL |
|
596 SELECT _X.cw_eid AS C0, _T.cw_name AS C1, _X.cw_name AS C2 |
|
597 FROM cw_State AS _X, cw_Tag AS _T, tags_relation AS rel_tags0 |
|
598 WHERE rel_tags0.eid_from=_T.cw_eid AND rel_tags0.eid_to=_X.cw_eid |
|
599 UNION ALL |
|
600 SELECT _X.cw_eid AS C0, _T.cw_name AS C1, _X.cw_name AS C2 |
|
601 FROM cw_Tag AS _T, cw_Tag AS _X, tags_relation AS rel_tags0 |
|
602 WHERE rel_tags0.eid_from=_T.cw_eid AND rel_tags0.eid_to=_X.cw_eid) AS T1 |
|
603 GROUP BY T1.C0,T1.C2 |
|
604 ORDER BY T1.C2'''), |
|
605 |
579 ] |
606 ] |
580 |
607 |
581 MULTIPLE_SEL = [ |
608 MULTIPLE_SEL = [ |
582 ("DISTINCT Any X,Y where P is Personne, P nom X , P prenom Y;", |
609 ("DISTINCT Any X,Y where P is Personne, P nom X , P prenom Y;", |
583 '''SELECT DISTINCT P.cw_nom, P.cw_prenom |
610 '''SELECT DISTINCT _P.cw_nom, _P.cw_prenom |
584 FROM cw_Personne AS P'''), |
611 FROM cw_Personne AS _P'''), |
585 ("Any X,Y where P is Personne, P nom X , P prenom Y, not P nom NULL;", |
612 ("Any X,Y where P is Personne, P nom X , P prenom Y, not P nom NULL;", |
586 '''SELECT P.cw_nom, P.cw_prenom |
613 '''SELECT _P.cw_nom, _P.cw_prenom |
587 FROM cw_Personne AS P |
614 FROM cw_Personne AS _P |
588 WHERE NOT (P.cw_nom IS NULL)'''), |
615 WHERE NOT (_P.cw_nom IS NULL)'''), |
589 ("Personne X,Y where X nom NX, Y nom NX, X eid XE, not Y eid XE", |
616 ("Personne X,Y where X nom NX, Y nom NX, X eid XE, not Y eid XE", |
590 '''SELECT X.cw_eid, Y.cw_eid |
617 '''SELECT _X.cw_eid, _Y.cw_eid |
591 FROM cw_Personne AS X, cw_Personne AS Y |
618 FROM cw_Personne AS _X, cw_Personne AS _Y |
592 WHERE Y.cw_nom=X.cw_nom AND NOT (Y.cw_eid=X.cw_eid)''') |
619 WHERE _Y.cw_nom=_X.cw_nom AND NOT (_Y.cw_eid=_X.cw_eid)''') |
593 ] |
620 ] |
594 |
621 |
595 NEGATIONS = [ |
622 NEGATIONS = [ |
596 ("Personne X WHERE NOT X evaluee Y;", |
623 ("Personne X WHERE NOT X evaluee Y;", |
597 '''SELECT X.cw_eid |
624 '''SELECT _X.cw_eid |
598 FROM cw_Personne AS X |
625 FROM cw_Personne AS _X |
599 WHERE NOT EXISTS(SELECT 1 FROM evaluee_relation AS rel_evaluee0 WHERE rel_evaluee0.eid_from=X.cw_eid)'''), |
626 WHERE NOT EXISTS(SELECT 1 FROM evaluee_relation AS rel_evaluee0 WHERE rel_evaluee0.eid_from=_X.cw_eid)'''), |
600 |
627 |
601 ("Note N WHERE NOT X evaluee N, X eid 0", |
628 ("Note N WHERE NOT X evaluee N, X eid 0", |
602 '''SELECT N.cw_eid |
629 '''SELECT _N.cw_eid |
603 FROM cw_Note AS N |
630 FROM cw_Note AS _N |
604 WHERE NOT EXISTS(SELECT 1 FROM evaluee_relation AS rel_evaluee0 WHERE rel_evaluee0.eid_from=0 AND rel_evaluee0.eid_to=N.cw_eid)'''), |
631 WHERE NOT EXISTS(SELECT 1 FROM evaluee_relation AS rel_evaluee0 WHERE rel_evaluee0.eid_from=0 AND rel_evaluee0.eid_to=_N.cw_eid)'''), |
605 |
632 |
606 ('Any X WHERE NOT X travaille S, X is Personne', |
633 ('Any X WHERE NOT X travaille S, X is Personne', |
607 '''SELECT X.cw_eid |
634 '''SELECT _X.cw_eid |
608 FROM cw_Personne AS X |
635 FROM cw_Personne AS _X |
609 WHERE NOT EXISTS(SELECT 1 FROM travaille_relation AS rel_travaille0 WHERE rel_travaille0.eid_from=X.cw_eid)'''), |
636 WHERE NOT EXISTS(SELECT 1 FROM travaille_relation AS rel_travaille0 WHERE rel_travaille0.eid_from=_X.cw_eid)'''), |
610 |
637 |
611 ("Personne P where not P datenaiss TODAY", |
638 ("Personne P where not P datenaiss TODAY", |
612 '''SELECT P.cw_eid |
639 '''SELECT _P.cw_eid |
613 FROM cw_Personne AS P |
640 FROM cw_Personne AS _P |
614 WHERE NOT (DATE(P.cw_datenaiss)=CURRENT_DATE)'''), |
641 WHERE NOT (DATE(_P.cw_datenaiss)=CURRENT_DATE)'''), |
615 |
642 |
616 ("Personne P where NOT P concerne A", |
643 ("Personne P where NOT P concerne A", |
617 '''SELECT P.cw_eid |
644 '''SELECT _P.cw_eid |
618 FROM cw_Personne AS P |
645 FROM cw_Personne AS _P |
619 WHERE NOT EXISTS(SELECT 1 FROM concerne_relation AS rel_concerne0 WHERE rel_concerne0.eid_from=P.cw_eid)'''), |
646 WHERE NOT EXISTS(SELECT 1 FROM concerne_relation AS rel_concerne0 WHERE rel_concerne0.eid_from=_P.cw_eid)'''), |
620 |
647 |
621 ("Affaire A where not P concerne A", |
648 ("Affaire A where not P concerne A", |
622 '''SELECT A.cw_eid |
649 '''SELECT _A.cw_eid |
623 FROM cw_Affaire AS A |
650 FROM cw_Affaire AS _A |
624 WHERE NOT EXISTS(SELECT 1 FROM concerne_relation AS rel_concerne0 WHERE rel_concerne0.eid_to=A.cw_eid)'''), |
651 WHERE NOT EXISTS(SELECT 1 FROM concerne_relation AS rel_concerne0 WHERE rel_concerne0.eid_to=_A.cw_eid)'''), |
625 ("Personne P where not P concerne A, A sujet ~= 'TEST%'", |
652 ("Personne P where not P concerne A, A sujet ~= 'TEST%'", |
626 '''SELECT P.cw_eid |
653 '''SELECT _P.cw_eid |
627 FROM cw_Affaire AS A, cw_Personne AS P |
654 FROM cw_Affaire AS _A, cw_Personne AS _P |
628 WHERE NOT EXISTS(SELECT 1 FROM concerne_relation AS rel_concerne0 WHERE rel_concerne0.eid_from=P.cw_eid AND rel_concerne0.eid_to=A.cw_eid) AND A.cw_sujet ILIKE TEST%'''), |
655 WHERE NOT EXISTS(SELECT 1 FROM concerne_relation AS rel_concerne0 WHERE rel_concerne0.eid_from=_P.cw_eid AND rel_concerne0.eid_to=_A.cw_eid) AND _A.cw_sujet ILIKE TEST%'''), |
629 |
656 |
630 ('Any S WHERE NOT T eid 28258, T tags S', |
657 ('Any S WHERE NOT T eid 28258, T tags S', |
631 '''SELECT rel_tags0.eid_to |
658 '''SELECT rel_tags0.eid_to |
632 FROM tags_relation AS rel_tags0 |
659 FROM tags_relation AS rel_tags0 |
633 WHERE NOT (rel_tags0.eid_from=28258)'''), |
660 WHERE NOT (rel_tags0.eid_from=28258)'''), |
634 |
661 |
635 ('Any S WHERE T is Tag, T name TN, NOT T eid 28258, T tags S, S name SN', |
662 ('Any S WHERE T is Tag, T name TN, NOT T eid 28258, T tags S, S name SN', |
636 '''SELECT S.cw_eid |
663 '''SELECT _S.cw_eid |
637 FROM cw_CWGroup AS S, cw_Tag AS T, tags_relation AS rel_tags0 |
664 FROM cw_CWGroup AS _S, cw_Tag AS _T, tags_relation AS rel_tags0 |
638 WHERE NOT (T.cw_eid=28258) AND rel_tags0.eid_from=T.cw_eid AND rel_tags0.eid_to=S.cw_eid |
665 WHERE NOT (_T.cw_eid=28258) AND rel_tags0.eid_from=_T.cw_eid AND rel_tags0.eid_to=_S.cw_eid |
639 UNION ALL |
666 UNION ALL |
640 SELECT S.cw_eid |
667 SELECT _S.cw_eid |
641 FROM cw_State AS S, cw_Tag AS T, tags_relation AS rel_tags0 |
668 FROM cw_State AS _S, cw_Tag AS _T, tags_relation AS rel_tags0 |
642 WHERE NOT (T.cw_eid=28258) AND rel_tags0.eid_from=T.cw_eid AND rel_tags0.eid_to=S.cw_eid |
669 WHERE NOT (_T.cw_eid=28258) AND rel_tags0.eid_from=_T.cw_eid AND rel_tags0.eid_to=_S.cw_eid |
643 UNION ALL |
670 UNION ALL |
644 SELECT S.cw_eid |
671 SELECT _S.cw_eid |
645 FROM cw_Tag AS S, cw_Tag AS T, tags_relation AS rel_tags0 |
672 FROM cw_Tag AS _S, cw_Tag AS _T, tags_relation AS rel_tags0 |
646 WHERE NOT (T.cw_eid=28258) AND rel_tags0.eid_from=T.cw_eid AND rel_tags0.eid_to=S.cw_eid'''), |
673 WHERE NOT (_T.cw_eid=28258) AND rel_tags0.eid_from=_T.cw_eid AND rel_tags0.eid_to=_S.cw_eid'''), |
647 |
674 |
648 ('Any X,Y WHERE X created_by Y, X eid 5, NOT Y eid 6', |
675 ('Any X,Y WHERE X created_by Y, X eid 5, NOT Y eid 6', |
649 '''SELECT 5, rel_created_by0.eid_to |
676 '''SELECT 5, rel_created_by0.eid_to |
650 FROM created_by_relation AS rel_created_by0 |
677 FROM created_by_relation AS rel_created_by0 |
651 WHERE rel_created_by0.eid_from=5 AND NOT (rel_created_by0.eid_to=6)'''), |
678 WHERE rel_created_by0.eid_from=5 AND NOT (rel_created_by0.eid_to=6)'''), |
652 |
679 |
653 ('Note X WHERE NOT Y evaluee X', |
680 ('Note X WHERE NOT Y evaluee X', |
654 '''SELECT X.cw_eid |
681 '''SELECT _X.cw_eid |
655 FROM cw_Note AS X |
682 FROM cw_Note AS _X |
656 WHERE NOT EXISTS(SELECT 1 FROM evaluee_relation AS rel_evaluee0 WHERE rel_evaluee0.eid_to=X.cw_eid)'''), |
683 WHERE NOT EXISTS(SELECT 1 FROM evaluee_relation AS rel_evaluee0 WHERE rel_evaluee0.eid_to=_X.cw_eid)'''), |
657 |
684 |
658 ('Any Y WHERE NOT Y evaluee X', |
685 ('Any Y WHERE NOT Y evaluee X', |
659 '''SELECT Y.cw_eid |
686 '''SELECT _Y.cw_eid |
660 FROM cw_CWUser AS Y |
687 FROM cw_CWUser AS _Y |
661 WHERE NOT EXISTS(SELECT 1 FROM evaluee_relation AS rel_evaluee0 WHERE rel_evaluee0.eid_from=Y.cw_eid) |
688 WHERE NOT EXISTS(SELECT 1 FROM evaluee_relation AS rel_evaluee0 WHERE rel_evaluee0.eid_from=_Y.cw_eid) |
662 UNION ALL |
689 UNION ALL |
663 SELECT Y.cw_eid |
690 SELECT _Y.cw_eid |
664 FROM cw_Division AS Y |
691 FROM cw_Division AS _Y |
665 WHERE NOT EXISTS(SELECT 1 FROM evaluee_relation AS rel_evaluee0 WHERE rel_evaluee0.eid_from=Y.cw_eid) |
692 WHERE NOT EXISTS(SELECT 1 FROM evaluee_relation AS rel_evaluee0 WHERE rel_evaluee0.eid_from=_Y.cw_eid) |
666 UNION ALL |
693 UNION ALL |
667 SELECT Y.cw_eid |
694 SELECT _Y.cw_eid |
668 FROM cw_Personne AS Y |
695 FROM cw_Personne AS _Y |
669 WHERE NOT EXISTS(SELECT 1 FROM evaluee_relation AS rel_evaluee0 WHERE rel_evaluee0.eid_from=Y.cw_eid) |
696 WHERE NOT EXISTS(SELECT 1 FROM evaluee_relation AS rel_evaluee0 WHERE rel_evaluee0.eid_from=_Y.cw_eid) |
670 UNION ALL |
697 UNION ALL |
671 SELECT Y.cw_eid |
698 SELECT _Y.cw_eid |
672 FROM cw_Societe AS Y |
699 FROM cw_Societe AS _Y |
673 WHERE NOT EXISTS(SELECT 1 FROM evaluee_relation AS rel_evaluee0 WHERE rel_evaluee0.eid_from=Y.cw_eid) |
700 WHERE NOT EXISTS(SELECT 1 FROM evaluee_relation AS rel_evaluee0 WHERE rel_evaluee0.eid_from=_Y.cw_eid) |
674 UNION ALL |
701 UNION ALL |
675 SELECT Y.cw_eid |
702 SELECT _Y.cw_eid |
676 FROM cw_SubDivision AS Y |
703 FROM cw_SubDivision AS _Y |
677 WHERE NOT EXISTS(SELECT 1 FROM evaluee_relation AS rel_evaluee0 WHERE rel_evaluee0.eid_from=Y.cw_eid)'''), |
704 WHERE NOT EXISTS(SELECT 1 FROM evaluee_relation AS rel_evaluee0 WHERE rel_evaluee0.eid_from=_Y.cw_eid)'''), |
678 |
705 |
679 ('Any X WHERE NOT Y evaluee X, Y is CWUser', |
706 ('Any X WHERE NOT Y evaluee X, Y is CWUser', |
680 '''SELECT X.cw_eid |
707 '''SELECT _X.cw_eid |
681 FROM cw_Note AS X |
708 FROM cw_Note AS _X |
682 WHERE NOT EXISTS(SELECT 1 FROM evaluee_relation AS rel_evaluee0,cw_CWUser AS Y WHERE rel_evaluee0.eid_from=Y.cw_eid AND rel_evaluee0.eid_to=X.cw_eid)'''), |
709 WHERE NOT EXISTS(SELECT 1 FROM evaluee_relation AS rel_evaluee0,cw_CWUser AS _Y WHERE rel_evaluee0.eid_from=_Y.cw_eid AND rel_evaluee0.eid_to=_X.cw_eid)'''), |
683 |
710 |
684 ('Any X,RT WHERE X relation_type RT, NOT X is CWAttribute', |
711 ('Any X,RT WHERE X relation_type RT, NOT X is CWAttribute', |
685 '''SELECT X.cw_eid, X.cw_relation_type |
712 '''SELECT _X.cw_eid, _X.cw_relation_type |
686 FROM cw_CWRelation AS X |
713 FROM cw_CWRelation AS _X |
687 WHERE X.cw_relation_type IS NOT NULL'''), |
714 WHERE _X.cw_relation_type IS NOT NULL'''), |
688 |
715 |
689 ('Any K,V WHERE P is CWProperty, P pkey K, P value V, NOT P for_user U', |
716 ('Any K,V WHERE P is CWProperty, P pkey K, P value V, NOT P for_user U', |
690 '''SELECT P.cw_pkey, P.cw_value |
717 '''SELECT _P.cw_pkey, _P.cw_value |
691 FROM cw_CWProperty AS P |
718 FROM cw_CWProperty AS _P |
692 WHERE P.cw_for_user IS NULL'''), |
719 WHERE _P.cw_for_user IS NULL'''), |
693 |
720 |
694 ('Any S WHERE NOT X in_state S, X is IN(Affaire, CWUser)', |
721 ('Any S WHERE NOT X in_state S, X is IN(Affaire, CWUser)', |
695 '''SELECT S.cw_eid |
722 '''SELECT _S.cw_eid |
696 FROM cw_State AS S |
723 FROM cw_State AS _S |
697 WHERE NOT EXISTS(SELECT 1 FROM cw_Affaire AS X WHERE X.cw_in_state=S.cw_eid) |
724 WHERE NOT EXISTS(SELECT 1 FROM cw_Affaire AS _X WHERE _X.cw_in_state=_S.cw_eid) |
698 INTERSECT |
725 INTERSECT |
699 SELECT S.cw_eid |
726 SELECT _S.cw_eid |
700 FROM cw_State AS S |
727 FROM cw_State AS _S |
701 WHERE NOT EXISTS(SELECT 1 FROM cw_CWUser AS X WHERE X.cw_in_state=S.cw_eid)'''), |
728 WHERE NOT EXISTS(SELECT 1 FROM cw_CWUser AS _X WHERE _X.cw_in_state=_S.cw_eid)'''), |
702 |
729 |
703 ('Any S WHERE NOT(X in_state S, S name "somename"), X is CWUser', |
730 ('Any S WHERE NOT(X in_state S, S name "somename"), X is CWUser', |
704 '''SELECT S.cw_eid |
731 '''SELECT _S.cw_eid |
705 FROM cw_State AS S |
732 FROM cw_State AS _S |
706 WHERE NOT EXISTS(SELECT 1 FROM cw_CWUser AS X WHERE X.cw_in_state=S.cw_eid AND S.cw_name=somename)'''), |
733 WHERE NOT EXISTS(SELECT 1 FROM cw_CWUser AS _X WHERE _X.cw_in_state=_S.cw_eid AND _S.cw_name=somename)'''), |
707 |
734 |
708 # XXXFIXME fail |
735 # XXXFIXME fail |
709 # ('Any X,RT WHERE X relation_type RT?, NOT X is CWAttribute', |
736 # ('Any X,RT WHERE X relation_type RT?, NOT X is CWAttribute', |
710 # '''SELECT X.cw_eid, X.cw_relation_type |
737 # '''SELECT _X.cw_eid, _X.cw_relation_type |
711 # FROM cw_CWRelation AS X'''), |
738 # FROM cw_CWRelation AS _X'''), |
712 ] |
739 ] |
713 |
740 |
714 OUTER_JOIN = [ |
741 OUTER_JOIN = [ |
715 ('Any X,S WHERE X travaille S?', |
742 ('Any X,S WHERE X travaille S?', |
716 '''SELECT X.cw_eid, rel_travaille0.eid_to |
743 '''SELECT _X.cw_eid, rel_travaille0.eid_to |
717 FROM cw_Personne AS X LEFT OUTER JOIN travaille_relation AS rel_travaille0 ON (rel_travaille0.eid_from=X.cw_eid)''' |
744 FROM cw_Personne AS _X LEFT OUTER JOIN travaille_relation AS rel_travaille0 ON (rel_travaille0.eid_from=_X.cw_eid)''' |
718 ), |
745 ), |
719 ('Any S,X WHERE X? travaille S, S is Societe', |
746 ('Any S,X WHERE X? travaille S, S is Societe', |
720 '''SELECT S.cw_eid, rel_travaille0.eid_from |
747 '''SELECT _S.cw_eid, rel_travaille0.eid_from |
721 FROM cw_Societe AS S LEFT OUTER JOIN travaille_relation AS rel_travaille0 ON (rel_travaille0.eid_to=S.cw_eid)''' |
748 FROM cw_Societe AS _S LEFT OUTER JOIN travaille_relation AS rel_travaille0 ON (rel_travaille0.eid_to=_S.cw_eid)''' |
722 ), |
749 ), |
723 |
750 |
724 ('Any N,A WHERE N inline1 A?', |
751 ('Any N,A WHERE N inline1 A?', |
725 '''SELECT N.cw_eid, N.cw_inline1 |
752 '''SELECT _N.cw_eid, _N.cw_inline1 |
726 FROM cw_Note AS N'''), |
753 FROM cw_Note AS _N'''), |
727 |
754 |
728 ('Any SN WHERE X from_state S?, S name SN', |
755 ('Any SN WHERE X from_state S?, S name SN', |
729 '''SELECT S.cw_name |
756 '''SELECT _S.cw_name |
730 FROM cw_TrInfo AS X LEFT OUTER JOIN cw_State AS S ON (X.cw_from_state=S.cw_eid)''' |
757 FROM cw_TrInfo AS _X LEFT OUTER JOIN cw_State AS _S ON (_X.cw_from_state=_S.cw_eid)''' |
731 ), |
758 ), |
732 |
759 |
733 ('Any A,N WHERE N? inline1 A', |
760 ('Any A,N WHERE N? inline1 A', |
734 '''SELECT A.cw_eid, N.cw_eid |
761 '''SELECT _A.cw_eid, _N.cw_eid |
735 FROM cw_Affaire AS A LEFT OUTER JOIN cw_Note AS N ON (N.cw_inline1=A.cw_eid)''' |
762 FROM cw_Affaire AS _A LEFT OUTER JOIN cw_Note AS _N ON (_N.cw_inline1=_A.cw_eid)''' |
736 ), |
763 ), |
737 |
764 |
738 ('Any A,B,C,D,E,F,G WHERE A eid 12,A creation_date B,A modification_date C,A comment D,A from_state E?,A to_state F?,A wf_info_for G?', |
765 ('Any A,B,C,D,E,F,G WHERE A eid 12,A creation_date B,A modification_date C,A comment D,A from_state E?,A to_state F?,A wf_info_for G?', |
739 '''SELECT A.cw_eid, A.cw_creation_date, A.cw_modification_date, A.cw_comment, A.cw_from_state, A.cw_to_state, A.cw_wf_info_for |
766 '''SELECT _A.cw_eid, _A.cw_creation_date, _A.cw_modification_date, _A.cw_comment, _A.cw_from_state, _A.cw_to_state, _A.cw_wf_info_for |
740 FROM cw_TrInfo AS A |
767 FROM cw_TrInfo AS _A |
741 WHERE A.cw_eid=12'''), |
768 WHERE _A.cw_eid=12'''), |
742 |
769 |
743 ('Any FS,TS,C,D,U ORDERBY D DESC WHERE WF wf_info_for X,WF from_state FS?, WF to_state TS, WF comment C,WF creation_date D, WF owned_by U, X eid 1', |
770 ('Any FS,TS,C,D,U ORDERBY D DESC WHERE WF wf_info_for X,WF from_state FS?, WF to_state TS, WF comment C,WF creation_date D, WF owned_by U, X eid 1', |
744 '''SELECT WF.cw_from_state, WF.cw_to_state, WF.cw_comment, WF.cw_creation_date, rel_owned_by0.eid_to |
771 '''SELECT _WF.cw_from_state, _WF.cw_to_state, _WF.cw_comment, _WF.cw_creation_date, rel_owned_by0.eid_to |
745 FROM cw_TrInfo AS WF, owned_by_relation AS rel_owned_by0 |
772 FROM cw_TrInfo AS _WF, owned_by_relation AS rel_owned_by0 |
746 WHERE WF.cw_wf_info_for=1 AND WF.cw_to_state IS NOT NULL AND rel_owned_by0.eid_from=WF.cw_eid |
773 WHERE _WF.cw_wf_info_for=1 AND _WF.cw_to_state IS NOT NULL AND rel_owned_by0.eid_from=_WF.cw_eid |
747 ORDER BY 4 DESC'''), |
774 ORDER BY 4 DESC'''), |
748 |
775 |
749 ('Any X WHERE X is Affaire, S is Societe, EXISTS(X owned_by U OR (X concerne S?, S owned_by U))', |
776 ('Any X WHERE X is Affaire, S is Societe, EXISTS(X owned_by U OR (X concerne S?, S owned_by U))', |
750 '''SELECT X.cw_eid |
777 '''SELECT _X.cw_eid |
751 FROM cw_Affaire AS X |
778 FROM cw_Affaire AS _X |
752 WHERE EXISTS(SELECT 1 FROM owned_by_relation AS rel_owned_by0, cw_CWUser AS U, cw_Affaire AS A LEFT OUTER JOIN concerne_relation AS rel_concerne1 ON (rel_concerne1.eid_from=A.cw_eid) LEFT OUTER JOIN cw_Societe AS S ON (rel_concerne1.eid_to=S.cw_eid), owned_by_relation AS rel_owned_by2 WHERE ((rel_owned_by0.eid_from=A.cw_eid AND rel_owned_by0.eid_to=U.cw_eid) OR (rel_owned_by2.eid_from=S.cw_eid AND rel_owned_by2.eid_to=U.cw_eid)) AND X.cw_eid=A.cw_eid)'''), |
779 WHERE EXISTS(SELECT 1 FROM owned_by_relation AS rel_owned_by0, cw_CWUser AS _U, cw_Affaire AS _A LEFT OUTER JOIN concerne_relation AS rel_concerne1 ON (rel_concerne1.eid_from=_A.cw_eid) LEFT OUTER JOIN cw_Societe AS _S ON (rel_concerne1.eid_to=_S.cw_eid), owned_by_relation AS rel_owned_by2 WHERE ((rel_owned_by0.eid_from=_A.cw_eid AND rel_owned_by0.eid_to=_U.cw_eid) OR (rel_owned_by2.eid_from=_S.cw_eid AND rel_owned_by2.eid_to=_U.cw_eid)) AND _X.cw_eid=_A.cw_eid)'''), |
753 |
780 |
754 ('Any C,M WHERE C travaille G?, G evaluee M?, G is Societe', |
781 ('Any C,M WHERE C travaille G?, G evaluee M?, G is Societe', |
755 '''SELECT C.cw_eid, rel_evaluee1.eid_to |
782 '''SELECT _C.cw_eid, rel_evaluee1.eid_to |
756 FROM cw_Personne AS C LEFT OUTER JOIN travaille_relation AS rel_travaille0 ON (rel_travaille0.eid_from=C.cw_eid) LEFT OUTER JOIN cw_Societe AS G ON (rel_travaille0.eid_to=G.cw_eid) LEFT OUTER JOIN evaluee_relation AS rel_evaluee1 ON (rel_evaluee1.eid_from=G.cw_eid)''' |
783 FROM cw_Personne AS _C LEFT OUTER JOIN travaille_relation AS rel_travaille0 ON (rel_travaille0.eid_from=_C.cw_eid) LEFT OUTER JOIN cw_Societe AS _G ON (rel_travaille0.eid_to=_G.cw_eid) LEFT OUTER JOIN evaluee_relation AS rel_evaluee1 ON (rel_evaluee1.eid_from=_G.cw_eid)''' |
757 ), |
784 ), |
758 |
785 |
759 ('Any A,C WHERE A documented_by C?, (C is NULL) OR (EXISTS(C require_permission F, ' |
786 ('Any A,C WHERE A documented_by C?, (C is NULL) OR (EXISTS(C require_permission F, ' |
760 'F name "read", F require_group E, U in_group E)), U eid 1', |
787 'F name "read", F require_group E, U in_group E)), U eid 1', |
761 '''SELECT A.cw_eid, rel_documented_by0.eid_to |
788 '''SELECT _A.cw_eid, rel_documented_by0.eid_to |
762 FROM cw_Affaire AS A LEFT OUTER JOIN documented_by_relation AS rel_documented_by0 ON (rel_documented_by0.eid_from=A.cw_eid) |
789 FROM cw_Affaire AS _A LEFT OUTER JOIN documented_by_relation AS rel_documented_by0 ON (rel_documented_by0.eid_from=_A.cw_eid) |
763 WHERE ((rel_documented_by0.eid_to IS NULL) OR (EXISTS(SELECT 1 FROM require_permission_relation AS rel_require_permission1, cw_CWPermission AS F, require_group_relation AS rel_require_group2, in_group_relation AS rel_in_group3 WHERE rel_documented_by0.eid_to=rel_require_permission1.eid_from AND rel_require_permission1.eid_to=F.cw_eid AND F.cw_name=read AND rel_require_group2.eid_from=F.cw_eid AND rel_in_group3.eid_to=rel_require_group2.eid_to AND rel_in_group3.eid_from=1)))'''), |
790 WHERE ((rel_documented_by0.eid_to IS NULL) OR (EXISTS(SELECT 1 FROM require_permission_relation AS rel_require_permission1, cw_CWPermission AS _F, require_group_relation AS rel_require_group2, in_group_relation AS rel_in_group3 WHERE rel_documented_by0.eid_to=rel_require_permission1.eid_from AND rel_require_permission1.eid_to=_F.cw_eid AND _F.cw_name=read AND rel_require_group2.eid_from=_F.cw_eid AND rel_in_group3.eid_to=rel_require_group2.eid_to AND rel_in_group3.eid_from=1)))'''), |
764 |
791 |
765 ("Any X WHERE X eid 12, P? connait X", |
792 ("Any X WHERE X eid 12, P? connait X", |
766 '''SELECT X.cw_eid |
793 '''SELECT _X.cw_eid |
767 FROM cw_Personne AS X LEFT OUTER JOIN connait_relation AS rel_connait0 ON (rel_connait0.eid_to=12) |
794 FROM cw_Personne AS _X LEFT OUTER JOIN connait_relation AS rel_connait0 ON (rel_connait0.eid_to=12) |
768 WHERE X.cw_eid=12''' |
795 WHERE _X.cw_eid=12''' |
769 ), |
796 ), |
770 |
797 |
771 ('Any GN, TN ORDERBY GN WHERE T tags G?, T name TN, G name GN', |
798 ('Any GN, TN ORDERBY GN WHERE T tags G?, T name TN, G name GN', |
772 ''' |
799 ''' |
773 SELECT _T0.C1, T.cw_name |
800 SELECT _T0.C1, _T.cw_name |
774 FROM cw_Tag AS T LEFT OUTER JOIN tags_relation AS rel_tags0 ON (rel_tags0.eid_from=T.cw_eid) LEFT OUTER JOIN (SELECT G.cw_eid AS C0, G.cw_name AS C1 |
801 FROM cw_Tag AS _T LEFT OUTER JOIN tags_relation AS rel_tags0 ON (rel_tags0.eid_from=_T.cw_eid) LEFT OUTER JOIN (SELECT _G.cw_eid AS C0, _G.cw_name AS C1 |
775 FROM cw_CWGroup AS G |
802 FROM cw_CWGroup AS _G |
776 UNION ALL |
803 UNION ALL |
777 SELECT G.cw_eid AS C0, G.cw_name AS C1 |
804 SELECT _G.cw_eid AS C0, _G.cw_name AS C1 |
778 FROM cw_State AS G |
805 FROM cw_State AS _G |
779 UNION ALL |
806 UNION ALL |
780 SELECT G.cw_eid AS C0, G.cw_name AS C1 |
807 SELECT _G.cw_eid AS C0, _G.cw_name AS C1 |
781 FROM cw_Tag AS G) AS _T0 ON (rel_tags0.eid_to=_T0.C0) |
808 FROM cw_Tag AS _G) AS _T0 ON (rel_tags0.eid_to=_T0.C0) |
782 ORDER BY 1'''), |
809 ORDER BY 1'''), |
783 |
810 |
784 |
811 |
785 # optional variable with additional restriction |
812 # optional variable with additional restriction |
786 ('Any T,G WHERE T tags G?, G name "hop", G is CWGroup', |
813 ('Any T,G WHERE T tags G?, G name "hop", G is CWGroup', |
787 '''SELECT T.cw_eid, G.cw_eid |
814 '''SELECT _T.cw_eid, _G.cw_eid |
788 FROM cw_Tag AS T LEFT OUTER JOIN tags_relation AS rel_tags0 ON (rel_tags0.eid_from=T.cw_eid) LEFT OUTER JOIN cw_CWGroup AS G ON (rel_tags0.eid_to=G.cw_eid AND G.cw_name=hop)'''), |
815 FROM cw_Tag AS _T LEFT OUTER JOIN tags_relation AS rel_tags0 ON (rel_tags0.eid_from=_T.cw_eid) LEFT OUTER JOIN cw_CWGroup AS _G ON (rel_tags0.eid_to=_G.cw_eid AND _G.cw_name=hop)'''), |
789 |
816 |
790 # optional variable with additional invariant restriction |
817 # optional variable with additional invariant restriction |
791 ('Any T,G WHERE T tags G?, G eid 12', |
818 ('Any T,G WHERE T tags G?, G eid 12', |
792 '''SELECT T.cw_eid, rel_tags0.eid_to |
819 '''SELECT _T.cw_eid, rel_tags0.eid_to |
793 FROM cw_Tag AS T LEFT OUTER JOIN tags_relation AS rel_tags0 ON (rel_tags0.eid_from=T.cw_eid AND rel_tags0.eid_to=12)'''), |
820 FROM cw_Tag AS _T LEFT OUTER JOIN tags_relation AS rel_tags0 ON (rel_tags0.eid_from=_T.cw_eid AND rel_tags0.eid_to=12)'''), |
794 |
821 |
795 # optional variable with additional restriction appearing before the relation |
822 # optional variable with additional restriction appearing before the relation |
796 ('Any T,G WHERE G name "hop", T tags G?, G is CWGroup', |
823 ('Any T,G WHERE G name "hop", T tags G?, G is CWGroup', |
797 '''SELECT T.cw_eid, G.cw_eid |
824 '''SELECT _T.cw_eid, _G.cw_eid |
798 FROM cw_Tag AS T LEFT OUTER JOIN tags_relation AS rel_tags0 ON (rel_tags0.eid_from=T.cw_eid) LEFT OUTER JOIN cw_CWGroup AS G ON (rel_tags0.eid_to=G.cw_eid AND G.cw_name=hop)'''), |
825 FROM cw_Tag AS _T LEFT OUTER JOIN tags_relation AS rel_tags0 ON (rel_tags0.eid_from=_T.cw_eid) LEFT OUTER JOIN cw_CWGroup AS _G ON (rel_tags0.eid_to=_G.cw_eid AND _G.cw_name=hop)'''), |
799 |
826 |
800 # optional variable with additional restriction on inlined relation |
827 # optional variable with additional restriction on inlined relation |
801 # XXX the expected result should be as the query below. So what, raise BadRQLQuery ? |
828 # XXX the expected result should be as the query below. So what, raise BadRQLQuery ? |
802 ('Any T,G,S WHERE T tags G?, G in_state S, S name "hop", G is CWUser', |
829 ('Any T,G,S WHERE T tags G?, G in_state S, S name "hop", G is CWUser', |
803 '''SELECT T.cw_eid, G.cw_eid, S.cw_eid |
830 '''SELECT _T.cw_eid, _G.cw_eid, _S.cw_eid |
804 FROM cw_State AS S, cw_Tag AS T LEFT OUTER JOIN tags_relation AS rel_tags0 ON (rel_tags0.eid_from=T.cw_eid) LEFT OUTER JOIN cw_CWUser AS G ON (rel_tags0.eid_to=G.cw_eid) |
831 FROM cw_State AS _S, cw_Tag AS _T LEFT OUTER JOIN tags_relation AS rel_tags0 ON (rel_tags0.eid_from=_T.cw_eid) LEFT OUTER JOIN cw_CWUser AS _G ON (rel_tags0.eid_to=_G.cw_eid) |
805 WHERE G.cw_in_state=S.cw_eid AND S.cw_name=hop |
832 WHERE _G.cw_in_state=_S.cw_eid AND _S.cw_name=hop |
806 '''), |
833 '''), |
807 |
834 |
808 # optional variable with additional invariant restriction on an inlined relation |
835 # optional variable with additional invariant restriction on an inlined relation |
809 ('Any T,G,S WHERE T tags G, G in_state S?, S eid 1, G is CWUser', |
836 ('Any T,G,S WHERE T tags G, G in_state S?, S eid 1, G is CWUser', |
810 '''SELECT rel_tags0.eid_from, G.cw_eid, G.cw_in_state |
837 '''SELECT rel_tags0.eid_from, _G.cw_eid, _G.cw_in_state |
811 FROM cw_CWUser AS G, tags_relation AS rel_tags0 |
838 FROM cw_CWUser AS _G, tags_relation AS rel_tags0 |
812 WHERE rel_tags0.eid_to=G.cw_eid AND (G.cw_in_state=1 OR G.cw_in_state IS NULL)'''), |
839 WHERE rel_tags0.eid_to=_G.cw_eid AND (_G.cw_in_state=1 OR _G.cw_in_state IS NULL)'''), |
813 |
840 |
814 # two optional variables with additional invariant restriction on an inlined relation |
841 # two optional variables with additional invariant restriction on an inlined relation |
815 ('Any T,G,S WHERE T tags G?, G in_state S?, S eid 1, G is CWUser', |
842 ('Any T,G,S WHERE T tags G?, G in_state S?, S eid 1, G is CWUser', |
816 '''SELECT T.cw_eid, G.cw_eid, G.cw_in_state |
843 '''SELECT _T.cw_eid, _G.cw_eid, _G.cw_in_state |
817 FROM cw_Tag AS T LEFT OUTER JOIN tags_relation AS rel_tags0 ON (rel_tags0.eid_from=T.cw_eid) LEFT OUTER JOIN cw_CWUser AS G ON (rel_tags0.eid_to=G.cw_eid AND (G.cw_in_state=1 OR G.cw_in_state IS NULL))'''), |
844 FROM cw_Tag AS _T LEFT OUTER JOIN tags_relation AS rel_tags0 ON (rel_tags0.eid_from=_T.cw_eid) LEFT OUTER JOIN cw_CWUser AS _G ON (rel_tags0.eid_to=_G.cw_eid AND (_G.cw_in_state=1 OR _G.cw_in_state IS NULL))'''), |
818 |
845 |
819 # two optional variables with additional restriction on an inlined relation |
846 # two optional variables with additional restriction on an inlined relation |
820 ('Any T,G,S WHERE T tags G?, G in_state S?, S name "hop", G is CWUser', |
847 ('Any T,G,S WHERE T tags G?, G in_state S?, S name "hop", G is CWUser', |
821 '''SELECT T.cw_eid, G.cw_eid, S.cw_eid |
848 '''SELECT _T.cw_eid, _G.cw_eid, _S.cw_eid |
822 FROM cw_Tag AS T LEFT OUTER JOIN tags_relation AS rel_tags0 ON (rel_tags0.eid_from=T.cw_eid) LEFT OUTER JOIN cw_CWUser AS G ON (rel_tags0.eid_to=G.cw_eid) LEFT OUTER JOIN cw_State AS S ON (G.cw_in_state=S.cw_eid AND S.cw_name=hop)'''), |
849 FROM cw_Tag AS _T LEFT OUTER JOIN tags_relation AS rel_tags0 ON (rel_tags0.eid_from=_T.cw_eid) LEFT OUTER JOIN cw_CWUser AS _G ON (rel_tags0.eid_to=_G.cw_eid) LEFT OUTER JOIN cw_State AS _S ON (_G.cw_in_state=_S.cw_eid AND _S.cw_name=hop)'''), |
823 |
850 |
824 # two optional variables with additional restriction on an ambigous inlined relation |
851 # two optional variables with additional restriction on an ambigous inlined relation |
825 ('Any T,G,S WHERE T tags G?, G in_state S?, S name "hop"', |
852 ('Any T,G,S WHERE T tags G?, G in_state S?, S name "hop"', |
826 ''' |
853 ''' |
827 SELECT T.cw_eid, _T0.C0, _T0.C1 |
854 SELECT _T.cw_eid, _T0.C0, _T0.C1 |
828 FROM cw_Tag AS T LEFT OUTER JOIN tags_relation AS rel_tags0 ON (rel_tags0.eid_from=T.cw_eid) LEFT OUTER JOIN (SELECT G.cw_eid AS C0, S.cw_eid AS C1 |
855 FROM cw_Tag AS _T LEFT OUTER JOIN tags_relation AS rel_tags0 ON (rel_tags0.eid_from=_T.cw_eid) LEFT OUTER JOIN (SELECT _G.cw_eid AS C0, _S.cw_eid AS C1 |
829 FROM cw_Affaire AS G LEFT OUTER JOIN cw_State AS S ON (G.cw_in_state=S.cw_eid AND S.cw_name=hop) |
856 FROM cw_Affaire AS _G LEFT OUTER JOIN cw_State AS _S ON (_G.cw_in_state=_S.cw_eid AND _S.cw_name=hop) |
830 UNION ALL |
857 UNION ALL |
831 SELECT G.cw_eid AS C0, S.cw_eid AS C1 |
858 SELECT _G.cw_eid AS C0, _S.cw_eid AS C1 |
832 FROM cw_CWUser AS G LEFT OUTER JOIN cw_State AS S ON (G.cw_in_state=S.cw_eid AND S.cw_name=hop) |
859 FROM cw_CWUser AS _G LEFT OUTER JOIN cw_State AS _S ON (_G.cw_in_state=_S.cw_eid AND _S.cw_name=hop) |
833 UNION ALL |
860 UNION ALL |
834 SELECT G.cw_eid AS C0, S.cw_eid AS C1 |
861 SELECT _G.cw_eid AS C0, _S.cw_eid AS C1 |
835 FROM cw_Note AS G LEFT OUTER JOIN cw_State AS S ON (G.cw_in_state=S.cw_eid AND S.cw_name=hop) ) AS _T0 ON (rel_tags0.eid_to=_T0.C0)'''), |
862 FROM cw_Note AS _G LEFT OUTER JOIN cw_State AS _S ON (_G.cw_in_state=_S.cw_eid AND _S.cw_name=hop) ) AS _T0 ON (rel_tags0.eid_to=_T0.C0)'''), |
836 |
863 |
837 ('Any O,AD WHERE NOT S inline1 O, S eid 123, O todo_by AD?', |
864 ('Any O,AD WHERE NOT S inline1 O, S eid 123, O todo_by AD?', |
838 '''SELECT O.cw_eid, rel_todo_by0.eid_to |
865 '''SELECT _O.cw_eid, rel_todo_by0.eid_to |
839 FROM cw_Affaire AS O LEFT OUTER JOIN todo_by_relation AS rel_todo_by0 ON (rel_todo_by0.eid_from=O.cw_eid), cw_Note AS S |
866 FROM cw_Affaire AS _O LEFT OUTER JOIN todo_by_relation AS rel_todo_by0 ON (rel_todo_by0.eid_from=_O.cw_eid), cw_Note AS _S |
840 WHERE NOT EXISTS(SELECT 1 WHERE S.cw_inline1=O.cw_eid) AND S.cw_eid=123''') |
867 WHERE NOT EXISTS(SELECT 1 WHERE _S.cw_inline1=_O.cw_eid) AND _S.cw_eid=123''') |
841 ] |
868 ] |
842 |
869 |
843 VIRTUAL_VARS = [ |
870 VIRTUAL_VARS = [ |
844 ("Personne P WHERE P travaille S, S tel T, S fax T, S is Societe;", |
871 ("Personne P WHERE P travaille S, S tel T, S fax T, S is Societe;", |
845 '''SELECT rel_travaille0.eid_from |
872 '''SELECT rel_travaille0.eid_from |
846 FROM cw_Societe AS S, travaille_relation AS rel_travaille0 |
873 FROM cw_Societe AS _S, travaille_relation AS rel_travaille0 |
847 WHERE rel_travaille0.eid_to=S.cw_eid AND S.cw_fax=S.cw_tel'''), |
874 WHERE rel_travaille0.eid_to=_S.cw_eid AND _S.cw_fax=_S.cw_tel'''), |
848 |
875 |
849 ("Personne P where X eid 0, X creation_date D, P datenaiss < D, X is Affaire", |
876 ("Personne P where X eid 0, X creation_date D, P datenaiss < D, X is Affaire", |
850 '''SELECT P.cw_eid |
877 '''SELECT _P.cw_eid |
851 FROM cw_Affaire AS X, cw_Personne AS P |
878 FROM cw_Affaire AS _X, cw_Personne AS _P |
852 WHERE X.cw_eid=0 AND P.cw_datenaiss<X.cw_creation_date'''), |
879 WHERE _X.cw_eid=0 AND _P.cw_datenaiss<_X.cw_creation_date'''), |
853 |
880 |
854 ("Any N,T WHERE N is Note, N type T;", |
881 ("Any N,T WHERE N is Note, N type T;", |
855 '''SELECT N.cw_eid, N.cw_type |
882 '''SELECT _N.cw_eid, _N.cw_type |
856 FROM cw_Note AS N'''), |
883 FROM cw_Note AS _N'''), |
857 |
884 |
858 ("Personne P where X is Personne, X tel T, X fax F, P fax T+F", |
885 ("Personne P where X is Personne, X tel T, X fax F, P fax T+F", |
859 '''SELECT P.cw_eid |
886 '''SELECT _P.cw_eid |
860 FROM cw_Personne AS P, cw_Personne AS X |
887 FROM cw_Personne AS _P, cw_Personne AS _X |
861 WHERE P.cw_fax=(X.cw_tel + X.cw_fax)'''), |
888 WHERE _P.cw_fax=(_X.cw_tel + _X.cw_fax)'''), |
862 |
889 |
863 ("Personne P where X tel T, X fax F, P fax IN (T,F)", |
890 ("Personne P where X tel T, X fax F, P fax IN (T,F)", |
864 '''SELECT P.cw_eid |
891 '''SELECT _P.cw_eid |
865 FROM cw_Division AS X, cw_Personne AS P |
892 FROM cw_Division AS _X, cw_Personne AS _P |
866 WHERE P.cw_fax IN(X.cw_tel, X.cw_fax) |
893 WHERE _P.cw_fax IN(_X.cw_tel, _X.cw_fax) |
867 UNION ALL |
894 UNION ALL |
868 SELECT P.cw_eid |
895 SELECT _P.cw_eid |
869 FROM cw_Personne AS P, cw_Personne AS X |
896 FROM cw_Personne AS _P, cw_Personne AS _X |
870 WHERE P.cw_fax IN(X.cw_tel, X.cw_fax) |
897 WHERE _P.cw_fax IN(_X.cw_tel, _X.cw_fax) |
871 UNION ALL |
898 UNION ALL |
872 SELECT P.cw_eid |
899 SELECT _P.cw_eid |
873 FROM cw_Personne AS P, cw_Societe AS X |
900 FROM cw_Personne AS _P, cw_Societe AS _X |
874 WHERE P.cw_fax IN(X.cw_tel, X.cw_fax) |
901 WHERE _P.cw_fax IN(_X.cw_tel, _X.cw_fax) |
875 UNION ALL |
902 UNION ALL |
876 SELECT P.cw_eid |
903 SELECT _P.cw_eid |
877 FROM cw_Personne AS P, cw_SubDivision AS X |
904 FROM cw_Personne AS _P, cw_SubDivision AS _X |
878 WHERE P.cw_fax IN(X.cw_tel, X.cw_fax)'''), |
905 WHERE _P.cw_fax IN(_X.cw_tel, _X.cw_fax)'''), |
879 |
906 |
880 ("Personne P where X tel T, X fax F, P fax IN (T,F,0832542332)", |
907 ("Personne P where X tel T, X fax F, P fax IN (T,F,0832542332)", |
881 '''SELECT P.cw_eid |
908 '''SELECT _P.cw_eid |
882 FROM cw_Division AS X, cw_Personne AS P |
909 FROM cw_Division AS _X, cw_Personne AS _P |
883 WHERE P.cw_fax IN(X.cw_tel, X.cw_fax, 832542332) |
910 WHERE _P.cw_fax IN(_X.cw_tel, _X.cw_fax, 832542332) |
884 UNION ALL |
911 UNION ALL |
885 SELECT P.cw_eid |
912 SELECT _P.cw_eid |
886 FROM cw_Personne AS P, cw_Personne AS X |
913 FROM cw_Personne AS _P, cw_Personne AS _X |
887 WHERE P.cw_fax IN(X.cw_tel, X.cw_fax, 832542332) |
914 WHERE _P.cw_fax IN(_X.cw_tel, _X.cw_fax, 832542332) |
888 UNION ALL |
915 UNION ALL |
889 SELECT P.cw_eid |
916 SELECT _P.cw_eid |
890 FROM cw_Personne AS P, cw_Societe AS X |
917 FROM cw_Personne AS _P, cw_Societe AS _X |
891 WHERE P.cw_fax IN(X.cw_tel, X.cw_fax, 832542332) |
918 WHERE _P.cw_fax IN(_X.cw_tel, _X.cw_fax, 832542332) |
892 UNION ALL |
919 UNION ALL |
893 SELECT P.cw_eid |
920 SELECT _P.cw_eid |
894 FROM cw_Personne AS P, cw_SubDivision AS X |
921 FROM cw_Personne AS _P, cw_SubDivision AS _X |
895 WHERE P.cw_fax IN(X.cw_tel, X.cw_fax, 832542332)'''), |
922 WHERE _P.cw_fax IN(_X.cw_tel, _X.cw_fax, 832542332)'''), |
896 ] |
923 ] |
897 |
924 |
898 FUNCS = [ |
925 FUNCS = [ |
899 ("Any COUNT(P) WHERE P is Personne", |
926 ("Any COUNT(P) WHERE P is Personne", |
900 '''SELECT COUNT(P.cw_eid) |
927 '''SELECT COUNT(_P.cw_eid) |
901 FROM cw_Personne AS P'''), |
928 FROM cw_Personne AS _P'''), |
902 ] |
929 ] |
903 |
930 |
904 SYMETRIC = [ |
931 SYMETRIC = [ |
905 ('Any P WHERE X eid 0, X connait P', |
932 ('Any P WHERE X eid 0, X connait P', |
906 '''SELECT DISTINCT P.cw_eid |
933 '''SELECT DISTINCT _P.cw_eid |
907 FROM connait_relation AS rel_connait0, cw_Personne AS P |
934 FROM connait_relation AS rel_connait0, cw_Personne AS _P |
908 WHERE (rel_connait0.eid_from=0 AND rel_connait0.eid_to=P.cw_eid OR rel_connait0.eid_to=0 AND rel_connait0.eid_from=P.cw_eid)''' |
935 WHERE (rel_connait0.eid_from=0 AND rel_connait0.eid_to=_P.cw_eid OR rel_connait0.eid_to=0 AND rel_connait0.eid_from=_P.cw_eid)''' |
909 ), |
936 ), |
910 |
937 |
911 ('Any P WHERE X connait P', |
938 ('Any P WHERE X connait P', |
912 '''SELECT DISTINCT P.cw_eid |
939 '''SELECT DISTINCT _P.cw_eid |
913 FROM connait_relation AS rel_connait0, cw_Personne AS P |
940 FROM connait_relation AS rel_connait0, cw_Personne AS _P |
914 WHERE (rel_connait0.eid_to=P.cw_eid OR rel_connait0.eid_from=P.cw_eid)''' |
941 WHERE (rel_connait0.eid_to=_P.cw_eid OR rel_connait0.eid_from=_P.cw_eid)''' |
915 ), |
942 ), |
916 |
943 |
917 ('Any X WHERE X connait P', |
944 ('Any X WHERE X connait P', |
918 '''SELECT DISTINCT X.cw_eid |
945 '''SELECT DISTINCT _X.cw_eid |
919 FROM connait_relation AS rel_connait0, cw_Personne AS X |
946 FROM connait_relation AS rel_connait0, cw_Personne AS _X |
920 WHERE (rel_connait0.eid_from=X.cw_eid OR rel_connait0.eid_to=X.cw_eid)''' |
947 WHERE (rel_connait0.eid_from=_X.cw_eid OR rel_connait0.eid_to=_X.cw_eid)''' |
921 ), |
948 ), |
922 |
949 |
923 ('Any P WHERE X eid 0, NOT X connait P', |
950 ('Any P WHERE X eid 0, NOT X connait P', |
924 '''SELECT P.cw_eid |
951 '''SELECT _P.cw_eid |
925 FROM cw_Personne AS P |
952 FROM cw_Personne AS _P |
926 WHERE NOT EXISTS(SELECT 1 FROM connait_relation AS rel_connait0 WHERE (rel_connait0.eid_from=0 AND rel_connait0.eid_to=P.cw_eid OR rel_connait0.eid_to=0 AND rel_connait0.eid_from=P.cw_eid))'''), |
953 WHERE NOT EXISTS(SELECT 1 FROM connait_relation AS rel_connait0 WHERE (rel_connait0.eid_from=0 AND rel_connait0.eid_to=_P.cw_eid OR rel_connait0.eid_to=0 AND rel_connait0.eid_from=_P.cw_eid))'''), |
927 |
954 |
928 ('Any P WHERE NOT X connait P', |
955 ('Any P WHERE NOT X connait P', |
929 '''SELECT P.cw_eid |
956 '''SELECT _P.cw_eid |
930 FROM cw_Personne AS P |
957 FROM cw_Personne AS _P |
931 WHERE NOT EXISTS(SELECT 1 FROM connait_relation AS rel_connait0 WHERE (rel_connait0.eid_to=P.cw_eid OR rel_connait0.eid_from=P.cw_eid))'''), |
958 WHERE NOT EXISTS(SELECT 1 FROM connait_relation AS rel_connait0 WHERE (rel_connait0.eid_to=_P.cw_eid OR rel_connait0.eid_from=_P.cw_eid))'''), |
932 |
959 |
933 ('Any X WHERE NOT X connait P', |
960 ('Any X WHERE NOT X connait P', |
934 '''SELECT X.cw_eid |
961 '''SELECT _X.cw_eid |
935 FROM cw_Personne AS X |
962 FROM cw_Personne AS _X |
936 WHERE NOT EXISTS(SELECT 1 FROM connait_relation AS rel_connait0 WHERE (rel_connait0.eid_from=X.cw_eid OR rel_connait0.eid_to=X.cw_eid))'''), |
963 WHERE NOT EXISTS(SELECT 1 FROM connait_relation AS rel_connait0 WHERE (rel_connait0.eid_from=_X.cw_eid OR rel_connait0.eid_to=_X.cw_eid))'''), |
937 |
964 |
938 ('Any P WHERE X connait P, P nom "nom"', |
965 ('Any P WHERE X connait P, P nom "nom"', |
939 '''SELECT DISTINCT P.cw_eid |
966 '''SELECT DISTINCT _P.cw_eid |
940 FROM connait_relation AS rel_connait0, cw_Personne AS P |
967 FROM connait_relation AS rel_connait0, cw_Personne AS _P |
941 WHERE (rel_connait0.eid_to=P.cw_eid OR rel_connait0.eid_from=P.cw_eid) AND P.cw_nom=nom'''), |
968 WHERE (rel_connait0.eid_to=_P.cw_eid OR rel_connait0.eid_from=_P.cw_eid) AND _P.cw_nom=nom'''), |
942 |
969 |
943 ('Any X WHERE X connait P, P nom "nom"', |
970 ('Any X WHERE X connait P, P nom "nom"', |
944 '''SELECT DISTINCT X.cw_eid |
971 '''SELECT DISTINCT _X.cw_eid |
945 FROM connait_relation AS rel_connait0, cw_Personne AS P, cw_Personne AS X |
972 FROM connait_relation AS rel_connait0, cw_Personne AS _P, cw_Personne AS _X |
946 WHERE (rel_connait0.eid_from=X.cw_eid AND rel_connait0.eid_to=P.cw_eid OR rel_connait0.eid_to=X.cw_eid AND rel_connait0.eid_from=P.cw_eid) AND P.cw_nom=nom''' |
973 WHERE (rel_connait0.eid_from=_X.cw_eid AND rel_connait0.eid_to=_P.cw_eid OR rel_connait0.eid_to=_X.cw_eid AND rel_connait0.eid_from=_P.cw_eid) AND _P.cw_nom=nom''' |
947 ), |
974 ), |
948 |
975 |
949 ('Any X ORDERBY X DESC LIMIT 9 WHERE E eid 0, E connait X', |
976 ('Any X ORDERBY X DESC LIMIT 9 WHERE E eid 0, E connait X', |
950 '''SELECT DISTINCT X.cw_eid |
977 '''SELECT DISTINCT _X.cw_eid |
951 FROM connait_relation AS rel_connait0, cw_Personne AS X |
978 FROM connait_relation AS rel_connait0, cw_Personne AS _X |
952 WHERE (rel_connait0.eid_from=0 AND rel_connait0.eid_to=X.cw_eid OR rel_connait0.eid_to=0 AND rel_connait0.eid_from=X.cw_eid) |
979 WHERE (rel_connait0.eid_from=0 AND rel_connait0.eid_to=_X.cw_eid OR rel_connait0.eid_to=0 AND rel_connait0.eid_from=_X.cw_eid) |
953 ORDER BY 1 DESC |
980 ORDER BY 1 DESC |
954 LIMIT 9''' |
981 LIMIT 9''' |
955 ), |
982 ), |
956 |
983 |
957 ('DISTINCT Any P WHERE P connait S OR S connait P, S nom "chouette"', |
984 ('DISTINCT Any P WHERE P connait S OR S connait P, S nom "chouette"', |
958 '''SELECT DISTINCT P.cw_eid |
985 '''SELECT DISTINCT _P.cw_eid |
959 FROM connait_relation AS rel_connait0, cw_Personne AS P, cw_Personne AS S |
986 FROM connait_relation AS rel_connait0, cw_Personne AS _P, cw_Personne AS _S |
960 WHERE (rel_connait0.eid_from=P.cw_eid AND rel_connait0.eid_to=S.cw_eid OR rel_connait0.eid_to=P.cw_eid AND rel_connait0.eid_from=S.cw_eid) AND S.cw_nom=chouette''' |
987 WHERE (rel_connait0.eid_from=_P.cw_eid AND rel_connait0.eid_to=_S.cw_eid OR rel_connait0.eid_to=_P.cw_eid AND rel_connait0.eid_from=_S.cw_eid) AND _S.cw_nom=chouette''' |
961 ) |
988 ) |
962 ] |
989 ] |
963 |
990 |
964 INLINE = [ |
991 INLINE = [ |
965 ('Any P, L WHERE N ecrit_par P, P nom L, N eid 0', |
992 ('Any P, L WHERE N ecrit_par P, P nom L, N eid 0', |
966 '''SELECT P.cw_eid, P.cw_nom |
993 '''SELECT _P.cw_eid, _P.cw_nom |
967 FROM cw_Note AS N, cw_Personne AS P |
994 FROM cw_Note AS _N, cw_Personne AS _P |
968 WHERE N.cw_ecrit_par=P.cw_eid AND N.cw_eid=0'''), |
995 WHERE _N.cw_ecrit_par=_P.cw_eid AND _N.cw_eid=0'''), |
969 |
996 |
970 ('Any N WHERE NOT N ecrit_par P, P nom "toto"', |
997 ('Any N WHERE NOT N ecrit_par P, P nom "toto"', |
971 '''SELECT N.cw_eid |
998 '''SELECT _N.cw_eid |
972 FROM cw_Note AS N, cw_Personne AS P |
999 FROM cw_Note AS _N, cw_Personne AS _P |
973 WHERE NOT EXISTS(SELECT 1 WHERE N.cw_ecrit_par=P.cw_eid) AND P.cw_nom=toto'''), |
1000 WHERE NOT EXISTS(SELECT 1 WHERE _N.cw_ecrit_par=_P.cw_eid) AND _P.cw_nom=toto'''), |
974 |
1001 |
975 ('Any P WHERE N ecrit_par P, N eid 0', |
1002 ('Any P WHERE N ecrit_par P, N eid 0', |
976 '''SELECT N.cw_ecrit_par |
1003 '''SELECT _N.cw_ecrit_par |
977 FROM cw_Note AS N |
1004 FROM cw_Note AS _N |
978 WHERE N.cw_ecrit_par IS NOT NULL AND N.cw_eid=0'''), |
1005 WHERE _N.cw_ecrit_par IS NOT NULL AND _N.cw_eid=0'''), |
979 |
1006 |
980 ('Any P WHERE N ecrit_par P, P is Personne, N eid 0', |
1007 ('Any P WHERE N ecrit_par P, P is Personne, N eid 0', |
981 '''SELECT P.cw_eid |
1008 '''SELECT _P.cw_eid |
982 FROM cw_Note AS N, cw_Personne AS P |
1009 FROM cw_Note AS _N, cw_Personne AS _P |
983 WHERE N.cw_ecrit_par=P.cw_eid AND N.cw_eid=0'''), |
1010 WHERE _N.cw_ecrit_par=_P.cw_eid AND _N.cw_eid=0'''), |
984 |
1011 |
985 ('Any P WHERE NOT N ecrit_par P, P is Personne, N eid 512', |
1012 ('Any P WHERE NOT N ecrit_par P, P is Personne, N eid 512', |
986 '''SELECT P.cw_eid |
1013 '''SELECT _P.cw_eid |
987 FROM cw_Note AS N, cw_Personne AS P |
1014 FROM cw_Note AS _N, cw_Personne AS _P |
988 WHERE NOT EXISTS(SELECT 1 WHERE N.cw_ecrit_par=P.cw_eid) AND N.cw_eid=512'''), |
1015 WHERE NOT EXISTS(SELECT 1 WHERE _N.cw_ecrit_par=_P.cw_eid) AND _N.cw_eid=512'''), |
989 |
1016 |
990 ('Any S,ES,T WHERE S state_of ET, ET name "CWUser", ES allowed_transition T, T destination_state S', |
1017 ('Any S,ES,T WHERE S state_of ET, ET name "CWUser", ES allowed_transition T, T destination_state S', |
991 '''SELECT T.cw_destination_state, rel_allowed_transition1.eid_from, T.cw_eid |
1018 '''SELECT _T.cw_destination_state, rel_allowed_transition1.eid_from, _T.cw_eid |
992 FROM allowed_transition_relation AS rel_allowed_transition1, cw_Transition AS T, cw_Workflow AS ET, state_of_relation AS rel_state_of0 |
1019 FROM allowed_transition_relation AS rel_allowed_transition1, cw_Transition AS _T, cw_Workflow AS _ET, state_of_relation AS rel_state_of0 |
993 WHERE T.cw_destination_state=rel_state_of0.eid_from AND rel_state_of0.eid_to=ET.cw_eid AND ET.cw_name=CWUser AND rel_allowed_transition1.eid_to=T.cw_eid'''), |
1020 WHERE _T.cw_destination_state=rel_state_of0.eid_from AND rel_state_of0.eid_to=_ET.cw_eid AND _ET.cw_name=CWUser AND rel_allowed_transition1.eid_to=_T.cw_eid'''), |
994 |
1021 |
995 ('Any O WHERE S eid 0, S in_state O', |
1022 ('Any O WHERE S eid 0, S in_state O', |
996 '''SELECT S.cw_in_state |
1023 '''SELECT _S.cw_in_state |
997 FROM cw_Affaire AS S |
1024 FROM cw_Affaire AS _S |
998 WHERE S.cw_eid=0 AND S.cw_in_state IS NOT NULL |
1025 WHERE _S.cw_eid=0 AND _S.cw_in_state IS NOT NULL |
999 UNION ALL |
1026 UNION ALL |
1000 SELECT S.cw_in_state |
1027 SELECT _S.cw_in_state |
1001 FROM cw_CWUser AS S |
1028 FROM cw_CWUser AS _S |
1002 WHERE S.cw_eid=0 AND S.cw_in_state IS NOT NULL |
1029 WHERE _S.cw_eid=0 AND _S.cw_in_state IS NOT NULL |
1003 UNION ALL |
1030 UNION ALL |
1004 SELECT S.cw_in_state |
1031 SELECT _S.cw_in_state |
1005 FROM cw_Note AS S |
1032 FROM cw_Note AS _S |
1006 WHERE S.cw_eid=0 AND S.cw_in_state IS NOT NULL''') |
1033 WHERE _S.cw_eid=0 AND _S.cw_in_state IS NOT NULL''') |
1007 |
1034 |
1008 ] |
1035 ] |
1009 |
1036 |
1010 INTERSECT = [ |
1037 INTERSECT = [ |
1011 ('Any SN WHERE NOT X in_state S, S name SN', |
1038 ('Any SN WHERE NOT X in_state S, S name SN', |
1012 '''SELECT S.cw_name |
1039 '''SELECT _S.cw_name |
1013 FROM cw_State AS S |
1040 FROM cw_State AS _S |
1014 WHERE NOT EXISTS(SELECT 1 FROM cw_Affaire AS X WHERE X.cw_in_state=S.cw_eid) |
1041 WHERE NOT EXISTS(SELECT 1 FROM cw_Affaire AS _X WHERE _X.cw_in_state=_S.cw_eid) |
1015 INTERSECT |
1042 INTERSECT |
1016 SELECT S.cw_name |
1043 SELECT _S.cw_name |
1017 FROM cw_State AS S |
1044 FROM cw_State AS _S |
1018 WHERE NOT EXISTS(SELECT 1 FROM cw_CWUser AS X WHERE X.cw_in_state=S.cw_eid) |
1045 WHERE NOT EXISTS(SELECT 1 FROM cw_CWUser AS _X WHERE _X.cw_in_state=_S.cw_eid) |
1019 INTERSECT |
1046 INTERSECT |
1020 SELECT S.cw_name |
1047 SELECT _S.cw_name |
1021 FROM cw_State AS S |
1048 FROM cw_State AS _S |
1022 WHERE NOT EXISTS(SELECT 1 FROM cw_Note AS X WHERE X.cw_in_state=S.cw_eid)'''), |
1049 WHERE NOT EXISTS(SELECT 1 FROM cw_Note AS _X WHERE _X.cw_in_state=_S.cw_eid)'''), |
1023 |
1050 |
1024 ('Any PN WHERE NOT X travaille S, X nom PN, S is IN(Division, Societe)', |
1051 ('Any PN WHERE NOT X travaille S, X nom PN, S is IN(Division, Societe)', |
1025 '''SELECT X.cw_nom |
1052 '''SELECT _X.cw_nom |
1026 FROM cw_Personne AS X |
1053 FROM cw_Personne AS _X |
1027 WHERE NOT EXISTS(SELECT 1 FROM travaille_relation AS rel_travaille0,cw_Division AS S WHERE rel_travaille0.eid_from=X.cw_eid AND rel_travaille0.eid_to=S.cw_eid) |
1054 WHERE NOT EXISTS(SELECT 1 FROM travaille_relation AS rel_travaille0,cw_Division AS _S WHERE rel_travaille0.eid_from=_X.cw_eid AND rel_travaille0.eid_to=_S.cw_eid) |
1028 INTERSECT |
1055 INTERSECT |
1029 SELECT X.cw_nom |
1056 SELECT _X.cw_nom |
1030 FROM cw_Personne AS X |
1057 FROM cw_Personne AS _X |
1031 WHERE NOT EXISTS(SELECT 1 FROM travaille_relation AS rel_travaille0,cw_Societe AS S WHERE rel_travaille0.eid_from=X.cw_eid AND rel_travaille0.eid_to=S.cw_eid)'''), |
1058 WHERE NOT EXISTS(SELECT 1 FROM travaille_relation AS rel_travaille0,cw_Societe AS _S WHERE rel_travaille0.eid_from=_X.cw_eid AND rel_travaille0.eid_to=_S.cw_eid)'''), |
1032 |
1059 |
1033 ('Any PN WHERE NOT X travaille S, S nom PN, S is IN(Division, Societe)', |
1060 ('Any PN WHERE NOT X travaille S, S nom PN, S is IN(Division, Societe)', |
1034 '''SELECT S.cw_nom |
1061 '''SELECT _S.cw_nom |
1035 FROM cw_Division AS S |
1062 FROM cw_Division AS _S |
1036 WHERE NOT EXISTS(SELECT 1 FROM travaille_relation AS rel_travaille0 WHERE rel_travaille0.eid_to=S.cw_eid) |
1063 WHERE NOT EXISTS(SELECT 1 FROM travaille_relation AS rel_travaille0 WHERE rel_travaille0.eid_to=_S.cw_eid) |
1037 UNION ALL |
1064 UNION ALL |
1038 SELECT S.cw_nom |
1065 SELECT _S.cw_nom |
1039 FROM cw_Societe AS S |
1066 FROM cw_Societe AS _S |
1040 WHERE NOT EXISTS(SELECT 1 FROM travaille_relation AS rel_travaille0 WHERE rel_travaille0.eid_to=S.cw_eid)'''), |
1067 WHERE NOT EXISTS(SELECT 1 FROM travaille_relation AS rel_travaille0 WHERE rel_travaille0.eid_to=_S.cw_eid)'''), |
1041 |
1068 |
1042 ('Personne X WHERE NOT X travaille S, S nom "chouette"', |
1069 ('Personne X WHERE NOT X travaille S, S nom "chouette"', |
1043 '''SELECT X.cw_eid |
1070 '''SELECT _X.cw_eid |
1044 FROM cw_Division AS S, cw_Personne AS X |
1071 FROM cw_Division AS _S, cw_Personne AS _X |
1045 WHERE NOT EXISTS(SELECT 1 FROM travaille_relation AS rel_travaille0 WHERE rel_travaille0.eid_from=X.cw_eid AND rel_travaille0.eid_to=S.cw_eid) AND S.cw_nom=chouette |
1072 WHERE NOT EXISTS(SELECT 1 FROM travaille_relation AS rel_travaille0 WHERE rel_travaille0.eid_from=_X.cw_eid AND rel_travaille0.eid_to=_S.cw_eid) AND _S.cw_nom=chouette |
1046 UNION ALL |
1073 UNION ALL |
1047 SELECT X.cw_eid |
1074 SELECT _X.cw_eid |
1048 FROM cw_Personne AS X, cw_Societe AS S |
1075 FROM cw_Personne AS _X, cw_Societe AS _S |
1049 WHERE NOT EXISTS(SELECT 1 FROM travaille_relation AS rel_travaille0 WHERE rel_travaille0.eid_from=X.cw_eid AND rel_travaille0.eid_to=S.cw_eid) AND S.cw_nom=chouette |
1076 WHERE NOT EXISTS(SELECT 1 FROM travaille_relation AS rel_travaille0 WHERE rel_travaille0.eid_from=_X.cw_eid AND rel_travaille0.eid_to=_S.cw_eid) AND _S.cw_nom=chouette |
1050 UNION ALL |
1077 UNION ALL |
1051 SELECT X.cw_eid |
1078 SELECT _X.cw_eid |
1052 FROM cw_Personne AS X, cw_SubDivision AS S |
1079 FROM cw_Personne AS _X, cw_SubDivision AS _S |
1053 WHERE NOT EXISTS(SELECT 1 FROM travaille_relation AS rel_travaille0 WHERE rel_travaille0.eid_from=X.cw_eid AND rel_travaille0.eid_to=S.cw_eid) AND S.cw_nom=chouette'''), |
1080 WHERE NOT EXISTS(SELECT 1 FROM travaille_relation AS rel_travaille0 WHERE rel_travaille0.eid_from=_X.cw_eid AND rel_travaille0.eid_to=_S.cw_eid) AND _S.cw_nom=chouette'''), |
1054 |
1081 |
1055 ('Any X WHERE X is ET, ET eid 2', |
1082 ('Any X WHERE X is ET, ET eid 2', |
1056 '''SELECT rel_is0.eid_from |
1083 '''SELECT rel_is0.eid_from |
1057 FROM is_relation AS rel_is0 |
1084 FROM is_relation AS rel_is0 |
1058 WHERE rel_is0.eid_to=2'''), |
1085 WHERE rel_is0.eid_to=2'''), |