Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add oracle audit sql and create view sql parse test #28869

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions test/it/parser/src/main/resources/case/ddl/audit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,31 @@
<audit sql-case-id="audit_delete_any_table_by_access" />
<audit sql-case-id="audit_crete_table_by_access_whenever_not_successful" />
<audit sql-case-id="audit_select_table_by" />
<audit sql-case-id="audit_delete_any_table" />
<audit sql-case-id="audit_delete_on_by_access" />
<audit sql-case-id="audit_execute_on_by_access_whenever_successful" />
<audit sql-case-id="audit_insert_any_table_by_system_by_access" />
<audit sql-case-id="audit_insert_table_by_access" />
<audit sql-case-id="audit_role_whenever_not_successful" />
<audit sql-case-id="audit_role_whenever_success" />
<audit sql-case-id="audit_select_on_default_by_access_whenever_not_successful" />
<audit sql-case-id="audit_select_on_whenever_successful" />
<audit sql-case-id="audit_cluster" />
<audit sql-case-id="audit_alter_delete_on_default_by_access" />
<audit sql-case-id="audit_alter_index_rename_on_default" />
<audit sql-case-id="audit_session_by" />
<audit sql-case-id="audit_lock_table_by_access_whenever_successful" />
<audit sql-case-id="audit_delete_on_by_access_whenever_success" />
<audit sql-case-id="audit_select_on_by_access1" />
<audit sql-case-id="audit_select_on_by_access2" />
<audit sql-case-id="audit_select_on_by_access3" />
<audit sql-case-id="audit_select_whenever_not_successful" />
<audit sql-case-id="audit_select_table_by_access" />
<audit sql-case-id="audit_select_insert_delete_table_by_access_whenever_not_successful" />
<audit sql-case-id="audit_select_update_table" />
<audit sql-case-id="audit_select_update_table_by" />
<audit sql-case-id="audit_select_update_table_by_access" />
<audit sql-case-id="audit_session_by_access" />
<audit sql-case-id="audit_select_insert_delete_on_access_whenever_successful" />
<audit sql-case-id="audit_session_by_by_access" />
</sql-parser-test-cases>
54 changes: 54 additions & 0 deletions test/it/parser/src/main/resources/case/ddl/create-view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -242,4 +242,58 @@
</where>
</select>
</create-view>

<create-view sql-case-id="create_view_as_simple_select" view-definition="SELECT * FROM laurel.emp">
<view name="employee" start-index="12" stop-index="26">
<owner name="laurel" start-index="12" stop-index="17" />
</view>
<select>
<projections start-index="38" stop-index="38">
<shorthand-projection start-index="38" stop-index="38" />
</projections>
<from>
<simple-table name="emp" start-index="45" stop-index="54">
<owner name="laurel" start-index="45" stop-index="50" />
</simple-table>
</from>
</select>
</create-view>

