summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_oracle.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dialects/test_oracle.py')
-rw-r--r--tests/dialects/test_oracle.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/dialects/test_oracle.py b/tests/dialects/test_oracle.py
index d2bbedc..36ce5d0 100644
--- a/tests/dialects/test_oracle.py
+++ b/tests/dialects/test_oracle.py
@@ -329,6 +329,57 @@ class TestOracle(Validator):
)
self.validate_identity("INSERT /*+ APPEND */ INTO IAP_TBL (id, col1) VALUES (2, 'test2')")
self.validate_identity("INSERT /*+ APPEND_VALUES */ INTO dest_table VALUES (i, 'Value')")
+ self.validate_identity(
+ "SELECT /*+ LEADING(departments employees) USE_NL(employees) */ * FROM employees JOIN departments ON employees.department_id = departments.department_id",
+ """SELECT /*+ LEADING(departments employees)
+ USE_NL(employees) */
+ *
+FROM employees
+JOIN departments
+ ON employees.department_id = departments.department_id""",
+ pretty=True,
+ )
+ self.validate_identity(
+ "SELECT /*+ USE_NL(bbbbbbbbbbbbbbbbbbbbbbbb) LEADING(aaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbb cccccccccccccccccccccccc dddddddddddddddddddddddd) INDEX(cccccccccccccccccccccccc) */ * FROM aaaaaaaaaaaaaaaaaaaaaaaa JOIN bbbbbbbbbbbbbbbbbbbbbbbb ON aaaaaaaaaaaaaaaaaaaaaaaa.id = bbbbbbbbbbbbbbbbbbbbbbbb.a_id JOIN cccccccccccccccccccccccc ON bbbbbbbbbbbbbbbbbbbbbbbb.id = cccccccccccccccccccccccc.b_id JOIN dddddddddddddddddddddddd ON cccccccccccccccccccccccc.id = dddddddddddddddddddddddd.c_id",
+ )
+ self.validate_identity(
+ "SELECT /*+ USE_NL(bbbbbbbbbbbbbbbbbbbbbbbb) LEADING(aaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbb cccccccccccccccccccccccc dddddddddddddddddddddddd) INDEX(cccccccccccccccccccccccc) */ * FROM aaaaaaaaaaaaaaaaaaaaaaaa JOIN bbbbbbbbbbbbbbbbbbbbbbbb ON aaaaaaaaaaaaaaaaaaaaaaaa.id = bbbbbbbbbbbbbbbbbbbbbbbb.a_id JOIN cccccccccccccccccccccccc ON bbbbbbbbbbbbbbbbbbbbbbbb.id = cccccccccccccccccccccccc.b_id JOIN dddddddddddddddddddddddd ON cccccccccccccccccccccccc.id = dddddddddddddddddddddddd.c_id",
+ """SELECT /*+ USE_NL(bbbbbbbbbbbbbbbbbbbbbbbb)
+ LEADING(
+ aaaaaaaaaaaaaaaaaaaaaaaa
+ bbbbbbbbbbbbbbbbbbbbbbbb
+ cccccccccccccccccccccccc
+ dddddddddddddddddddddddd
+ )
+ INDEX(cccccccccccccccccccccccc) */
+ *
+FROM aaaaaaaaaaaaaaaaaaaaaaaa
+JOIN bbbbbbbbbbbbbbbbbbbbbbbb
+ ON aaaaaaaaaaaaaaaaaaaaaaaa.id = bbbbbbbbbbbbbbbbbbbbbbbb.a_id
+JOIN cccccccccccccccccccccccc
+ ON bbbbbbbbbbbbbbbbbbbbbbbb.id = cccccccccccccccccccccccc.b_id
+JOIN dddddddddddddddddddddddd
+ ON cccccccccccccccccccccccc.id = dddddddddddddddddddddddd.c_id""",
+ pretty=True,
+ )
+ # Test that parsing error with keywords like select where etc falls back
+ self.validate_identity(
+ "SELECT /*+ LEADING(departments employees) USE_NL(employees) select where group by is order by */ * FROM employees JOIN departments ON employees.department_id = departments.department_id",
+ """SELECT /*+ LEADING(departments employees) USE_NL(employees) select where group by is order by */
+ *
+FROM employees
+JOIN departments
+ ON employees.department_id = departments.department_id""",
+ pretty=True,
+ )
+ # Test that parsing error with , inside hint function falls back
+ self.validate_identity(
+ "SELECT /*+ LEADING(departments, employees) */ * FROM employees JOIN departments ON employees.department_id = departments.department_id"
+ )
+ # Test that parsing error with keyword inside hint function falls back
+ self.validate_identity(
+ "SELECT /*+ LEADING(departments select) */ * FROM employees JOIN departments ON employees.department_id = departments.department_id"
+ )
def test_xml_table(self):
self.validate_identity("XMLTABLE('x')")