def test_limit_special_quoting(self):
        """Oracle-specific test for #4730.

        Even though this issue is generic, test the originally reported Oracle
        use case.

        """

        col = literal_column("SUM(ABC)").label("SUM(ABC)")
        tbl = table("my_table")
        query = select([col]).select_from(tbl).order_by(col).limit(100)

        self.assert_compile(
            query,
            'SELECT "SUM(ABC)" FROM '
            '(SELECT SUM(ABC) AS "SUM(ABC)" '
            "FROM my_table ORDER BY SUM(ABC)) "
            "WHERE ROWNUM <= :param_1",
        )

        col = literal_column("SUM(ABC)").label(quoted_name("SUM(ABC)", True))
        tbl = table("my_table")
        query = select([col]).select_from(tbl).order_by(col).limit(100)

        self.assert_compile(
            query,
            'SELECT "SUM(ABC)" FROM '
            '(SELECT SUM(ABC) AS "SUM(ABC)" '
            "FROM my_table ORDER BY SUM(ABC)) "
            "WHERE ROWNUM <= :param_1",
        )

        col = literal_column("SUM(ABC)").label("SUM(ABC)_")
        tbl = table("my_table")
        query = select([col]).select_from(tbl).order_by(col).limit(100)

        self.assert_compile(
            query,
            'SELECT "SUM(ABC)_" FROM '
            '(SELECT SUM(ABC) AS "SUM(ABC)_" '
            "FROM my_table ORDER BY SUM(ABC)) "
            "WHERE ROWNUM <= :param_1",
        )

        col = literal_column("SUM(ABC)").label(quoted_name("SUM(ABC)_", True))
        tbl = table("my_table")
        query = select([col]).select_from(tbl).order_by(col).limit(100)

        self.assert_compile(
            query,
            'SELECT "SUM(ABC)_" FROM '
            '(SELECT SUM(ABC) AS "SUM(ABC)_" '
            "FROM my_table ORDER BY SUM(ABC)) "
            "WHERE ROWNUM <= :param_1",
        )
 def test_order_by_literal_col_quoting_one_explict_quote(self):
     col = literal_column("SUM(ABC)").label(quoted_name("SUM(ABC)", True))
     tbl = table("my_table")
     query = select([col]).select_from(tbl).order_by(col)
     self.assert_compile(
         query,
         'SELECT SUM(ABC) AS "SUM(ABC)" FROM my_table ORDER BY "SUM(ABC)"',
     )
 def test_force_schema_quoted_name_w_dot_case_sensitive(self):
     metadata = MetaData()
     tbl = Table(
         "test",
         metadata,
         Column("id", Integer, primary_key=True),
         schema=quoted_name("Foo.dbo", True),
     )
     self.assert_compile(select([tbl]),
                         "SELECT [Foo.dbo].test.id FROM [Foo.dbo].test")
 class myfunc(GenericFunction):
     name = quoted_name("NotMyFunc", quote=True)