<create-view sql-case-id="create_view_as_where_where" view-definition="SELECT employee_id, last_name, department_id FROM employees, departments WHERE employees.department_id = departments.department_id">
<view name="employees_departments" start-index="12" stop-index="32" />
<select>
<projections start-index="44" stop-index="80">
<column-projection name="employee_id" start-index="44" stop-index="54" />
<column-projection name="last_name" start-index="57" stop-index="65" />
<column-projection name="department_id" start-index="68" stop-index="80" />
</projections>
<from>
<join-table join-type="COMMA">
<left>
<simple-table name="employees" start-index="87" stop-index="95" />
</left>
<right>
<simple-table name="departments" start-index="98" stop-index="108" />
</right>
</join-table>
</from>
<where start-index="110" stop-index="166">
<expr>
<binary-operation-expression start-index="116" stop-index="166">
<left>
<column name="department_id" start-index="116" stop-index="138">
<owner name="employees" start-index="116" stop-index="124" />
</column>
</left>
<right>
<column name="department_id" start-index="142" stop-index="166">
<owner name="departments" start-index="142" stop-index="152" />
</column>
</right>
<operator>=</operator>
</binary-operation-expression>
</expr>
</where>
</select>
</create-view>
</sql-parser-test-cases>
27 changes: 27 additions & 0 deletions test/it/parser/src/main/resources/sql/supported/ddl/audit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,31 @@
<sql-case id="audit_delete_any_table_by_access" value="AUDIT DELETE ANY TABLE BY ACCESS" db-types="Oracle" />
<sql-case id="audit_crete_table_by_access_whenever_not_successful" value="AUDIT CREATE TABLE BY ACCESS WHENEVER NOT SUCCESSFUL" db-types="Oracle" />
<sql-case id="audit_select_table_by" value="AUDIT SELECT TABLE BY jackson" db-types="Oracle" />
<sql-case id="audit_delete_any_table" value="AUDIT DELETE ANY TABLE" db-types="Oracle" />
<sql-case id="audit_delete_on_by_access" value="AUDIT DELETE ON laurel.emp BY ACCESS" db-types="Oracle" />
<sql-case id="audit_execute_on_by_access_whenever_successful" value="AUDIT EXECUTE ON sales_data.check_work BY ACCESS WHENEVER SUCCESSFUL" db-types="Oracle" />
<sql-case id="audit_insert_any_table_by_system_by_access" value="AUDIT INSERT ANY TABLE BY SYSTEM BY ACCESS" db-types="Oracle" />
<sql-case id="audit_insert_table_by_access" value="AUDIT INSERT TABLE BY ACCESS" db-types="Oracle" />
<sql-case id="audit_role_whenever_not_successful" value="AUDIT ROLE WHENEVER NOT SUCCESSFUL" db-types="Oracle" />
<sql-case id="audit_role_whenever_success" value="AUDIT ROLE WHENEVER SUCCESSFUL" db-types="Oracle" />
<sql-case id="audit_select_on_default_by_access_whenever_not_successful" value="AUDIT SELECT ON DEFAULT BY ACCESS WHENEVER NOT SUCCESSFUL" db-types="Oracle" />
<sql-case id="audit_select_on_whenever_successful" value="AUDIT SELECT ON hr.employees WHENEVER SUCCESSFUL" db-types="Oracle" />
<sql-case id="audit_cluster" value="AUDIT CLUSTER" db-types="Oracle" />
<sql-case id="audit_alter_delete_on_default_by_access" value="AUDIT ALTER, DELETE ON DEFAULT BY ACCESS" db-types="Oracle" />
<sql-case id="audit_alter_index_rename_on_default" value="AUDIT ALTER, INDEX, RENAME ON DEFAULT" db-types="Oracle" />
<sql-case id="audit_session_by" value="AUDIT SESSION BY jward, swilliams" db-types="Oracle" />
<sql-case id="audit_lock_table_by_access_whenever_successful" value="AUDIT LOCK TABLE BY ACCESS WHENEVER SUCCESSFUL" db-types="Oracle" />
<sql-case id="audit_delete_on_by_access_whenever_success" value="AUDIT DELETE ON laurel.emp BY ACCESS WHENEVER SUCCESSFUL" db-types="Oracle" />
<sql-case id="audit_select_on_by_access1" value="AUDIT SELECT ON employees_departments BY ACCESS" db-types="Oracle" />
<sql-case id="audit_select_on_by_access2" value="AUDIT SELECT ON SYS.AUD$ BY ACCESS" db-types="Oracle" />
<sql-case id="audit_select_on_by_access3" value="AUDIT SELECT ON SYS.FGA$ BY ACCESS" db-types="Oracle" />
<sql-case id="audit_select_whenever_not_successful" value="AUDIT SELECT ON hr.employees WHENEVER NOT SUCCESSFUL" db-types="Oracle" />
<sql-case id="audit_select_table_by_access" value="AUDIT SELECT TABLE BY ACCESS" db-types="Oracle" />
<sql-case id="audit_select_insert_delete_table_by_access_whenever_not_successful" value="AUDIT SELECT TABLE, INSERT TABLE, DELETE TABLE BY ACCESS WHENEVER NOT SUCCESSFUL" db-types="Oracle" />
<sql-case id="audit_select_update_table" value="AUDIT SELECT TABLE, UPDATE TABLE" db-types="Oracle" />
<sql-case id="audit_select_update_table_by" value="AUDIT SELECT TABLE, UPDATE TABLE BY hr, oe" db-types="Oracle" />
<sql-case id="audit_select_update_table_by_access" value="AUDIT SELECT TABLE, UPDATE TABLE BY scott, blake BY ACCESS" db-types="Oracle" />
<sql-case id="audit_session_by_access" value="AUDIT SESSION BY ACCESS" db-types="Oracle" />
<sql-case id="audit_select_insert_delete_on_access_whenever_successful" value="AUDIT SELECT, INSERT, DELETE ON jward.dept BY ACCESS WHENEVER SUCCESSFUL" db-types="Oracle" />
<sql-case id="audit_session_by_by_access" value="AUDIT SESSION BY jward, jsmith BY ACCESS" db-types="Oracle" />
</sql-cases>
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@
<sql-case id="create_view_with_recursive" value="CREATE RECURSIVE VIEW public.nums_1_100 (n) AS VALUES (1) UNION ALL SELECT n+1 FROM nums_1_100 WHERE n = 100" db-types="PostgreSQL,openGauss" />
<sql-case id="create_view_with_option" value="CREATE OR REPLACE TEMP view order_view (order_id,user_id) WITH (security_barrier=TRUE) AS SELECT * FROM t_order" db-types="PostgreSQL,openGauss" />
<sql-case id="create_or_replace_view_with_select" value="create or replace view named_moons as select p.name planet, p.class, m.name moon, m.radius from planets p, moons m where p.name = m.planet_name(+) and m.name(+) not like 'S/%'" db-types="Oracle" />
<sql-case id="create_view_as_simple_select" value="CREATE VIEW laurel.employee AS SELECT * FROM laurel.emp" db-types="Oracle" />
<sql-case id="create_view_as_where_where" value="CREATE VIEW employees_departments AS SELECT employee_id, last_name, department_id FROM employees, departments WHERE employees.department_id = departments.department_id" db-types="Oracle" />
</sql-cases>