test the quoting of labels. If labels aren't quoted, a query in postgresql in particular will fail since it produces: .. sourcecode:: sql SELECT LaLa.lowercase, LaLa."UPPERCASE", LaLa."MixedCase", LaLa."ASC" FROM ( SE
(self)
| 192 | @testing.crashes("oracle", "FIXME: unknown, verify not fails_on") |
| 193 | @testing.requires.subqueries |
| 194 | def test_labels(self): |
| 195 | """test the quoting of labels. |
| 196 | |
| 197 | If labels aren't quoted, a query in postgresql in particular will |
| 198 | fail since it produces: |
| 199 | |
| 200 | .. sourcecode:: sql |
| 201 | |
| 202 | SELECT |
| 203 | LaLa.lowercase, LaLa."UPPERCASE", LaLa."MixedCase", LaLa."ASC" |
| 204 | FROM ( |
| 205 | SELECT DISTINCT |
| 206 | "WorstCase1".lowercase AS lowercase, |
| 207 | "WorstCase1"."UPPERCASE" AS UPPERCASE, |
| 208 | "WorstCase1"."MixedCase" AS MixedCase, |
| 209 | "WorstCase1"."ASC" AS ASC |
| 210 | FROM "WorstCase1" |
| 211 | ) AS LaLa |
| 212 | |
| 213 | where the "UPPERCASE" column of "LaLa" doesn't exist. |
| 214 | """ |
| 215 | |
| 216 | metadata = MetaData() |
| 217 | table1 = Table( |
| 218 | "WorstCase1", |
| 219 | metadata, |
| 220 | Column("lowercase", Integer, primary_key=True), |
| 221 | Column("UPPERCASE", Integer), |
| 222 | Column("MixedCase", Integer), |
| 223 | Column("ASC", Integer, key="a123"), |
| 224 | ) |
| 225 | Table( |
| 226 | "WorstCase2", |
| 227 | metadata, |
| 228 | Column("desc", Integer, primary_key=True, key="d123"), |
| 229 | Column("Union", Integer, key="u123"), |
| 230 | Column("MixedCase", Integer), |
| 231 | ) |
| 232 | |
| 233 | self.assert_compile( |
| 234 | table1.select().distinct().alias("LaLa").select(), |
| 235 | "SELECT " |
| 236 | '"LaLa".lowercase, ' |
| 237 | '"LaLa"."UPPERCASE", ' |
| 238 | '"LaLa"."MixedCase", ' |
| 239 | '"LaLa"."ASC" ' |
| 240 | "FROM (" |
| 241 | "SELECT DISTINCT " |
| 242 | '"WorstCase1".lowercase AS lowercase, ' |
| 243 | '"WorstCase1"."UPPERCASE" AS "UPPERCASE", ' |
| 244 | '"WorstCase1"."MixedCase" AS "MixedCase", ' |
| 245 | '"WorstCase1"."ASC" AS "ASC" ' |
| 246 | 'FROM "WorstCase1"' |
| 247 | ') AS "LaLa"', |
| 248 | ) |
| 249 | |
| 250 | def test_repr_unicode(self): |
| 251 | name = quoted_name("姓名", None) |