From b2042f48cd18ea6dbd42aeadc0742835cca9421d Mon Sep 17 00:00:00 2001 From: Yogesh Mahajan Date: Wed, 9 Jun 2021 18:16:50 +0530 Subject: [PATCH] Added RESQL/MSQL test cases for Table and its child nodes. Fixes #4622 --- docs/en_US/release_notes_5_4.rst | 1 + .../alter_column_text_with_default_value.msql | 4 + .../alter_column_text_with_default_value.sql | 11 + ...amp_with_default_value_using_function.msql | 7 + ...tamp_with_default_value_using_function.sql | 9 + ...olumn_with_interger_array_and_options.msql | 3 + ...column_with_interger_array_and_options.sql | 13 + .../tests/pg/10_plus/create_column_char.msql | 4 +- ...reate_column_identity_for_restart_seq.msql | 2 +- .../tests/pg/10_plus/create_column_int.msql | 4 +- .../10_plus/create_column_int_identity.msql | 4 +- ...create_column_int_identity_by_default.msql | 4 +- ...create_column_text_with_default_value.msql | 5 + .../create_column_text_with_default_value.sql | 9 + ...amp_with_default_value_using_function.msql | 5 + ...tamp_with_default_value_using_function.sql | 9 + ...olumn_with_interger_array_and_options.msql | 9 + ...column_with_interger_array_and_options.sql | 13 + .../tables/columns/tests/pg/10_plus/test.json | 189 +- .../tests/pg/12_plus/alter_column_char.msql | 4 +- .../alter_column_text_with_default_value.msql | 4 + .../alter_column_text_with_default_value.sql | 11 + ...amp_with_default_value_using_function.msql | 7 + ...tamp_with_default_value_using_function.sql | 9 + ...olumn_with_interger_array_and_options.msql | 3 + ...column_with_interger_array_and_options.sql | 13 + .../tests/pg/12_plus/create_column_char.msql | 4 +- .../tests/pg/12_plus/create_column_int.msql | 4 +- .../12_plus/create_column_int_generated.msql | 4 +- ...n_int_generated_with_existing_columns.msql | 4 +- .../12_plus/create_column_int_identity.msql | 4 +- ...create_column_int_identity_by_default.msql | 4 +- ...create_column_text_with_default_value.msql | 5 + .../create_column_text_with_default_value.sql | 9 + ...amp_with_default_value_using_function.msql | 5 + ...tamp_with_default_value_using_function.sql | 9 + ...olumn_with_interger_array_and_options.msql | 9 + ...column_with_interger_array_and_options.sql | 13 + .../tables/columns/tests/pg/12_plus/test.json | 587 ++++- .../tests/pg/default/create_column_char.msql | 4 +- .../tests/pg/default/create_column_int.msql | 4 +- .../tables/columns/tests/pg/default/test.json | 182 +- .../alter_column_text_with_default_value.msql | 13 + .../alter_column_text_with_default_value.sql | 11 + .../ppas/10_plus/create_column_char.msql | 4 +- ...reate_column_identity_for_restart_seq.msql | 2 +- .../tests/ppas/10_plus/create_column_int.msql | 4 +- .../10_plus/create_column_int_identity.msql | 4 +- ...create_column_int_identity_by_default.msql | 4 +- .../columns/tests/ppas/10_plus/test.json | 21 +- .../ppas/12_plus/create_column_char.msql | 4 +- ...reate_column_identity_for_restart_seq.msql | 2 +- .../tests/ppas/12_plus/create_column_int.msql | 4 +- .../12_plus/create_column_int_generated.msql | 4 +- ...n_int_generated_with_existing_columns.msql | 4 +- .../12_plus/create_column_int_identity.msql | 4 +- ...create_column_int_identity_by_default.msql | 4 +- .../columns/tests/ppas/12_plus/test.json | 421 +++- .../ppas/default/create_column_char.msql | 4 +- .../tests/ppas/default/create_column_int.msql | 4 +- .../columns/tests/ppas/default/test.json | 182 +- ...nt.sql => alter_check_constraint_msql.sql} | 0 .../Default/create_check_constraint_msql.sql | 6 + .../create_check_constraint_with_valid.sql | 9 + ...reate_check_constraint_with_valid_msql.sql | 5 + .../check_constraint/tests/Default/test.json | 20 +- ...ql => alter_exclusion_constraint_msql.sql} | 0 .../create_exclusion_constraint_exp_msql.sql | 10 + .../create_exclusion_constraint_msql.sql | 10 + .../tests/11_plus/test.json | 101 +- ...ql => alter_exclusion_constraint_msql.sql} | 0 ....sql => alter_without_fillfactor_msql.sql} | 0 .../create_exclusion_constraint_msql.sql | 9 + .../create_without_fillfactor_msql.sql | 7 + .../default/exclusion_constraint_exp_msql.sql | 10 + .../tests/default/test.json | 98 +- .../indexes/tests/default/test_indexes.json | 36 +- .../alter_delete_policy_with_using.sql | 10 + .../alter_delete_policy_with_using_msql.sql | 2 + .../tests/10_plus/alter_select_policy.sql | 10 + .../10_plus/alter_select_policy_msql.sql | 2 + .../tests/10_plus/alter_simple_all_policy.sql | 11 + .../10_plus/alter_simple_all_policy_msql.sql | 5 + .../10_plus/alter_simple_insert_policy.sql | 10 + .../alter_simple_insert_policy_msql.sql | 2 + ...ter_update_policy_with_check_and_using.sql | 11 + ...pdate_policy_with_check_and_using_msql.sql | 5 + .../create_delete_policy_with_using.sql | 10 + .../create_delete_policy_with_using_msql.sql | 6 + .../tests/10_plus/create_insert_policy.sql | 9 - .../tests/10_plus/create_select_policy.sql | 6 +- .../10_plus/create_select_policy_msql.sql | 5 + .../10_plus/create_simple_all_policy.sql | 9 + .../10_plus/create_simple_all_policy_msql.sql | 5 + .../10_plus/create_simple_insert_policy.sql | 9 + .../create_simple_insert_policy_msql.sql | 5 + ...ate_update_policy_with_check_and_using.sql | 11 + ...pdate_policy_with_check_and_using_msql.sql | 7 + .../tests/10_plus/test.json | 186 +- .../tests/12_plus/alter_select_policy.sql | 10 + .../12_plus/alter_simple_insert_policy.sql | 10 + ...ter_update_policy_with_check_and_using.sql | 11 + .../create_delete_policy_with_using.sql | 10 + .../tests/12_plus/test.json | 275 +++ .../alter_delete_policy_with_using.sql | 9 + .../alter_delete_policy_with_using_msql.sql | 2 + .../alter_insert_policy_with_check.sql | 9 + .../alter_insert_policy_with_check_msql.sql | 5 + .../tests/default/alter_policy.sql | 9 - .../tests/default/alter_policy_msql.sql | 2 - .../tests/default/alter_select_policy.sql | 9 + .../default/alter_select_policy_msql.sql | 2 + .../tests/default/alter_simple_all_policy.sql | 10 + .../default/alter_simple_all_policy_msql.sql | 5 + .../default/alter_simple_insert_policy.sql | 9 + .../alter_simple_insert_policy_msql.sql | 2 + ...ter_update_policy_with_check_and_using.sql | 10 + ...pdate_policy_with_check_and_using_msql.sql | 5 + .../tests/default/create_all_event_policy.sql | 11 - .../create_delete_policy_with_using.sql | 9 + .../create_delete_policy_with_using_msql.sql | 5 + .../tests/default/create_insert_policy.sql | 9 - .../create_insert_policy_with_check.sql | 9 + .../create_insert_policy_with_check_msql.sql | 5 + .../tests/default/create_public_policy.sql | 9 - .../tests/default/create_select_policy.sql | 7 +- .../default/create_select_policy_msql.sql | 4 + .../default/create_simple_all_policy.sql | 8 + .../default/create_simple_all_policy_msql.sql | 4 + .../default/create_simple_insert_policy.sql | 8 + .../create_simple_insert_policy_msql.sql | 4 + ...ate_update_policy_with_check_and_using.sql | 10 + ...pdate_policy_with_check_and_using_msql.sql | 6 + .../tests/default/test.json | 218 +- .../tables/rules/tests/default/test.json | 30 +- .../10_plus/alter_table_with_toast_table.sql | 33 + .../alter_table_with_toast_table_msql.sql | 15 + .../10_plus/create_table_with_partition.sql | 28 + .../create_table_with_partition_msql.sql | 18 + .../create_table_with_range_partition.sql | 25 + ...create_table_with_range_partition_msql.sql | 15 + .../schemas/tables/tests/pg/10_plus/test.json | 1836 +++++++++++++++ .../11_plus/alter_table_with_toast_table.sql | 33 + .../alter_table_with_toast_table_msql.sql | 14 + .../create_table_with_hash_partition.sql | 28 + .../create_table_with_hash_partition_msql.sql | 18 + .../schemas/tables/tests/pg/11_plus/test.json | 1986 +++++++++++++++++ .../pg/12_plus/alter_table_add_another_fk.sql | 31 + .../alter_table_add_another_fk_msql.sql | 6 + .../tests/pg/12_plus/alter_table_add_cols.sql | 20 + .../pg/12_plus/alter_table_add_cols_msql.sql | 5 + .../alter_table_add_exclude_constraint.sql | 34 + ...lter_table_add_exclude_constraint_msql.sql | 3 + ...r_table_add_null_constraint_rename_col.sql | 22 + ...le_add_null_constraint_rename_col_msql.sql | 5 + .../pg/12_plus/alter_table_add_partition.sql | 34 + ...alter_table_add_pk_not_null_constraint.sql | 22 + ..._table_add_pk_not_null_constraint_msql.sql | 4 + .../12_plus/alter_table_add_unique_const.sql | 28 + .../alter_table_add_unique_const_msql.sql | 3 + .../alter_table_change_col_data_type.sql | 21 + .../alter_table_change_col_data_type_msql.sql | 8 + .../pg/12_plus/alter_table_delete_cols.sql | 19 + .../12_plus/alter_table_delete_cols_msql.sql | 1 + .../alter_table_delete_constraints.sql | 22 + .../alter_table_delete_constraints_msql.sql | 2 + .../pg/12_plus/alter_table_update_grants.sql | 24 + .../pg/12_plus/alter_table_update_grants2.sql | 26 + .../alter_table_update_grants2_msql.sql | 7 + .../alter_table_update_grants_msql.sql | 7 + .../12_plus/alter_table_with_toast_table.sql | 33 + .../alter_table_with_toast_table_msql.sql | 14 + .../create_table_with_advanced_options.sql | 26 + ...reate_table_with_advanced_options_msql.sql | 21 + .../create_table_with_custom_autovacuum.sql | 29 + ...eate_table_with_custom_autovacuum_msql.sql | 24 + .../tests/pg/12_plus/create_table_with_fk.sql | 26 + .../pg/12_plus/create_table_with_fk_msql.sql | 21 + .../create_table_with_hash_partition.sql | 24 + .../create_table_with_hash_partition_msql.sql | 15 + .../pg/12_plus/create_table_with_lik_tbl.sql | 19 + .../create_table_with_lik_tbl_msql.sql | 16 + .../12_plus/create_table_with_partition.sql | 24 + .../create_table_with_partition_msql.sql | 15 + .../tests/pg/12_plus/create_table_with_pk.sql | 18 + .../pg/12_plus/create_table_with_pk_chk.sql | 26 + .../12_plus/create_table_with_pk_chk_msql.sql | 20 + .../pg/12_plus/create_table_with_pk_msql.sql | 12 + .../create_table_with_range_partition.sql | 21 + ...create_table_with_range_partition_msql.sql | 12 + .../create_table_without_primary_key.sql | 21 + .../create_table_without_primary_key_msql.sql | 15 + .../schemas/tables/tests/pg/12_plus/test.json | 1986 +++++++++++++++++ .../pg/default/alter_table_add_another_fk.sql | 33 + .../alter_table_add_another_fk_msql.sql | 6 + .../tests/pg/default/alter_table_add_cols.sql | 22 + .../pg/default/alter_table_add_cols_msql.sql | 5 + .../alter_table_add_exclude_constraint.sql | 36 + ...lter_table_add_exclude_constraint_msql.sql | 3 + ...r_table_add_null_constraint_rename_col.sql | 24 + ...le_add_null_constraint_rename_col_msql.sql | 5 + ...alter_table_add_pk_not_null_constraint.sql | 24 + ..._table_add_pk_not_null_constraint_msql.sql | 4 + .../default/alter_table_add_unique_const.sql | 30 + .../alter_table_add_unique_const_msql.sql | 3 + .../alter_table_change_col_data_type.sql | 23 + .../alter_table_change_col_data_type_msql.sql | 8 + .../pg/default/alter_table_delete_cols.sql | 21 + .../default/alter_table_delete_cols_msql.sql | 1 + .../alter_table_delete_constraints.sql | 24 + .../alter_table_delete_constraints_msql.sql | 2 + .../pg/default/alter_table_update_grants.sql | 24 + .../pg/default/alter_table_update_grants2.sql | 26 + .../alter_table_update_grants2_msql.sql | 7 + .../alter_table_update_grants_msql.sql | 7 + .../default/alter_table_with_toast_table.sql | 33 + .../alter_table_with_toast_table_msql.sql | 14 + .../create_table_with_advanced_options.sql | 26 + ...reate_table_with_advanced_options_msql.sql | 21 + .../create_table_with_custom_autovacuum.sql | 29 + ...eate_table_with_custom_autovacuum_msql.sql | 24 + .../tests/pg/default/create_table_with_fk.sql | 28 + .../pg/default/create_table_with_fk_msql.sql | 24 + .../pg/default/create_table_with_lik_tbl.sql | 21 + .../create_table_with_lik_tbl_msql.sql | 19 + .../tests/pg/default/create_table_with_pk.sql | 20 + .../pg/default/create_table_with_pk_chk.sql | 28 + .../default/create_table_with_pk_chk_msql.sql | 23 + .../pg/default/create_table_with_pk_msql.sql | 15 + .../create_table_without_primary_key.sql | 23 + .../create_table_without_primary_key_msql.sql | 18 + .../schemas/tables/tests/pg/default/test.json | 1538 +++++++++++++ .../10_plus/alter_table_with_toast_table.sql | 33 + .../alter_table_with_toast_table_msql.sql | 15 + .../10_plus/create_table_with_partition.sql | 28 + .../create_table_with_partition_msql.sql | 18 + .../create_table_with_range_partition.sql | 25 + ...create_table_with_range_partition_msql.sql | 15 + .../tables/tests/ppas/10_plus/test.json | 1836 +++++++++++++++ .../11_plus/alter_table_with_toast_table.sql | 33 + .../alter_table_with_toast_table_msql.sql | 14 + .../create_table_with_hash_partition.sql | 28 + .../create_table_with_hash_partition_msql.sql | 18 + .../tables/tests/ppas/11_plus/test.json | 1986 +++++++++++++++++ .../12_plus/alter_table_add_another_fk.sql | 31 + .../alter_table_add_another_fk_msql.sql | 6 + .../ppas/12_plus/alter_table_add_cols.sql | 20 + .../12_plus/alter_table_add_cols_msql.sql | 5 + .../alter_table_add_exclude_constraint.sql | 34 + ...lter_table_add_exclude_constraint_msql.sql | 3 + ...r_table_add_null_constraint_rename_col.sql | 22 + ...le_add_null_constraint_rename_col_msql.sql | 5 + .../12_plus/alter_table_add_partition.sql | 34 + ...alter_table_add_pk_not_null_constraint.sql | 22 + ..._table_add_pk_not_null_constraint_msql.sql | 4 + .../12_plus/alter_table_add_unique_const.sql | 28 + .../alter_table_add_unique_const_msql.sql | 3 + .../alter_table_change_col_data_type.sql | 21 + .../alter_table_change_col_data_type_msql.sql | 8 + .../ppas/12_plus/alter_table_delete_cols.sql | 19 + .../12_plus/alter_table_delete_cols_msql.sql | 1 + .../alter_table_delete_constraints.sql | 22 + .../alter_table_delete_constraints_msql.sql | 2 + .../12_plus/alter_table_update_grants.sql | 24 + .../12_plus/alter_table_update_grants2.sql | 26 + .../alter_table_update_grants2_msql.sql | 7 + .../alter_table_update_grants_msql.sql | 7 + .../12_plus/alter_table_with_toast_table.sql | 33 + .../alter_table_with_toast_table_msql.sql | 14 + .../create_table_with_advanced_options.sql | 26 + ...reate_table_with_advanced_options_msql.sql | 21 + .../create_table_with_custom_autovacuum.sql | 29 + ...eate_table_with_custom_autovacuum_msql.sql | 24 + .../ppas/12_plus/create_table_with_fk.sql | 26 + .../12_plus/create_table_with_fk_msql.sql | 21 + .../create_table_with_hash_partition.sql | 24 + .../create_table_with_hash_partition_msql.sql | 15 + .../12_plus/create_table_with_lik_tbl.sql | 19 + .../create_table_with_lik_tbl_msql.sql | 16 + .../12_plus/create_table_with_partition.sql | 24 + .../create_table_with_partition_msql.sql | 15 + .../ppas/12_plus/create_table_with_pk.sql | 18 + .../ppas/12_plus/create_table_with_pk_chk.sql | 26 + .../12_plus/create_table_with_pk_chk_msql.sql | 20 + .../12_plus/create_table_with_pk_msql.sql | 12 + .../create_table_with_range_partition.sql | 21 + ...create_table_with_range_partition_msql.sql | 12 + .../create_table_without_primary_key.sql | 21 + .../create_table_without_primary_key_msql.sql | 15 + .../tables/tests/ppas/12_plus/test.json | 1986 +++++++++++++++++ .../default/alter_table_add_another_fk.sql | 33 + .../alter_table_add_another_fk_msql.sql | 6 + .../ppas/default/alter_table_add_cols.sql | 22 + .../default/alter_table_add_cols_msql.sql | 5 + .../alter_table_add_exclude_constraint.sql | 36 + ...lter_table_add_exclude_constraint_msql.sql | 3 + ...r_table_add_null_constraint_rename_col.sql | 24 + ...le_add_null_constraint_rename_col_msql.sql | 5 + ...alter_table_add_pk_not_null_constraint.sql | 24 + ..._table_add_pk_not_null_constraint_msql.sql | 4 + .../default/alter_table_add_unique_const.sql | 30 + .../alter_table_add_unique_const_msql.sql | 3 + .../alter_table_change_col_data_type.sql | 23 + .../alter_table_change_col_data_type_msql.sql | 8 + .../ppas/default/alter_table_delete_cols.sql | 21 + .../default/alter_table_delete_cols_msql.sql | 1 + .../alter_table_delete_constraints.sql | 24 + .../alter_table_delete_constraints_msql.sql | 2 + .../default/alter_table_update_grants.sql | 24 + .../default/alter_table_update_grants2.sql | 26 + .../alter_table_update_grants2_msql.sql | 7 + .../alter_table_update_grants_msql.sql | 7 + .../default/alter_table_with_toast_table.sql | 33 + .../alter_table_with_toast_table_msql.sql | 14 + .../create_table_with_advanced_options.sql | 26 + ...reate_table_with_advanced_options_msql.sql | 21 + .../create_table_with_custom_autovacuum.sql | 29 + ...eate_table_with_custom_autovacuum_msql.sql | 24 + .../ppas/default/create_table_with_fk.sql | 28 + .../default/create_table_with_fk_msql.sql | 24 + .../default/create_table_with_lik_tbl.sql | 21 + .../create_table_with_lik_tbl_msql.sql | 19 + .../ppas/default/create_table_with_pk.sql | 20 + .../ppas/default/create_table_with_pk_chk.sql | 28 + .../default/create_table_with_pk_chk_msql.sql | 23 + .../default/create_table_with_pk_msql.sql | 15 + .../create_table_without_primary_key.sql | 23 + .../create_table_without_primary_key_msql.sql | 18 + .../tables/tests/ppas/default/test.json | 1538 +++++++++++++ ...r_delete_event_trigger_with_transition.sql | 16 + ...ete_event_trigger_with_transition_msql.sql | 2 + ...r_insert_event_trigger_with_transition.sql | 16 + ...ert_event_trigger_with_transition_msql.sql | 2 + ...ter_update_event_trigger_enable_always.sql | 16 + ...pdate_event_trigger_enable_always_msql.sql | 2 + ...re_update_event_trigger_enable_replica.sql | 16 + ...r_delete_event_trigger_with_transition.sql | 13 + ...ete_event_trigger_with_transition_msql.sql | 9 + ...r_insert_event_trigger_with_transition.sql | 13 + ...ert_event_trigger_with_transition_msql.sql | 9 + .../create_after_update_event_trigger.sql | 13 + ...create_after_update_event_trigger_msql.sql | 9 + ...ate_event_trigger_with_transition_msql.sql | 10 + .../create_before_update_event_trigger.sql | 13 + .../triggers/tests/pg/10_plus/test.json | 312 +++ ...r_delete_event_trigger_with_transition.sql | 16 + ...ete_event_trigger_with_transition_msql.sql | 2 + ...r_insert_event_trigger_with_transition.sql | 16 + ...ert_event_trigger_with_transition_msql.sql | 2 + ...ter_update_event_trigger_enable_always.sql | 16 + ...pdate_event_trigger_enable_always_msql.sql | 2 + .../alter_before_insert_event_trigger.sql | 15 + ...alter_before_insert_event_trigger_msql.sql | 2 + ...re_update_event_trigger_enable_replica.sql | 16 + ...date_event_trigger_enable_replica_msql.sql | 2 + .../create_after_delete_event_trigger.sql | 13 + ...create_after_delete_event_trigger_msql.sql | 9 + ...r_delete_event_trigger_with_transition.sql | 13 + ...ete_event_trigger_with_transition_msql.sql | 9 + ...r_insert_event_trigger_with_transition.sql | 13 + ...ert_event_trigger_with_transition_msql.sql | 9 + .../create_after_update_event_trigger.sql | 13 + ...create_after_update_event_trigger_msql.sql | 9 + ...eate_b4r_update_multiple_event_trigger.sql | 12 + ...b4r_update_multiple_event_trigger_msql.sql | 8 + ...reate_before_insert_event_at_statement.sql | 12 + ..._before_insert_event_at_statement_msql.sql | 8 + .../create_before_insert_event_trigger.sql | 12 + ...reate_before_insert_event_trigger_msql.sql | 8 + .../create_before_update_event_trigger.sql | 13 + ...reate_before_update_event_trigger_msql.sql | 9 + .../triggers/tests/pg/11_plus/test.json | 312 +++ ...ter_update_event_trigger_enable_always.sql | 16 + ...pdate_event_trigger_enable_always_msql.sql | 2 + .../alter_before_insert_event_trigger.sql | 15 + ...alter_before_insert_event_trigger_msql.sql | 2 + ...re_update_event_trigger_enable_replica.sql | 16 + ...date_event_trigger_enable_replica_msql.sql | 2 + .../create_after_delete_event_trigger.sql | 13 + ...create_after_delete_event_trigger_msql.sql | 9 + ...r_insert_event_trigger_with_transition.sql | 13 + ...ert_event_trigger_with_transition_msql.sql | 9 + .../create_after_update_event_trigger.sql | 13 + ...create_after_update_event_trigger_msql.sql | 9 + ...eate_b4r_update_multiple_event_trigger.sql | 12 + ...b4r_update_multiple_event_trigger_msql.sql | 8 + ...reate_before_insert_event_at_statement.sql | 12 + ..._before_insert_event_at_statement_msql.sql | 8 + .../create_before_insert_event_trigger.sql | 12 + ...reate_before_insert_event_trigger_msql.sql | 8 + .../create_before_update_event_trigger.sql | 13 + ...reate_before_update_event_trigger_msql.sql | 9 + .../default/create_plain_trigger_function.sql | 17 + .../triggers/tests/pg/default/test.json | 241 ++ ...r_delete_event_trigger_with_transition.sql | 16 + ...ete_event_trigger_with_transition_msql.sql | 2 + ...r_insert_event_trigger_with_transition.sql | 16 + ...ert_event_trigger_with_transition_msql.sql | 2 + ...ter_update_event_trigger_enable_always.sql | 16 + ...pdate_event_trigger_enable_always_msql.sql | 2 + ...re_update_event_trigger_enable_replica.sql | 16 + ...r_delete_event_trigger_with_transition.sql | 13 + ...ete_event_trigger_with_transition_msql.sql | 9 + ...r_insert_event_trigger_with_transition.sql | 13 + ...ert_event_trigger_with_transition_msql.sql | 9 + .../create_after_update_event_trigger.sql | 13 + ...create_after_update_event_trigger_msql.sql | 9 + ...ate_event_trigger_with_transition_msql.sql | 10 + .../create_before_update_event_trigger.sql | 13 + .../triggers/tests/ppas/10_plus/test.json | 312 +++ ...r_delete_event_trigger_with_transition.sql | 16 + ...ete_event_trigger_with_transition_msql.sql | 2 + ...r_insert_event_trigger_with_transition.sql | 16 + ...ert_event_trigger_with_transition_msql.sql | 2 + ...ter_update_event_trigger_enable_always.sql | 16 + ...pdate_event_trigger_enable_always_msql.sql | 2 + .../alter_before_insert_event_trigger.sql | 15 + ...alter_before_insert_event_trigger_msql.sql | 2 + ...re_update_event_trigger_enable_replica.sql | 16 + ...date_event_trigger_enable_replica_msql.sql | 2 + .../create_after_delete_event_trigger.sql | 13 + ...create_after_delete_event_trigger_msql.sql | 9 + ...r_delete_event_trigger_with_transition.sql | 13 + ...ete_event_trigger_with_transition_msql.sql | 9 + ...r_insert_event_trigger_with_transition.sql | 13 + ...ert_event_trigger_with_transition_msql.sql | 9 + .../create_after_update_event_trigger.sql | 13 + ...create_after_update_event_trigger_msql.sql | 9 + ...eate_b4r_update_multiple_event_trigger.sql | 12 + ...b4r_update_multiple_event_trigger_msql.sql | 8 + ...reate_before_insert_event_at_statement.sql | 12 + ..._before_insert_event_at_statement_msql.sql | 8 + .../create_before_insert_event_trigger.sql | 12 + ...reate_before_insert_event_trigger_msql.sql | 8 + .../create_before_update_event_trigger.sql | 13 + ...reate_before_update_event_trigger_msql.sql | 9 + .../triggers/tests/ppas/11_plus/test.json | 312 +++ ...ter_update_event_trigger_enable_always.sql | 16 + ...pdate_event_trigger_enable_always_msql.sql | 2 + .../alter_before_insert_event_trigger.sql | 15 + ...alter_before_insert_event_trigger_msql.sql | 2 + ...re_update_event_trigger_enable_replica.sql | 16 + ...date_event_trigger_enable_replica_msql.sql | 2 + .../create_after_delete_event_trigger.sql | 13 + ...create_after_delete_event_trigger_msql.sql | 9 + .../create_after_update_event_trigger.sql | 13 + ...create_after_update_event_trigger_msql.sql | 9 + ...eate_b4r_update_multiple_event_trigger.sql | 12 + ...b4r_update_multiple_event_trigger_msql.sql | 8 + ...reate_before_insert_event_at_statement.sql | 12 + ..._before_insert_event_at_statement_msql.sql | 8 + .../create_before_insert_event_trigger.sql | 12 + ...reate_before_insert_event_trigger_msql.sql | 8 + .../create_before_update_event_trigger.sql | 13 + ...reate_before_update_event_trigger_msql.sql | 9 + .../default/create_plain_trigger_function.sql | 17 + .../triggers/tests/ppas/default/test.json | 241 ++ .../python_test_utils/test_utils.py | 1 + web/regression/re_sql/tests/test_resql.py | 44 +- web/regression/runtests.py | 3 + 460 files changed, 23934 insertions(+), 584 deletions(-) create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/alter_column_text_with_default_value.msql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/alter_column_text_with_default_value.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/alter_column_timestamp_with_default_value_using_function.msql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/alter_column_timestamp_with_default_value_using_function.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/alter_column_with_interger_array_and_options.msql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/alter_column_with_interger_array_and_options.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_text_with_default_value.msql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_text_with_default_value.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_timestamp_with_default_value_using_function.msql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_timestamp_with_default_value_using_function.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_with_interger_array_and_options.msql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_with_interger_array_and_options.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_text_with_default_value.msql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_text_with_default_value.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_timestamp_with_default_value_using_function.msql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_timestamp_with_default_value_using_function.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_with_interger_array_and_options.msql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_with_interger_array_and_options.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_text_with_default_value.msql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_text_with_default_value.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_timestamp_with_default_value_using_function.msql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_timestamp_with_default_value_using_function.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_with_interger_array_and_options.msql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_with_interger_array_and_options.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/alter_column_text_with_default_value.msql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/alter_column_text_with_default_value.sql rename web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/tests/Default/{msql_check_constraint.sql => alter_check_constraint_msql.sql} (100%) create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/tests/Default/create_check_constraint_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/tests/Default/create_check_constraint_with_valid.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/tests/Default/create_check_constraint_with_valid_msql.sql rename web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/11_plus/{msql_exclusion_constraint.sql => alter_exclusion_constraint_msql.sql} (100%) create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/11_plus/create_exclusion_constraint_exp_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/11_plus/create_exclusion_constraint_msql.sql rename web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/default/{msql_exclusion_constraint.sql => alter_exclusion_constraint_msql.sql} (100%) rename web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/default/{msql_without_fillfactor.sql => alter_without_fillfactor_msql.sql} (100%) create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/default/create_exclusion_constraint_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/default/create_without_fillfactor_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/default/exclusion_constraint_exp_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_delete_policy_with_using.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_delete_policy_with_using_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_select_policy.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_select_policy_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_simple_all_policy.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_simple_all_policy_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_simple_insert_policy.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_simple_insert_policy_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_update_policy_with_check_and_using.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_update_policy_with_check_and_using_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_delete_policy_with_using.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_delete_policy_with_using_msql.sql delete mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_insert_policy.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_select_policy_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_simple_all_policy.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_simple_all_policy_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_simple_insert_policy.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_simple_insert_policy_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_update_policy_with_check_and_using.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_update_policy_with_check_and_using_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/12_plus/alter_select_policy.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/12_plus/alter_simple_insert_policy.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/12_plus/alter_update_policy_with_check_and_using.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/12_plus/create_delete_policy_with_using.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/12_plus/test.json create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_delete_policy_with_using.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_delete_policy_with_using_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_insert_policy_with_check.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_insert_policy_with_check_msql.sql delete mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_policy.sql delete mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_policy_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_select_policy.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_select_policy_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_simple_all_policy.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_simple_all_policy_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_simple_insert_policy.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_simple_insert_policy_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_update_policy_with_check_and_using.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_update_policy_with_check_and_using_msql.sql delete mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_all_event_policy.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_delete_policy_with_using.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_delete_policy_with_using_msql.sql delete mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_insert_policy.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_insert_policy_with_check.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_insert_policy_with_check_msql.sql delete mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_public_policy.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_select_policy_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_simple_all_policy.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_simple_all_policy_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_simple_insert_policy.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_simple_insert_policy_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_update_policy_with_check_and_using.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_update_policy_with_check_and_using_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/alter_table_with_toast_table.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/alter_table_with_toast_table_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_partition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_partition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_range_partition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_range_partition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/test.json create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/alter_table_with_toast_table.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/alter_table_with_toast_table_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_table_with_hash_partition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_table_with_hash_partition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/test.json create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_another_fk.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_another_fk_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_cols.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_cols_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_exclude_constraint.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_exclude_constraint_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_null_constraint_rename_col.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_null_constraint_rename_col_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_partition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_pk_not_null_constraint.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_pk_not_null_constraint_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_unique_const.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_unique_const_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_change_col_data_type.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_change_col_data_type_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_delete_cols.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_delete_cols_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_delete_constraints.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_delete_constraints_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_update_grants.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_update_grants2.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_update_grants2_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_update_grants_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_with_toast_table.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_with_toast_table_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_advanced_options.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_advanced_options_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_custom_autovacuum.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_custom_autovacuum_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_fk.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_fk_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_hash_partition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_hash_partition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_lik_tbl.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_lik_tbl_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_partition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_partition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_pk.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_pk_chk.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_pk_chk_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_pk_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_range_partition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_range_partition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_without_primary_key.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_without_primary_key_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/test.json create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_another_fk.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_another_fk_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_cols.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_cols_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_exclude_constraint.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_exclude_constraint_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_null_constraint_rename_col.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_null_constraint_rename_col_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_pk_not_null_constraint.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_pk_not_null_constraint_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_unique_const.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_unique_const_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_change_col_data_type.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_change_col_data_type_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_delete_cols.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_delete_cols_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_delete_constraints.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_delete_constraints_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_update_grants.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_update_grants2.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_update_grants2_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_update_grants_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_with_toast_table.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_with_toast_table_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_advanced_options.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_advanced_options_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_custom_autovacuum.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_custom_autovacuum_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_fk.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_fk_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_lik_tbl.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_lik_tbl_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_pk.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_pk_chk.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_pk_chk_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_pk_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_without_primary_key.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_without_primary_key_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/test.json create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/alter_table_with_toast_table.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/alter_table_with_toast_table_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_table_with_partition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_table_with_partition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_table_with_range_partition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_table_with_range_partition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/test.json create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/alter_table_with_toast_table.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/alter_table_with_toast_table_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/create_table_with_hash_partition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/create_table_with_hash_partition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/test.json create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_another_fk.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_another_fk_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_cols.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_cols_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_exclude_constraint.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_exclude_constraint_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_null_constraint_rename_col.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_null_constraint_rename_col_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_partition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_pk_not_null_constraint.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_pk_not_null_constraint_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_unique_const.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_unique_const_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_change_col_data_type.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_change_col_data_type_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_delete_cols.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_delete_cols_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_delete_constraints.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_delete_constraints_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_update_grants.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_update_grants2.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_update_grants2_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_update_grants_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_with_toast_table.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_with_toast_table_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_advanced_options.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_advanced_options_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_custom_autovacuum.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_custom_autovacuum_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_fk.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_fk_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_hash_partition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_hash_partition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_lik_tbl.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_lik_tbl_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_partition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_partition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_pk.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_pk_chk.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_pk_chk_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_pk_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_range_partition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_range_partition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_without_primary_key.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_without_primary_key_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/test.json create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_another_fk.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_another_fk_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_cols.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_cols_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_exclude_constraint.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_exclude_constraint_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_null_constraint_rename_col.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_null_constraint_rename_col_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_pk_not_null_constraint.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_pk_not_null_constraint_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_unique_const.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_unique_const_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_change_col_data_type.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_change_col_data_type_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_delete_cols.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_delete_cols_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_delete_constraints.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_delete_constraints_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_update_grants.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_update_grants2.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_update_grants2_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_update_grants_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_with_toast_table.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_with_toast_table_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_advanced_options.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_advanced_options_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_custom_autovacuum.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_custom_autovacuum_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_fk.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_fk_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_lik_tbl.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_lik_tbl_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_pk.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_pk_chk.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_pk_chk_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_pk_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_without_primary_key.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_without_primary_key_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/test.json create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_after_delete_event_trigger_with_transition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_after_delete_event_trigger_with_transition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_after_insert_event_trigger_with_transition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_after_insert_event_trigger_with_transition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_after_update_event_trigger_enable_always.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_after_update_event_trigger_enable_always_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_before_update_event_trigger_enable_replica.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_delete_event_trigger_with_transition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_delete_event_trigger_with_transition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_insert_event_trigger_with_transition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_insert_event_trigger_with_transition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_update_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_update_event_trigger_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_update_event_trigger_with_transition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_before_update_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/test.json create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_after_delete_event_trigger_with_transition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_after_delete_event_trigger_with_transition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_after_insert_event_trigger_with_transition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_after_insert_event_trigger_with_transition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_after_update_event_trigger_enable_always.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_after_update_event_trigger_enable_always_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_before_insert_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_before_insert_event_trigger_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_before_update_event_trigger_enable_replica.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_before_update_event_trigger_enable_replica_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_delete_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_delete_event_trigger_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_delete_event_trigger_with_transition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_delete_event_trigger_with_transition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_insert_event_trigger_with_transition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_insert_event_trigger_with_transition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_update_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_update_event_trigger_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_b4r_update_multiple_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_b4r_update_multiple_event_trigger_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_before_insert_event_at_statement.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_before_insert_event_at_statement_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_before_insert_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_before_insert_event_trigger_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_before_update_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_before_update_event_trigger_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/test.json create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/alter_after_update_event_trigger_enable_always.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/alter_after_update_event_trigger_enable_always_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/alter_before_insert_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/alter_before_insert_event_trigger_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/alter_before_update_event_trigger_enable_replica.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/alter_before_update_event_trigger_enable_replica_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_after_delete_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_after_delete_event_trigger_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_after_insert_event_trigger_with_transition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_after_insert_event_trigger_with_transition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_after_update_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_after_update_event_trigger_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_b4r_update_multiple_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_b4r_update_multiple_event_trigger_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_before_insert_event_at_statement.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_before_insert_event_at_statement_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_before_insert_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_before_insert_event_trigger_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_before_update_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_before_update_event_trigger_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_plain_trigger_function.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/test.json create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_after_delete_event_trigger_with_transition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_after_delete_event_trigger_with_transition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_after_insert_event_trigger_with_transition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_after_insert_event_trigger_with_transition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_after_update_event_trigger_enable_always.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_after_update_event_trigger_enable_always_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_before_update_event_trigger_enable_replica.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_delete_event_trigger_with_transition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_delete_event_trigger_with_transition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_insert_event_trigger_with_transition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_insert_event_trigger_with_transition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_update_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_update_event_trigger_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_update_event_trigger_with_transition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_before_update_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/test.json create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_after_delete_event_trigger_with_transition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_after_delete_event_trigger_with_transition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_after_insert_event_trigger_with_transition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_after_insert_event_trigger_with_transition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_after_update_event_trigger_enable_always.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_after_update_event_trigger_enable_always_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_before_insert_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_before_insert_event_trigger_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_before_update_event_trigger_enable_replica.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_before_update_event_trigger_enable_replica_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_delete_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_delete_event_trigger_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_delete_event_trigger_with_transition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_delete_event_trigger_with_transition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_insert_event_trigger_with_transition.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_insert_event_trigger_with_transition_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_update_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_update_event_trigger_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_b4r_update_multiple_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_b4r_update_multiple_event_trigger_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_before_insert_event_at_statement.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_before_insert_event_at_statement_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_before_insert_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_before_insert_event_trigger_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_before_update_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_before_update_event_trigger_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/test.json create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/alter_after_update_event_trigger_enable_always.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/alter_after_update_event_trigger_enable_always_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/alter_before_insert_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/alter_before_insert_event_trigger_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/alter_before_update_event_trigger_enable_replica.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/alter_before_update_event_trigger_enable_replica_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_after_delete_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_after_delete_event_trigger_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_after_update_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_after_update_event_trigger_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_b4r_update_multiple_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_b4r_update_multiple_event_trigger_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_before_insert_event_at_statement.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_before_insert_event_at_statement_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_before_insert_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_before_insert_event_trigger_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_before_update_event_trigger.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_before_update_event_trigger_msql.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_plain_trigger_function.sql create mode 100644 web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/test.json diff --git a/docs/en_US/release_notes_5_4.rst b/docs/en_US/release_notes_5_4.rst index e0af5690f..2426d127a 100644 --- a/docs/en_US/release_notes_5_4.rst +++ b/docs/en_US/release_notes_5_4.rst @@ -22,6 +22,7 @@ New features Housekeeping ************ +| `Issue #4622 `_ - Added RESQL/MSQL test cases for Table and its child nodes. | `Issue #6225 `_ - Updated Flask-Security-Too to the latest v4. | `Issue #6460 `_ - Added a mechanism to detect a corrupt/broken config database file. diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/alter_column_text_with_default_value.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/alter_column_text_with_default_value.msql new file mode 100644 index 000000000..8dfe39e29 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/alter_column_text_with_default_value.msql @@ -0,0 +1,4 @@ +ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN "col__1_$%{}[]()&*^!@""'`\/#" SET DEFAULT 'changed default value'; + +GRANT SELECT("col__1_$%{}[]()&*^!@""'`\/#") ON testschema."table_2_$%{}[]()&*^!@""'`\/#" TO PUBLIC; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/alter_column_text_with_default_value.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/alter_column_text_with_default_value.sql new file mode 100644 index 000000000..eb85e5673 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/alter_column_text_with_default_value.sql @@ -0,0 +1,11 @@ +-- Column: testschema."table_2_$%{}[]()&*^!@""'`\/#"."col__1_$%{}[]()&*^!@""'`\/#" + +-- ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col__1_$%{}[]()&*^!@""'`\/#"; + +ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" + ADD COLUMN "col__1_$%{}[]()&*^!@""'`\/#" text COLLATE pg_catalog."default" DEFAULT 'changed default value'::text; + +COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col__1_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; + +GRANT SELECT("col__1_$%{}[]()&*^!@""'`\/#") ON testschema."table_2_$%{}[]()&*^!@""'`\/#" TO PUBLIC; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/alter_column_timestamp_with_default_value_using_function.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/alter_column_timestamp_with_default_value_using_function.msql new file mode 100644 index 000000000..22681ca73 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/alter_column_timestamp_with_default_value_using_function.msql @@ -0,0 +1,7 @@ +ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN "col__2_$%{}[]()&*^!@""'`\/#" TYPE time(6) with time zone ; +ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN "col__2_$%{}[]()&*^!@""'`\/#" SET NOT NULL; + +COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col__2_$%{}[]()&*^!@""'`\/#" + IS 'test comment modification'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/alter_column_timestamp_with_default_value_using_function.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/alter_column_timestamp_with_default_value_using_function.sql new file mode 100644 index 000000000..00660a4f0 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/alter_column_timestamp_with_default_value_using_function.sql @@ -0,0 +1,9 @@ +-- Column: testschema."table_2_$%{}[]()&*^!@""'`\/#"."col__2_$%{}[]()&*^!@""'`\/#" + +-- ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col__2_$%{}[]()&*^!@""'`\/#"; + +ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" + ADD COLUMN "col__2_$%{}[]()&*^!@""'`\/#" time(6) with time zone NOT NULL DEFAULT now(); + +COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col__2_$%{}[]()&*^!@""'`\/#" + IS 'test comment modification'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/alter_column_with_interger_array_and_options.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/alter_column_with_interger_array_and_options.msql new file mode 100644 index 000000000..4e1bdae8b --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/alter_column_with_interger_array_and_options.msql @@ -0,0 +1,3 @@ +ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN "col__3_$%{}[]()&*^!@""'`\/#" + SET (n_distinct=2); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/alter_column_with_interger_array_and_options.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/alter_column_with_interger_array_and_options.sql new file mode 100644 index 000000000..bffcfe506 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/alter_column_with_interger_array_and_options.sql @@ -0,0 +1,13 @@ +-- Column: testschema."table_2_$%{}[]()&*^!@""'`\/#"."col__3_$%{}[]()&*^!@""'`\/#" + +-- ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col__3_$%{}[]()&*^!@""'`\/#"; + +ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" + ADD COLUMN "col__3_$%{}[]()&*^!@""'`\/#" integer[] NOT NULL; + +COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col__3_$%{}[]()&*^!@""'`\/#" + IS 'comment'; + +ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN "col__3_$%{}[]()&*^!@""'`\/#" + SET (n_distinct=2); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_char.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_char.msql index d0592b96b..0fb8d76d6 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_char.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_char.msql @@ -1,5 +1,5 @@ ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" - ADD COLUMN "col_2_$%{}[]()&*^!@""'`\/#" character varying(50, None) COLLATE pg_catalog."C" DEFAULT None; + ADD COLUMN "col_2_$%{}[]()&*^!@""'`\/#" character varying(50) COLLATE pg_catalog."C"; COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_2_$%{}[]()&*^!@""'`\/#" - IS 'Comment for create'; \ No newline at end of file + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_identity_for_restart_seq.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_identity_for_restart_seq.msql index 4a39d912a..57a8172b8 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_identity_for_restart_seq.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_identity_for_restart_seq.msql @@ -1,5 +1,5 @@ ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" - ADD COLUMN "col_6_$%{}[]()&*^!@""'`\/#" bigint(None, None) NOT NULL GENERATED BY DEFAULT AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 10 CACHE 1 ); + ADD COLUMN "col_6_$%{}[]()&*^!@""'`\/#" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 10 CACHE 1 ); COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_6_$%{}[]()&*^!@""'`\/#" IS 'demo comments'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_int.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_int.msql index 9314e01b8..a977584c1 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_int.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_int.msql @@ -1,5 +1,5 @@ ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" - ADD COLUMN "col_1_$%{}[]()&*^!@""'`\/#" bigint(None, None) NOT NULL DEFAULT 1; + ADD COLUMN "col_1_$%{}[]()&*^!@""'`\/#" bigint NOT NULL DEFAULT 1; COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_1_$%{}[]()&*^!@""'`\/#" - IS 'Comment for create'; \ No newline at end of file + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_int_identity.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_int_identity.msql index ad0bbd759..553d8748d 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_int_identity.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_int_identity.msql @@ -1,5 +1,5 @@ ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" - ADD COLUMN "col_3_$%{}[]()&*^!@""'`\/#" bigint(None, None) NOT NULL GENERATED ALWAYS AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 99999 CACHE 10 ); + ADD COLUMN "col_3_$%{}[]()&*^!@""'`\/#" bigint NOT NULL GENERATED ALWAYS AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 99999 CACHE 10 ); COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_3_$%{}[]()&*^!@""'`\/#" - IS 'Comment for create'; \ No newline at end of file + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_int_identity_by_default.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_int_identity_by_default.msql index 7bd916040..49a9a8ab5 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_int_identity_by_default.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_int_identity_by_default.msql @@ -1,5 +1,5 @@ ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" - ADD COLUMN "col_5_$%{}[]()&*^!@""'`\/#" bigint(None, None) NOT NULL GENERATED BY DEFAULT AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 99999 CACHE 10 ); + ADD COLUMN "col_5_$%{}[]()&*^!@""'`\/#" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 99999 CACHE 10 ); COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_5_$%{}[]()&*^!@""'`\/#" - IS 'Comment for create'; \ No newline at end of file + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_text_with_default_value.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_text_with_default_value.msql new file mode 100644 index 000000000..eb99d46c9 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_text_with_default_value.msql @@ -0,0 +1,5 @@ +ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" + ADD COLUMN "col__1_$%{}[]()&*^!@""'`\/#" text DEFAULT 'xyz'; + +COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col__1_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_text_with_default_value.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_text_with_default_value.sql new file mode 100644 index 000000000..4302a27a3 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_text_with_default_value.sql @@ -0,0 +1,9 @@ +-- Column: testschema."table_2_$%{}[]()&*^!@""'`\/#"."col__1_$%{}[]()&*^!@""'`\/#" + +-- ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col__1_$%{}[]()&*^!@""'`\/#"; + +ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" + ADD COLUMN "col__1_$%{}[]()&*^!@""'`\/#" text COLLATE pg_catalog."default" DEFAULT 'xyz'::text; + +COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col__1_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_timestamp_with_default_value_using_function.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_timestamp_with_default_value_using_function.msql new file mode 100644 index 000000000..72144fa6c --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_timestamp_with_default_value_using_function.msql @@ -0,0 +1,5 @@ +ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" + ADD COLUMN "col__2_$%{}[]()&*^!@""'`\/#" time(4) with time zone DEFAULT now(); + +COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col__2_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_timestamp_with_default_value_using_function.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_timestamp_with_default_value_using_function.sql new file mode 100644 index 000000000..a4d3b69c9 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_timestamp_with_default_value_using_function.sql @@ -0,0 +1,9 @@ +-- Column: testschema."table_2_$%{}[]()&*^!@""'`\/#"."col__2_$%{}[]()&*^!@""'`\/#" + +-- ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col__2_$%{}[]()&*^!@""'`\/#"; + +ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" + ADD COLUMN "col__2_$%{}[]()&*^!@""'`\/#" time(4) with time zone DEFAULT now(); + +COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col__2_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_with_interger_array_and_options.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_with_interger_array_and_options.msql new file mode 100644 index 000000000..c8e255fc5 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_with_interger_array_and_options.msql @@ -0,0 +1,9 @@ +ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" + ADD COLUMN "col__3_$%{}[]()&*^!@""'`\/#" integer[] NOT NULL; + +COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col__3_$%{}[]()&*^!@""'`\/#" + IS 'comment'; + +ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN "col__3_$%{}[]()&*^!@""'`\/#" + SET (n_distinct=1); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_with_interger_array_and_options.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_with_interger_array_and_options.sql new file mode 100644 index 000000000..47e47421d --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/create_column_with_interger_array_and_options.sql @@ -0,0 +1,13 @@ +-- Column: testschema."table_2_$%{}[]()&*^!@""'`\/#"."col__3_$%{}[]()&*^!@""'`\/#" + +-- ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col__3_$%{}[]()&*^!@""'`\/#"; + +ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" + ADD COLUMN "col__3_$%{}[]()&*^!@""'`\/#" integer[] NOT NULL; + +COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col__3_$%{}[]()&*^!@""'`\/#" + IS 'comment'; + +ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN "col__3_$%{}[]()&*^!@""'`\/#" + SET (n_distinct=1); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/test.json index 854d375ce..37db613cb 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/test.json +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/10_plus/test.json @@ -26,8 +26,8 @@ "attacl": [], "is_primary_key": false, "attnotnull": true, - "attlen": null, - "attprecision": null, + "attlen": "", + "attprecision": "", "attoptions": [], "seclabels": [], "defval": "1" @@ -138,10 +138,9 @@ "is_primary_key": false, "attnotnull": false, "attlen": "50", - "attprecision": null, + "attprecision": "", "attoptions": [], - "seclabels": [], - "defval": null + "seclabels": [] }, "expected_sql_file": "create_column_char.sql", "expected_msql_file": "create_column_char.msql" @@ -211,8 +210,8 @@ "attacl": [], "is_primary_key": false, "attnotnull": true, - "attlen": null, - "attprecision": null, + "attlen": "", + "attprecision": "", "attoptions": [], "seclabels": [], "attidentity": "a", @@ -398,8 +397,8 @@ "attacl": [], "is_primary_key": false, "attnotnull": true, - "attlen": null, - "attprecision": null, + "attlen": "", + "attprecision": "", "attoptions": [], "seclabels": [], "attidentity": "d", @@ -468,8 +467,8 @@ "description": "demo comments", "is_primary_key": false, "attnotnull": true, - "attlen": null, - "attprecision": null, + "attlen": "", + "attprecision": "", "attidentity": "d", "seqincrement": "1", "seqstart": "1", @@ -526,6 +525,174 @@ "data": { "name": "col_6_$%{}[]()&*^!@\"'`\\/#" } + }, + { + "type": "create", + "name": "Create Column with text & default value", + "endpoint": "NODE-column.obj", + "sql_endpoint": "NODE-column.sql_id", + "msql_endpoint": "NODE-column.msql", + "data": { + "name": "col__1_$%{}[]()&*^!@\"'`\\/#", + "cltype": "text", + "attacl": [], + "description": "test comment", + "is_primary_key": false, + "attnotnull": false, + "attlen": "", + "attprecision": "", + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [], + "defval": "'xyz'" + }, + "expected_sql_file": "create_column_text_with_default_value.sql", + "expected_msql_file": "create_column_text_with_default_value.msql" + }, + { + "type": "alter", + "name": "Alter Column with text & update default value", + "endpoint": "NODE-column.obj_id", + "sql_endpoint": "NODE-column.sql_id", + "msql_endpoint": "NODE-column.msql_id", + "data": { + "name": "col__1_$%{}[]()&*^!@\"'`\\/#", + "defval": "'changed default value'", + "attacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + } + ] + } + ] + } + }, + "expected_sql_file": "alter_column_text_with_default_value.sql", + "expected_msql_file": "alter_column_text_with_default_value.msql" + }, + { + "type": "delete", + "name": "Drop Column with identity (ALWAYS)", + "endpoint": "NODE-column.obj_id", + "sql_endpoint": "NODE-column.sql_id", + "data": { + "name": "col__1_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Column with time with time zone & default value using function", + "endpoint": "NODE-column.obj", + "sql_endpoint": "NODE-column.sql_id", + "msql_endpoint": "NODE-column.msql", + "data": { + "name": "col__2_$%{}[]()&*^!@\"'`\\/#", + "cltype": "time with time zone", + "attacl": [], + "description": "test comment", + "min_val_attlen": 0, + "max_val_attlen": 6, + "is_primary_key": false, + "attnotnull": false, + "attlen": "4", + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [], + "defval": "now()" + }, + "expected_sql_file": "create_column_timestamp_with_default_value_using_function.sql", + "expected_msql_file": "create_column_timestamp_with_default_value_using_function.msql" + }, + { + "type": "alter", + "name": "Alter Column with time with time zone & update length", + "endpoint": "NODE-column.obj_id", + "sql_endpoint": "NODE-column.sql_id", + "msql_endpoint": "NODE-column.msql_id", + "data": { + "name": "col__2_$%{}[]()&*^!@\"'`\\/#", + "attlen": "6", + "attnotnull": true, + "description": "test comment modification" + }, + "expected_sql_file": "alter_column_timestamp_with_default_value_using_function.sql", + "expected_msql_file": "alter_column_timestamp_with_default_value_using_function.msql" + }, + { + "type": "delete", + "name": "Drop Column with identity (ALWAYS)", + "endpoint": "NODE-column.obj_id", + "sql_endpoint": "NODE-column.sql_id", + "data": { + "name": "col__2_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Column with interger_array and options", + "endpoint": "NODE-column.obj", + "sql_endpoint": "NODE-column.sql_id", + "msql_endpoint": "NODE-column.msql", + "data": { + "name": "col__3_$%{}[]()&*^!@\"'`\\/#", + "cltype": "integer[]", + "attacl": [], + "description": "comment", + "is_primary_key": false, + "attnotnull": true, + "attlen": "", + "attprecision": "", + "attidentity": "a", + "colconstype": "n", + "attoptions": [ + { + "name": "n_distinct", + "value": "1" + } + ], + "seclabels": [] + }, + "expected_sql_file": "create_column_with_interger_array_and_options.sql", + "expected_msql_file": "create_column_with_interger_array_and_options.msql" + }, + { + "type": "alter", + "name": "Alter Column with interger_array and options", + "endpoint": "NODE-column.obj_id", + "sql_endpoint": "NODE-column.sql_id", + "msql_endpoint": "NODE-column.msql_id", + "data": { + "name": "col__3_$%{}[]()&*^!@\"'`\\/#", + "attoptions": { + "changed": [ + { + "name": "n_distinct", + "value": "2" + } + ] + } + }, + "expected_sql_file": "alter_column_with_interger_array_and_options.sql", + "expected_msql_file": "alter_column_with_interger_array_and_options.msql" + }, + { + "type": "delete", + "name": "Drop Column with identity (ALWAYS)", + "endpoint": "NODE-column.obj_id", + "sql_endpoint": "NODE-column.sql_id", + "data": { + "name": "col__3_$%{}[]()&*^!@\"'`\\/#" + } } ] } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_char.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_char.msql index 1ac157462..187fb2913 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_char.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_char.msql @@ -2,7 +2,7 @@ ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" RENAME "col_2_$%{}[]()&*^!@""'`\/#" TO "new_col_2_$%{}[]()&*^!@""'`\/#"; ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" - ALTER COLUMN "new_col_2_$%{}[]()&*^!@""'`\/#" TYPE character(None) COLLATE pg_catalog."C"; + ALTER COLUMN "new_col_2_$%{}[]()&*^!@""'`\/#" TYPE character COLLATE pg_catalog."C"; ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" ALTER COLUMN "new_col_2_$%{}[]()&*^!@""'`\/#" SET STATISTICS 5; @@ -12,4 +12,4 @@ ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."new_col_2_$%{}[]()&*^!@""'`\/#" IS 'Comment for alter'; -GRANT INSERT("new_col_2_$%{}[]()&*^!@""'`\/#"), SELECT("new_col_2_$%{}[]()&*^!@""'`\/#"), REFERENCES("new_col_2_$%{}[]()&*^!@""'`\/#") ON testschema."table_3_$%{}[]()&*^!@""'`\/#" TO PUBLIC; \ No newline at end of file +GRANT INSERT("new_col_2_$%{}[]()&*^!@""'`\/#"), SELECT("new_col_2_$%{}[]()&*^!@""'`\/#"), REFERENCES("new_col_2_$%{}[]()&*^!@""'`\/#") ON testschema."table_3_$%{}[]()&*^!@""'`\/#" TO PUBLIC; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_text_with_default_value.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_text_with_default_value.msql new file mode 100644 index 000000000..7f89254f8 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_text_with_default_value.msql @@ -0,0 +1,4 @@ +ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN "col__1_$%{}[]()&*^!@""'`\/#" SET DEFAULT 'changed default value'; + +GRANT SELECT("col__1_$%{}[]()&*^!@""'`\/#") ON testschema."table_3_$%{}[]()&*^!@""'`\/#" TO PUBLIC; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_text_with_default_value.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_text_with_default_value.sql new file mode 100644 index 000000000..885911c2f --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_text_with_default_value.sql @@ -0,0 +1,11 @@ +-- Column: testschema."table_3_$%{}[]()&*^!@""'`\/#"."col__1_$%{}[]()&*^!@""'`\/#" + +-- ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col__1_$%{}[]()&*^!@""'`\/#"; + +ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" + ADD COLUMN "col__1_$%{}[]()&*^!@""'`\/#" text COLLATE pg_catalog."default" DEFAULT 'changed default value'::text; + +COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col__1_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; + +GRANT SELECT("col__1_$%{}[]()&*^!@""'`\/#") ON testschema."table_3_$%{}[]()&*^!@""'`\/#" TO PUBLIC; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_timestamp_with_default_value_using_function.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_timestamp_with_default_value_using_function.msql new file mode 100644 index 000000000..90050bf6c --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_timestamp_with_default_value_using_function.msql @@ -0,0 +1,7 @@ +ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN "col__2_$%{}[]()&*^!@""'`\/#" TYPE time(6) with time zone ; +ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN "col__2_$%{}[]()&*^!@""'`\/#" SET NOT NULL; + +COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col__2_$%{}[]()&*^!@""'`\/#" + IS 'test comment modification'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_timestamp_with_default_value_using_function.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_timestamp_with_default_value_using_function.sql new file mode 100644 index 000000000..c384201aa --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_timestamp_with_default_value_using_function.sql @@ -0,0 +1,9 @@ +-- Column: testschema."table_3_$%{}[]()&*^!@""'`\/#"."col__2_$%{}[]()&*^!@""'`\/#" + +-- ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col__2_$%{}[]()&*^!@""'`\/#"; + +ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" + ADD COLUMN "col__2_$%{}[]()&*^!@""'`\/#" time(6) with time zone NOT NULL DEFAULT now(); + +COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col__2_$%{}[]()&*^!@""'`\/#" + IS 'test comment modification'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_with_interger_array_and_options.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_with_interger_array_and_options.msql new file mode 100644 index 000000000..88af94a7a --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_with_interger_array_and_options.msql @@ -0,0 +1,3 @@ +ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN "col__3_$%{}[]()&*^!@""'`\/#" + SET (n_distinct=2); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_with_interger_array_and_options.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_with_interger_array_and_options.sql new file mode 100644 index 000000000..6bc4af1ed --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/alter_column_with_interger_array_and_options.sql @@ -0,0 +1,13 @@ +-- Column: testschema."table_3_$%{}[]()&*^!@""'`\/#"."col__3_$%{}[]()&*^!@""'`\/#" + +-- ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col__3_$%{}[]()&*^!@""'`\/#"; + +ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" + ADD COLUMN "col__3_$%{}[]()&*^!@""'`\/#" integer[] NOT NULL; + +COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col__3_$%{}[]()&*^!@""'`\/#" + IS 'comment'; + +ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN "col__3_$%{}[]()&*^!@""'`\/#" + SET (n_distinct=2); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_char.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_char.msql index 11ad3f86b..232f1948d 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_char.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_char.msql @@ -1,5 +1,5 @@ ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" - ADD COLUMN "col_2_$%{}[]()&*^!@""'`\/#" character varying(50, None) COLLATE pg_catalog."C" DEFAULT None; + ADD COLUMN "col_2_$%{}[]()&*^!@""'`\/#" character varying(50) COLLATE pg_catalog."C"; COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_2_$%{}[]()&*^!@""'`\/#" - IS 'Comment for create'; \ No newline at end of file + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_int.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_int.msql index 925ea8c8f..04dca5541 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_int.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_int.msql @@ -1,5 +1,5 @@ ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" - ADD COLUMN "col_1_$%{}[]()&*^!@""'`\/#" bigint(None, None) NOT NULL DEFAULT 1; + ADD COLUMN "col_1_$%{}[]()&*^!@""'`\/#" bigint NOT NULL DEFAULT 1; COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_1_$%{}[]()&*^!@""'`\/#" - IS 'Comment for create'; \ No newline at end of file + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_int_generated.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_int_generated.msql index 22cee135b..b4816e0f4 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_int_generated.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_int_generated.msql @@ -1,5 +1,5 @@ ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" - ADD COLUMN "col_4_$%{}[]()&*^!@""'`\/#" bigint(None, None) GENERATED ALWAYS AS (1 + 2 + 3) STORED; + ADD COLUMN "col_4_$%{}[]()&*^!@""'`\/#" bigint GENERATED ALWAYS AS (1 + 2 + 3) STORED; COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_4_$%{}[]()&*^!@""'`\/#" - IS 'Comment for create'; \ No newline at end of file + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_int_generated_with_existing_columns.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_int_generated_with_existing_columns.msql index 95ab88727..7e79b10f1 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_int_generated_with_existing_columns.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_int_generated_with_existing_columns.msql @@ -1,5 +1,5 @@ ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" - ADD COLUMN "col_8_$%{}[]()&*^!@""'`\/#" bigint(None, None) GENERATED ALWAYS AS (dummy1 + dummy2) STORED; + ADD COLUMN "col_8_$%{}[]()&*^!@""'`\/#" bigint GENERATED ALWAYS AS (dummy1 + dummy2) STORED; COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_8_$%{}[]()&*^!@""'`\/#" - IS 'Comment for create'; \ No newline at end of file + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_int_identity.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_int_identity.msql index 34581f0a5..b9f3f5536 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_int_identity.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_int_identity.msql @@ -1,5 +1,5 @@ ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" - ADD COLUMN "col_3_$%{}[]()&*^!@""'`\/#" bigint(None, None) NOT NULL GENERATED ALWAYS AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 99999 CACHE 10 ); + ADD COLUMN "col_3_$%{}[]()&*^!@""'`\/#" bigint NOT NULL GENERATED ALWAYS AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 99999 CACHE 10 ); COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_3_$%{}[]()&*^!@""'`\/#" - IS 'Comment for create'; \ No newline at end of file + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_int_identity_by_default.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_int_identity_by_default.msql index dcc5e7879..f4803dc0b 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_int_identity_by_default.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_int_identity_by_default.msql @@ -1,5 +1,5 @@ ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" - ADD COLUMN "col_9_$%{}[]()&*^!@""'`\/#" bigint(None, None) NOT NULL GENERATED BY DEFAULT AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 99999 CACHE 10 ); + ADD COLUMN "col_9_$%{}[]()&*^!@""'`\/#" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 99999 CACHE 10 ); COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_9_$%{}[]()&*^!@""'`\/#" - IS 'Comment for create'; \ No newline at end of file + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_text_with_default_value.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_text_with_default_value.msql new file mode 100644 index 000000000..f18eecbbc --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_text_with_default_value.msql @@ -0,0 +1,5 @@ +ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" + ADD COLUMN "col__1_$%{}[]()&*^!@""'`\/#" text DEFAULT 'xyz'; + +COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col__1_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_text_with_default_value.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_text_with_default_value.sql new file mode 100644 index 000000000..076e8ebe3 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_text_with_default_value.sql @@ -0,0 +1,9 @@ +-- Column: testschema."table_3_$%{}[]()&*^!@""'`\/#"."col__1_$%{}[]()&*^!@""'`\/#" + +-- ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col__1_$%{}[]()&*^!@""'`\/#"; + +ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" + ADD COLUMN "col__1_$%{}[]()&*^!@""'`\/#" text COLLATE pg_catalog."default" DEFAULT 'xyz'::text; + +COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col__1_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_timestamp_with_default_value_using_function.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_timestamp_with_default_value_using_function.msql new file mode 100644 index 000000000..51a3fd17f --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_timestamp_with_default_value_using_function.msql @@ -0,0 +1,5 @@ +ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" + ADD COLUMN "col__2_$%{}[]()&*^!@""'`\/#" time(4) with time zone DEFAULT now(); + +COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col__2_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_timestamp_with_default_value_using_function.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_timestamp_with_default_value_using_function.sql new file mode 100644 index 000000000..ee1a66309 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_timestamp_with_default_value_using_function.sql @@ -0,0 +1,9 @@ +-- Column: testschema."table_3_$%{}[]()&*^!@""'`\/#"."col__2_$%{}[]()&*^!@""'`\/#" + +-- ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col__2_$%{}[]()&*^!@""'`\/#"; + +ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" + ADD COLUMN "col__2_$%{}[]()&*^!@""'`\/#" time(4) with time zone DEFAULT now(); + +COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col__2_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_with_interger_array_and_options.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_with_interger_array_and_options.msql new file mode 100644 index 000000000..cf022ee6f --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_with_interger_array_and_options.msql @@ -0,0 +1,9 @@ +ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" + ADD COLUMN "col__3_$%{}[]()&*^!@""'`\/#" integer[] NOT NULL; + +COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col__3_$%{}[]()&*^!@""'`\/#" + IS 'comment'; + +ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN "col__3_$%{}[]()&*^!@""'`\/#" + SET (n_distinct=1); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_with_interger_array_and_options.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_with_interger_array_and_options.sql new file mode 100644 index 000000000..e7dd96e61 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/create_column_with_interger_array_and_options.sql @@ -0,0 +1,13 @@ +-- Column: testschema."table_3_$%{}[]()&*^!@""'`\/#"."col__3_$%{}[]()&*^!@""'`\/#" + +-- ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col__3_$%{}[]()&*^!@""'`\/#"; + +ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" + ADD COLUMN "col__3_$%{}[]()&*^!@""'`\/#" integer[] NOT NULL; + +COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col__3_$%{}[]()&*^!@""'`\/#" + IS 'comment'; + +ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN "col__3_$%{}[]()&*^!@""'`\/#" + SET (n_distinct=1); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/test.json index 29158ff32..1a63a6f0c 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/test.json +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/12_plus/test.json @@ -22,15 +22,15 @@ "data": { "name": "col_1_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for create", - "cltype":"bigint", - "attacl":[], - "is_primary_key":false, - "attnotnull":true, - "attlen":null, - "attprecision":null, - "attoptions":[], - "seclabels":[], - "defval":"1" + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": true, + "attlen": "", + "attprecision": "", + "attoptions": [], + "seclabels": [], + "defval": "1" }, "expected_sql_file": "create_column_int.sql", "expected_msql_file": "create_column_int.msql" @@ -45,8 +45,37 @@ "attnum": 1, "name": "new_col_1_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for alter", - "cltype":"real", - "attacl":{"added":[{"grantee":"PUBLIC","grantor":"postgres","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false}]}]} + "cltype": "real", + "attacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "a", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "w", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "x", + "privilege": true, + "with_grant": false + } + ] + } + ] + } }, "expected_sql_file": "alter_column_int.sql", "expected_msql_file": "alter_column_int.msql" @@ -60,7 +89,26 @@ "data": { "attnum": 1, "name": "new_col_1_$%{}[]()&*^!@\"'`\\/#", - "attacl":{"changed":[{"grantee":"postgres", "grantor":"postgres","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false}]}]} + "attacl": { + "changed": [ + { + "grantee": "postgres", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "a", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + } + ] + } + ] + } }, "expected_sql_file": "alter_column_alt_privilege.sql", "expected_msql_file": "alter_column_alt_privilege.msql" @@ -83,16 +131,15 @@ "data": { "name": "col_2_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for create", - "cltype":"character varying", + "cltype": "character varying", "collspcname": "pg_catalog.\"C\"", - "attacl":[], - "is_primary_key":false, - "attnotnull":false, - "attlen":"50", - "attprecision":null, - "attoptions":[], - "seclabels":[], - "defval":null + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": "50", + "attprecision": "", + "attoptions": [], + "seclabels": [] }, "expected_sql_file": "create_column_char.sql", "expected_msql_file": "create_column_char.msql" @@ -106,12 +153,36 @@ "data": { "attnum": 2, "name": "new_col_2_$%{}[]()&*^!@\"'`\\/#", - "attlen": null, + "attlen": "", "attstattarget": "5", "attstorage": "p", "description": "Comment for alter", - "cltype":"character", - "attacl":{"added":[{"grantee":"PUBLIC","grantor":"postgres","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false}]}]} + "cltype": "character", + "attacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "a", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "x", + "privilege": true, + "with_grant": false + } + ] + } + ] + } }, "expected_sql_file": "alter_column_char.sql", "expected_msql_file": "alter_column_char.msql" @@ -134,22 +205,22 @@ "data": { "name": "col_3_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for create", - "cltype":"bigint", - "attacl":[], - "is_primary_key":false, - "attnotnull":true, - "attlen":null, - "attprecision":null, - "attoptions":[], - "seclabels":[], - "attidentity":"a", - "seqincrement":"1", - "seqstart":"1", - "seqmin":"1", - "seqmax":"99999", - "seqcache":"10", - "seqcycle":true, - "colconstype":"i" + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": true, + "attlen": "", + "attprecision": "", + "attoptions": [], + "seclabels": [], + "attidentity": "a", + "seqincrement": "1", + "seqstart": "1", + "seqmin": "1", + "seqmax": "99999", + "seqcache": "10", + "seqcycle": true, + "colconstype": "i" }, "expected_sql_file": "create_column_int_identity.sql", "expected_msql_file": "create_column_int_identity.msql" @@ -164,7 +235,31 @@ "attnum": 3, "name": "new_col_3_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for alter", - "attacl":{"added":[{"grantee":"PUBLIC","grantor":"postgres","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false}]}]} + "attacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "a", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "x", + "privilege": true, + "with_grant": false + } + ] + } + ] + } }, "expected_sql_file": "alter_column_identity.sql", "expected_msql_file": "alter_column_identity.msql" @@ -200,17 +295,17 @@ "data": { "name": "col_4_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for create", - "cltype":"bigint", - "attacl":[], - "is_primary_key":false, - "attnotnull":false, - "attlen":null, - "attprecision":null, - "attidentity":"a", - "colconstype":"g", - "genexpr":"1 + 2 + 3", - "attoptions":[], - "seclabels":[] + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": "", + "attprecision": "", + "attidentity": "a", + "colconstype": "g", + "genexpr": "1 + 2 + 3", + "attoptions": [], + "seclabels": [] }, "expected_sql_file": "create_column_int_generated.sql", "expected_msql_file": "create_column_int_generated.msql" @@ -225,7 +320,31 @@ "attnum": 4, "name": "new_col_4_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for alter", - "attacl":{"added":[{"grantee":"PUBLIC","grantor":"postgres","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false}]}]} + "attacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "a", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "x", + "privilege": true, + "with_grant": false + } + ] + } + ] + } }, "expected_sql_file": "alter_column_generated.sql", "expected_msql_file": "alter_column_generated.msql" @@ -248,17 +367,22 @@ "data": { "name": "col_5_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for create", - "min_val":0, - "max_val":1000, - "cltype":"numeric", - "attacl":[], - "is_primary_key":false, - "attnotnull":true, - "attlen":"10", - "attprecision":"5", - "attidentity":"a", - "attoptions":[{"name":"n_distinct","value":"1"}], - "seclabels":[] + "min_val": 0, + "max_val": 1000, + "cltype": "numeric", + "attacl": [], + "is_primary_key": false, + "attnotnull": true, + "attlen": "10", + "attprecision": "5", + "attidentity": "a", + "attoptions": [ + { + "name": "n_distinct", + "value": "1" + } + ], + "seclabels": [] }, "expected_sql_file": "create_column_numeric.sql", "expected_msql_file": "create_column_numeric.msql" @@ -272,10 +396,39 @@ "data": { "name": "new_col_5_$%{}[]()&*^!@\"'`\\/#", "attnum": 5, - "attlen":"15", - "attprecision":"6", + "attlen": "15", + "attprecision": "6", "description": "Comment for alter", - "attacl":{"added":[{"grantee":"PUBLIC","grantor":"postgres","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false}]}]} + "attacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "a", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "w", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "x", + "privilege": true, + "with_grant": false + } + ] + } + ] + } }, "expected_sql_file": "alter_column_numeric.sql", "expected_msql_file": "alter_column_numeric.msql" @@ -288,7 +441,7 @@ "msql_endpoint": "NODE-column.msql_id", "data": { "attnum": 3, - "attlen":"" + "attlen": "" }, "expected_sql_file": "alter_column_remove_length.sql", "expected_msql_file": "alter_column_remove_length.msql" @@ -302,7 +455,6 @@ "name": "new_col_5_$%{}[]()&*^!@\"'`\\/#" } }, - { "type": "create", "name": "Create Dummy Column (Integer/Numeric type)", @@ -312,15 +464,15 @@ "data": { "name": "dummy1", "description": "Comment for create", - "cltype":"bigint", - "attacl":[], - "is_primary_key":false, - "attnotnull":true, - "attlen":null, - "attprecision":null, - "attoptions":[], - "seclabels":[], - "defval":"1" + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": true, + "attlen": "", + "attprecision": "", + "attoptions": [], + "seclabels": [], + "defval": "1" } }, { @@ -332,15 +484,15 @@ "data": { "name": "dummy2", "description": "Comment for create", - "cltype":"bigint", - "attacl":[], - "is_primary_key":false, - "attnotnull":true, - "attlen":null, - "attprecision":null, - "attoptions":[], - "seclabels":[], - "defval":"1" + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": true, + "attlen": "", + "attprecision": "", + "attoptions": [], + "seclabels": [], + "defval": "1" } }, { @@ -352,17 +504,17 @@ "data": { "name": "col_8_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for create", - "cltype":"bigint", - "attacl":[], - "is_primary_key":false, - "attnotnull":false, - "attlen":null, - "attprecision":null, - "attidentity":"a", - "colconstype":"g", - "genexpr":"dummy1 + dummy2", - "attoptions":[], - "seclabels":[] + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": "", + "attprecision": "", + "attidentity": "a", + "colconstype": "g", + "genexpr": "dummy1 + dummy2", + "attoptions": [], + "seclabels": [] }, "expected_sql_file": "create_column_int_generated_with_existing_columns.sql", "expected_msql_file": "create_column_int_generated_with_existing_columns.msql" @@ -376,9 +528,33 @@ "data": { "attnum": 8, "name": "new_col_8_$%{}[]()&*^!@\"'`\\/#", - "genexpr":"dummy1 - dummy2", + "genexpr": "dummy1 - dummy2", "description": "Comment for alter", - "attacl":{"added":[{"grantee":"PUBLIC","grantor":"postgres","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false}]}]} + "attacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "a", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "x", + "privilege": true, + "with_grant": false + } + ] + } + ] + } }, "expected_sql_file": "alter_column_generated_with_existing_columns.sql", "expected_msql_file": "alter_column_generated_with_existing_columns.msql" @@ -392,7 +568,6 @@ "name": "new_col_8_$%{}[]()&*^!@\"'`\\/#" } }, - { "type": "create", "name": "Create Column with identity (Generated by default)", @@ -402,22 +577,22 @@ "data": { "name": "col_9_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for create", - "cltype":"bigint", - "attacl":[], - "is_primary_key":false, - "attnotnull":true, - "attlen":null, - "attprecision":null, - "attoptions":[], - "seclabels":[], - "attidentity":"d", - "seqincrement":"1", - "seqstart":"1", - "seqmin":"1", - "seqmax":"99999", - "seqcache":"10", - "seqcycle":true, - "colconstype":"i" + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": true, + "attlen": "", + "attprecision": "", + "attoptions": [], + "seclabels": [], + "attidentity": "d", + "seqincrement": "1", + "seqstart": "1", + "seqmin": "1", + "seqmax": "99999", + "seqcache": "10", + "seqcycle": true, + "colconstype": "i" }, "expected_sql_file": "create_column_int_identity_by_default.sql", "expected_msql_file": "create_column_int_identity_by_default.msql" @@ -432,11 +607,11 @@ "attnum": 9, "name": "new_col_9_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for alter", - "seqincrement":"2", - "seqmax":"200", - "seqcache":"2", - "seqcycle":true, - "seqmin":"1" + "seqincrement": "2", + "seqmax": "200", + "seqcache": "2", + "seqcycle": true, + "seqmin": "1" }, "expected_sql_file": "alter_column_identity_by_default.sql", "expected_msql_file": "alter_column_identity_by_default.msql" @@ -534,6 +709,174 @@ "data": { "name": "col_6_$%{}[]()&*^!@\"'`\\/#" } + }, + { + "type": "create", + "name": "Create Column with text & default value", + "endpoint": "NODE-column.obj", + "sql_endpoint": "NODE-column.sql_id", + "msql_endpoint": "NODE-column.msql", + "data": { + "name": "col__1_$%{}[]()&*^!@\"'`\\/#", + "cltype": "text", + "attacl": [], + "description": "test comment", + "is_primary_key": false, + "attnotnull": false, + "attlen": "", + "attprecision": "", + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [], + "defval": "'xyz'" + }, + "expected_sql_file": "create_column_text_with_default_value.sql", + "expected_msql_file": "create_column_text_with_default_value.msql" + }, + { + "type": "alter", + "name": "Alter Column with text & update default value", + "endpoint": "NODE-column.obj_id", + "sql_endpoint": "NODE-column.sql_id", + "msql_endpoint": "NODE-column.msql_id", + "data": { + "name": "col__1_$%{}[]()&*^!@\"'`\\/#", + "defval": "'changed default value'", + "attacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + } + ] + } + ] + } + }, + "expected_sql_file": "alter_column_text_with_default_value.sql", + "expected_msql_file": "alter_column_text_with_default_value.msql" + }, + { + "type": "delete", + "name": "Drop Column with identity (ALWAYS)", + "endpoint": "NODE-column.obj_id", + "sql_endpoint": "NODE-column.sql_id", + "data": { + "name": "col__1_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Column with time with time zone & default value using function", + "endpoint": "NODE-column.obj", + "sql_endpoint": "NODE-column.sql_id", + "msql_endpoint": "NODE-column.msql", + "data": { + "name": "col__2_$%{}[]()&*^!@\"'`\\/#", + "cltype": "time with time zone", + "attacl": [], + "description": "test comment", + "min_val_attlen": 0, + "max_val_attlen": 6, + "is_primary_key": false, + "attnotnull": false, + "attlen": "4", + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [], + "defval": "now()" + }, + "expected_sql_file": "create_column_timestamp_with_default_value_using_function.sql", + "expected_msql_file": "create_column_timestamp_with_default_value_using_function.msql" + }, + { + "type": "alter", + "name": "Alter Column with time with time zone & update length", + "endpoint": "NODE-column.obj_id", + "sql_endpoint": "NODE-column.sql_id", + "msql_endpoint": "NODE-column.msql_id", + "data": { + "name": "col__2_$%{}[]()&*^!@\"'`\\/#", + "attlen": "6", + "attnotnull": true, + "description": "test comment modification" + }, + "expected_sql_file": "alter_column_timestamp_with_default_value_using_function.sql", + "expected_msql_file": "alter_column_timestamp_with_default_value_using_function.msql" + }, + { + "type": "delete", + "name": "Drop Column with identity (ALWAYS)", + "endpoint": "NODE-column.obj_id", + "sql_endpoint": "NODE-column.sql_id", + "data": { + "name": "col__2_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Column with interger_array and options", + "endpoint": "NODE-column.obj", + "sql_endpoint": "NODE-column.sql_id", + "msql_endpoint": "NODE-column.msql", + "data": { + "name": "col__3_$%{}[]()&*^!@\"'`\\/#", + "cltype": "integer[]", + "attacl": [], + "description": "comment", + "is_primary_key": false, + "attnotnull": true, + "attlen": "", + "attprecision": "", + "attidentity": "a", + "colconstype": "n", + "attoptions": [ + { + "name": "n_distinct", + "value": "1" + } + ], + "seclabels": [] + }, + "expected_sql_file": "create_column_with_interger_array_and_options.sql", + "expected_msql_file": "create_column_with_interger_array_and_options.msql" + }, + { + "type": "alter", + "name": "Alter Column with interger_array and options", + "endpoint": "NODE-column.obj_id", + "sql_endpoint": "NODE-column.sql_id", + "msql_endpoint": "NODE-column.msql_id", + "data": { + "name": "col__3_$%{}[]()&*^!@\"'`\\/#", + "attoptions": { + "changed": [ + { + "name": "n_distinct", + "value": "2" + } + ] + } + }, + "expected_sql_file": "alter_column_with_interger_array_and_options.sql", + "expected_msql_file": "alter_column_with_interger_array_and_options.msql" + }, + { + "type": "delete", + "name": "Drop Column with identity (ALWAYS)", + "endpoint": "NODE-column.obj_id", + "sql_endpoint": "NODE-column.sql_id", + "data": { + "name": "col__3_$%{}[]()&*^!@\"'`\\/#" + } } ] } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/default/create_column_char.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/default/create_column_char.msql index f43e84a8e..4c3981b44 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/default/create_column_char.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/default/create_column_char.msql @@ -1,5 +1,5 @@ ALTER TABLE testschema."table_1_$%{}[]()&*^!@""'`\/#" - ADD COLUMN "col_2_$%{}[]()&*^!@""'`\/#" character varying(50, None) COLLATE pg_catalog."C" DEFAULT None; + ADD COLUMN "col_2_$%{}[]()&*^!@""'`\/#" character varying(50) COLLATE pg_catalog."C"; COMMENT ON COLUMN testschema."table_1_$%{}[]()&*^!@""'`\/#"."col_2_$%{}[]()&*^!@""'`\/#" - IS 'Comment for create'; \ No newline at end of file + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/default/create_column_int.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/default/create_column_int.msql index bde4012ff..c314b0bcf 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/default/create_column_int.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/default/create_column_int.msql @@ -1,5 +1,5 @@ ALTER TABLE testschema."table_1_$%{}[]()&*^!@""'`\/#" - ADD COLUMN "col_1_$%{}[]()&*^!@""'`\/#" bigint(None, None) NOT NULL DEFAULT 1; + ADD COLUMN "col_1_$%{}[]()&*^!@""'`\/#" bigint NOT NULL DEFAULT 1; COMMENT ON COLUMN testschema."table_1_$%{}[]()&*^!@""'`\/#"."col_1_$%{}[]()&*^!@""'`\/#" - IS 'Comment for create'; \ No newline at end of file + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/default/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/default/test.json index dad747fe1..46e36c0aa 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/default/test.json +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/pg/default/test.json @@ -22,15 +22,15 @@ "data": { "name": "col_1_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for create", - "cltype":"bigint", - "attacl":[], - "is_primary_key":false, - "attnotnull":true, - "attlen":null, - "attprecision":null, - "attoptions":[], - "seclabels":[], - "defval":"1" + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": true, + "attlen": "", + "attprecision": "", + "attoptions": [], + "seclabels": [], + "defval": "1" }, "expected_sql_file": "create_column_int.sql", "expected_msql_file": "create_column_int.msql" @@ -45,8 +45,37 @@ "attnum": 1, "name": "new_col_1_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for alter", - "cltype":"real", - "attacl":{"added":[{"grantee":"PUBLIC","grantor":"postgres","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false}]}]} + "cltype": "real", + "attacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "a", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "w", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "x", + "privilege": true, + "with_grant": false + } + ] + } + ] + } }, "expected_sql_file": "alter_column_int.sql", "expected_msql_file": "alter_column_int.msql" @@ -60,7 +89,26 @@ "data": { "attnum": 1, "name": "new_col_1_$%{}[]()&*^!@\"'`\\/#", - "attacl":{"changed":[{"grantee":"postgres", "grantor":"postgres","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false}]}]} + "attacl": { + "changed": [ + { + "grantee": "postgres", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "a", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + } + ] + } + ] + } }, "expected_sql_file": "alter_column_alt_privilege.sql", "expected_msql_file": "alter_column_alt_privilege.msql" @@ -83,16 +131,15 @@ "data": { "name": "col_2_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for create", - "cltype":"character varying", + "cltype": "character varying", "collspcname": "pg_catalog.\"C\"", - "attacl":[], - "is_primary_key":false, - "attnotnull":false, - "attlen":"50", - "attprecision":null, - "attoptions":[], - "seclabels":[], - "defval":null + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": "50", + "attprecision": "", + "attoptions": [], + "seclabels": [] }, "expected_sql_file": "create_column_char.sql", "expected_msql_file": "create_column_char.msql" @@ -110,8 +157,32 @@ "attstattarget": "5", "attstorage": "p", "description": "Comment for alter", - "cltype":"character", - "attacl":{"added":[{"grantee":"PUBLIC","grantor":"postgres","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false}]}]} + "cltype": "character", + "attacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "a", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "x", + "privilege": true, + "with_grant": false + } + ] + } + ] + } }, "expected_sql_file": "alter_column_char.sql", "expected_msql_file": "alter_column_char.msql" @@ -125,7 +196,6 @@ "name": "new_col_2_$%{}[]()&*^!@\"'`\\/#" } }, - { "type": "create", "name": "Create Column (Numeric type with Length Precision & Variables)", @@ -135,17 +205,22 @@ "data": { "name": "col_3_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for create", - "min_val":0, - "max_val":1000, - "cltype":"numeric", - "attacl":[], - "is_primary_key":false, - "attnotnull":true, - "attlen":"10", - "attprecision":"5", - "attidentity":"a", - "attoptions":[{"name":"n_distinct","value":"1"}], - "seclabels":[] + "min_val": 0, + "max_val": 1000, + "cltype": "numeric", + "attacl": [], + "is_primary_key": false, + "attnotnull": true, + "attlen": "10", + "attprecision": "5", + "attidentity": "a", + "attoptions": [ + { + "name": "n_distinct", + "value": "1" + } + ], + "seclabels": [] }, "expected_sql_file": "create_column_numeric.sql", "expected_msql_file": "create_column_numeric.msql" @@ -159,10 +234,39 @@ "data": { "name": "new_col_3_$%{}[]()&*^!@\"'`\\/#", "attnum": 3, - "attlen":"15", - "attprecision":"6", + "attlen": "15", + "attprecision": "6", "description": "Comment for alter", - "attacl":{"added":[{"grantee":"PUBLIC","grantor":"postgres","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false}]}]} + "attacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "a", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "w", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "x", + "privilege": true, + "with_grant": false + } + ] + } + ] + } }, "expected_sql_file": "alter_column_numeric.sql", "expected_msql_file": "alter_column_numeric.msql" @@ -175,7 +279,7 @@ "msql_endpoint": "NODE-column.msql_id", "data": { "attnum": 3, - "attlen":"" + "attlen": "" }, "expected_sql_file": "alter_column_remove_length.sql", "expected_msql_file": "alter_column_remove_length.msql" diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/alter_column_text_with_default_value.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/alter_column_text_with_default_value.msql new file mode 100644 index 000000000..d77388f63 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/alter_column_text_with_default_value.msql @@ -0,0 +1,13 @@ +ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" + RENAME "col__1_$%{}[]()&*^!@""'`\/#" TO "col__1_$%{}[]&*^!@""'`\/#"; + +ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN "col__1_$%{}[]&*^!@""'`\/#" SET DEFAULT 'changed default value'::text; + +ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN "col__1_$%{}[]&*^!@""'`\/#" DROP NOT NULL; + +COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col__1_$%{}[]&*^!@""'`\/#" + IS 'test comment modify'; + +GRANT SELECT("col__1_$%{}[]&*^!@""'`\/#") ON testschema."table_2_$%{}[]()&*^!@""'`\/#" TO PUBLIC; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/alter_column_text_with_default_value.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/alter_column_text_with_default_value.sql new file mode 100644 index 000000000..31e9cf7b9 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/alter_column_text_with_default_value.sql @@ -0,0 +1,11 @@ +-- Column: testschema."table_2_$%{}[]()&*^!@""'`\/#"."col__1_$%{}[]&*^!@""'`\/#" + +-- ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" DROP COLUMN "col__1_$%{}[]&*^!@""'`\/#"; + +ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" + ADD COLUMN "col__1_$%{}[]&*^!@""'`\/#" text COLLATE pg_catalog."C" DEFAULT 'changed default value'::text; + +COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col__1_$%{}[]&*^!@""'`\/#" + IS 'test comment modify'; + +GRANT SELECT("col__1_$%{}[]&*^!@""'`\/#") ON testschema."table_2_$%{}[]()&*^!@""'`\/#" TO PUBLIC; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/create_column_char.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/create_column_char.msql index d0592b96b..0fb8d76d6 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/create_column_char.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/create_column_char.msql @@ -1,5 +1,5 @@ ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" - ADD COLUMN "col_2_$%{}[]()&*^!@""'`\/#" character varying(50, None) COLLATE pg_catalog."C" DEFAULT None; + ADD COLUMN "col_2_$%{}[]()&*^!@""'`\/#" character varying(50) COLLATE pg_catalog."C"; COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_2_$%{}[]()&*^!@""'`\/#" - IS 'Comment for create'; \ No newline at end of file + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/create_column_identity_for_restart_seq.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/create_column_identity_for_restart_seq.msql index 4a39d912a..57a8172b8 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/create_column_identity_for_restart_seq.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/create_column_identity_for_restart_seq.msql @@ -1,5 +1,5 @@ ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" - ADD COLUMN "col_6_$%{}[]()&*^!@""'`\/#" bigint(None, None) NOT NULL GENERATED BY DEFAULT AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 10 CACHE 1 ); + ADD COLUMN "col_6_$%{}[]()&*^!@""'`\/#" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 10 CACHE 1 ); COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_6_$%{}[]()&*^!@""'`\/#" IS 'demo comments'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/create_column_int.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/create_column_int.msql index 9314e01b8..a977584c1 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/create_column_int.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/create_column_int.msql @@ -1,5 +1,5 @@ ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" - ADD COLUMN "col_1_$%{}[]()&*^!@""'`\/#" bigint(None, None) NOT NULL DEFAULT 1; + ADD COLUMN "col_1_$%{}[]()&*^!@""'`\/#" bigint NOT NULL DEFAULT 1; COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_1_$%{}[]()&*^!@""'`\/#" - IS 'Comment for create'; \ No newline at end of file + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/create_column_int_identity.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/create_column_int_identity.msql index ad0bbd759..553d8748d 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/create_column_int_identity.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/create_column_int_identity.msql @@ -1,5 +1,5 @@ ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" - ADD COLUMN "col_3_$%{}[]()&*^!@""'`\/#" bigint(None, None) NOT NULL GENERATED ALWAYS AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 99999 CACHE 10 ); + ADD COLUMN "col_3_$%{}[]()&*^!@""'`\/#" bigint NOT NULL GENERATED ALWAYS AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 99999 CACHE 10 ); COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_3_$%{}[]()&*^!@""'`\/#" - IS 'Comment for create'; \ No newline at end of file + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/create_column_int_identity_by_default.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/create_column_int_identity_by_default.msql index 7bd916040..49a9a8ab5 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/create_column_int_identity_by_default.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/create_column_int_identity_by_default.msql @@ -1,5 +1,5 @@ ALTER TABLE testschema."table_2_$%{}[]()&*^!@""'`\/#" - ADD COLUMN "col_5_$%{}[]()&*^!@""'`\/#" bigint(None, None) NOT NULL GENERATED BY DEFAULT AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 99999 CACHE 10 ); + ADD COLUMN "col_5_$%{}[]()&*^!@""'`\/#" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 99999 CACHE 10 ); COMMENT ON COLUMN testschema."table_2_$%{}[]()&*^!@""'`\/#"."col_5_$%{}[]()&*^!@""'`\/#" - IS 'Comment for create'; \ No newline at end of file + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/test.json index 968c0b551..b242dd51d 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/test.json +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/10_plus/test.json @@ -26,8 +26,8 @@ "attacl": [], "is_primary_key": false, "attnotnull": true, - "attlen": null, - "attprecision": null, + "attlen": "", + "attprecision": "", "attoptions": [], "seclabels": [], "defval": "1" @@ -138,10 +138,9 @@ "is_primary_key": false, "attnotnull": false, "attlen": "50", - "attprecision": null, + "attprecision": "", "attoptions": [], - "seclabels": [], - "defval": null + "seclabels": [] }, "expected_sql_file": "create_column_char.sql", "expected_msql_file": "create_column_char.msql" @@ -211,8 +210,8 @@ "attacl": [], "is_primary_key": false, "attnotnull": true, - "attlen": null, - "attprecision": null, + "attlen": "", + "attprecision": "", "attoptions": [], "seclabels": [], "attidentity": "a", @@ -398,8 +397,8 @@ "attacl": [], "is_primary_key": false, "attnotnull": true, - "attlen": null, - "attprecision": null, + "attlen": "", + "attprecision": "", "attoptions": [], "seclabels": [], "attidentity": "d", @@ -468,8 +467,8 @@ "description": "demo comments", "is_primary_key": false, "attnotnull": true, - "attlen": null, - "attprecision": null, + "attlen": "", + "attprecision": "", "attidentity": "d", "seqincrement": "1", "seqstart": "1", diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_char.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_char.msql index 11ad3f86b..232f1948d 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_char.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_char.msql @@ -1,5 +1,5 @@ ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" - ADD COLUMN "col_2_$%{}[]()&*^!@""'`\/#" character varying(50, None) COLLATE pg_catalog."C" DEFAULT None; + ADD COLUMN "col_2_$%{}[]()&*^!@""'`\/#" character varying(50) COLLATE pg_catalog."C"; COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_2_$%{}[]()&*^!@""'`\/#" - IS 'Comment for create'; \ No newline at end of file + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_identity_for_restart_seq.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_identity_for_restart_seq.msql index 897636899..4ba048b50 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_identity_for_restart_seq.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_identity_for_restart_seq.msql @@ -1,5 +1,5 @@ ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" - ADD COLUMN "col_6_$%{}[]()&*^!@""'`\/#" bigint(None, None) NOT NULL GENERATED BY DEFAULT AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 10 CACHE 1 ); + ADD COLUMN "col_6_$%{}[]()&*^!@""'`\/#" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 10 CACHE 1 ); COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_6_$%{}[]()&*^!@""'`\/#" IS 'demo comments'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_int.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_int.msql index 925ea8c8f..04dca5541 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_int.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_int.msql @@ -1,5 +1,5 @@ ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" - ADD COLUMN "col_1_$%{}[]()&*^!@""'`\/#" bigint(None, None) NOT NULL DEFAULT 1; + ADD COLUMN "col_1_$%{}[]()&*^!@""'`\/#" bigint NOT NULL DEFAULT 1; COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_1_$%{}[]()&*^!@""'`\/#" - IS 'Comment for create'; \ No newline at end of file + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_int_generated.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_int_generated.msql index 22cee135b..b4816e0f4 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_int_generated.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_int_generated.msql @@ -1,5 +1,5 @@ ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" - ADD COLUMN "col_4_$%{}[]()&*^!@""'`\/#" bigint(None, None) GENERATED ALWAYS AS (1 + 2 + 3) STORED; + ADD COLUMN "col_4_$%{}[]()&*^!@""'`\/#" bigint GENERATED ALWAYS AS (1 + 2 + 3) STORED; COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_4_$%{}[]()&*^!@""'`\/#" - IS 'Comment for create'; \ No newline at end of file + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_int_generated_with_existing_columns.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_int_generated_with_existing_columns.msql index 95ab88727..7e79b10f1 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_int_generated_with_existing_columns.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_int_generated_with_existing_columns.msql @@ -1,5 +1,5 @@ ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" - ADD COLUMN "col_8_$%{}[]()&*^!@""'`\/#" bigint(None, None) GENERATED ALWAYS AS (dummy1 + dummy2) STORED; + ADD COLUMN "col_8_$%{}[]()&*^!@""'`\/#" bigint GENERATED ALWAYS AS (dummy1 + dummy2) STORED; COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_8_$%{}[]()&*^!@""'`\/#" - IS 'Comment for create'; \ No newline at end of file + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_int_identity.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_int_identity.msql index 34581f0a5..b9f3f5536 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_int_identity.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_int_identity.msql @@ -1,5 +1,5 @@ ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" - ADD COLUMN "col_3_$%{}[]()&*^!@""'`\/#" bigint(None, None) NOT NULL GENERATED ALWAYS AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 99999 CACHE 10 ); + ADD COLUMN "col_3_$%{}[]()&*^!@""'`\/#" bigint NOT NULL GENERATED ALWAYS AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 99999 CACHE 10 ); COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_3_$%{}[]()&*^!@""'`\/#" - IS 'Comment for create'; \ No newline at end of file + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_int_identity_by_default.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_int_identity_by_default.msql index dcc5e7879..f4803dc0b 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_int_identity_by_default.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/create_column_int_identity_by_default.msql @@ -1,5 +1,5 @@ ALTER TABLE testschema."table_3_$%{}[]()&*^!@""'`\/#" - ADD COLUMN "col_9_$%{}[]()&*^!@""'`\/#" bigint(None, None) NOT NULL GENERATED BY DEFAULT AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 99999 CACHE 10 ); + ADD COLUMN "col_9_$%{}[]()&*^!@""'`\/#" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY ( CYCLE INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 99999 CACHE 10 ); COMMENT ON COLUMN testschema."table_3_$%{}[]()&*^!@""'`\/#"."col_9_$%{}[]()&*^!@""'`\/#" - IS 'Comment for create'; \ No newline at end of file + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/test.json index 69983090e..c4a9611ca 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/test.json +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/12_plus/test.json @@ -22,15 +22,15 @@ "data": { "name": "col_1_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for create", - "cltype":"bigint", - "attacl":[], - "is_primary_key":false, - "attnotnull":true, - "attlen":null, - "attprecision":null, - "attoptions":[], - "seclabels":[], - "defval":"1" + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": true, + "attlen": "", + "attprecision": "", + "attoptions": [], + "seclabels": [], + "defval": "1" }, "expected_sql_file": "create_column_int.sql", "expected_msql_file": "create_column_int.msql" @@ -45,8 +45,37 @@ "attnum": 1, "name": "new_col_1_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for alter", - "cltype":"real", - "attacl":{"added":[{"grantee":"PUBLIC","grantor":"enterprisedb","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false}]}]} + "cltype": "real", + "attacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "enterprisedb", + "privileges": [ + { + "privilege_type": "a", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "w", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "x", + "privilege": true, + "with_grant": false + } + ] + } + ] + } }, "expected_sql_file": "alter_column_int.sql", "expected_msql_file": "alter_column_int.msql" @@ -60,7 +89,26 @@ "data": { "attnum": 1, "name": "new_col_1_$%{}[]()&*^!@\"'`\\/#", - "attacl":{"changed":[{"grantee":"enterprisedb", "grantor":"enterprisedb","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false}]}]} + "attacl": { + "changed": [ + { + "grantee": "enterprisedb", + "grantor": "enterprisedb", + "privileges": [ + { + "privilege_type": "a", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + } + ] + } + ] + } }, "expected_sql_file": "alter_column_alt_privilege.sql", "expected_msql_file": "alter_column_alt_privilege.msql" @@ -83,16 +131,15 @@ "data": { "name": "col_2_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for create", - "cltype":"character varying", + "cltype": "character varying", "collspcname": "pg_catalog.\"C\"", - "attacl":[], - "is_primary_key":false, - "attnotnull":false, - "attlen":"50", - "attprecision":null, - "attoptions":[], - "seclabels":[], - "defval":null + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": "50", + "attprecision": "", + "attoptions": [], + "seclabels": [] }, "expected_sql_file": "create_column_char.sql", "expected_msql_file": "create_column_char.msql" @@ -110,8 +157,32 @@ "attstattarget": "5", "attstorage": "p", "description": "Comment for alter", - "cltype":"character", - "attacl":{"added":[{"grantee":"PUBLIC","grantor":"enterprisedb","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false}]}]} + "cltype": "character", + "attacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "enterprisedb", + "privileges": [ + { + "privilege_type": "a", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "x", + "privilege": true, + "with_grant": false + } + ] + } + ] + } }, "expected_sql_file": "alter_column_char.sql", "expected_msql_file": "alter_column_char.msql" @@ -134,22 +205,22 @@ "data": { "name": "col_3_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for create", - "cltype":"bigint", - "attacl":[], - "is_primary_key":false, - "attnotnull":true, - "attlen":null, - "attprecision":null, - "attoptions":[], - "seclabels":[], - "attidentity":"a", - "seqincrement":"1", - "seqstart":"1", - "seqmin":"1", - "seqmax":"99999", - "seqcache":"10", - "seqcycle":true, - "colconstype":"i" + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": true, + "attlen": "", + "attprecision": "", + "attoptions": [], + "seclabels": [], + "attidentity": "a", + "seqincrement": "1", + "seqstart": "1", + "seqmin": "1", + "seqmax": "99999", + "seqcache": "10", + "seqcycle": true, + "colconstype": "i" }, "expected_sql_file": "create_column_int_identity.sql", "expected_msql_file": "create_column_int_identity.msql" @@ -164,7 +235,31 @@ "attnum": 3, "name": "new_col_3_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for alter", - "attacl":{"added":[{"grantee":"PUBLIC","grantor":"enterprisedb","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false}]}]} + "attacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "enterprisedb", + "privileges": [ + { + "privilege_type": "a", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "x", + "privilege": true, + "with_grant": false + } + ] + } + ] + } }, "expected_sql_file": "alter_column_identity.sql", "expected_msql_file": "alter_column_identity.msql" @@ -200,17 +295,17 @@ "data": { "name": "col_4_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for create", - "cltype":"bigint", - "attacl":[], - "is_primary_key":false, - "attnotnull":false, - "attlen":null, - "attprecision":null, - "attidentity":"a", - "colconstype":"g", - "genexpr":"1 + 2 + 3", - "attoptions":[], - "seclabels":[] + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": "", + "attprecision": "", + "attidentity": "a", + "colconstype": "g", + "genexpr": "1 + 2 + 3", + "attoptions": [], + "seclabels": [] }, "expected_sql_file": "create_column_int_generated.sql", "expected_msql_file": "create_column_int_generated.msql" @@ -225,7 +320,31 @@ "attnum": 4, "name": "new_col_4_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for alter", - "attacl":{"added":[{"grantee":"PUBLIC","grantor":"enterprisedb","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false}]}]} + "attacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "enterprisedb", + "privileges": [ + { + "privilege_type": "a", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "x", + "privilege": true, + "with_grant": false + } + ] + } + ] + } }, "expected_sql_file": "alter_column_generated.sql", "expected_msql_file": "alter_column_generated.msql" @@ -248,17 +367,22 @@ "data": { "name": "col_5_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for create", - "min_val":0, - "max_val":1000, - "cltype":"numeric", - "attacl":[], - "is_primary_key":false, - "attnotnull":true, - "attlen":"10", - "attprecision":"5", - "attidentity":"a", - "attoptions":[{"name":"n_distinct","value":"1"}], - "seclabels":[] + "min_val": 0, + "max_val": 1000, + "cltype": "numeric", + "attacl": [], + "is_primary_key": false, + "attnotnull": true, + "attlen": "10", + "attprecision": "5", + "attidentity": "a", + "attoptions": [ + { + "name": "n_distinct", + "value": "1" + } + ], + "seclabels": [] }, "expected_sql_file": "create_column_numeric.sql", "expected_msql_file": "create_column_numeric.msql" @@ -272,10 +396,39 @@ "data": { "name": "new_col_5_$%{}[]()&*^!@\"'`\\/#", "attnum": 5, - "attlen":"15", - "attprecision":"6", + "attlen": "15", + "attprecision": "6", "description": "Comment for alter", - "attacl":{"added":[{"grantee":"PUBLIC","grantor":"enterprisedb","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false}]}]} + "attacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "enterprisedb", + "privileges": [ + { + "privilege_type": "a", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "w", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "x", + "privilege": true, + "with_grant": false + } + ] + } + ] + } }, "expected_sql_file": "alter_column_numeric.sql", "expected_msql_file": "alter_column_numeric.msql" @@ -288,7 +441,7 @@ "msql_endpoint": "NODE-column.msql_id", "data": { "attnum": 3, - "attlen":"" + "attlen": "" }, "expected_sql_file": "alter_column_remove_length.sql", "expected_msql_file": "alter_column_remove_length.msql" @@ -302,7 +455,6 @@ "name": "new_col_5_$%{}[]()&*^!@\"'`\\/#" } }, - { "type": "create", "name": "Create Dummy Column (Integer/Numeric type)", @@ -312,15 +464,15 @@ "data": { "name": "dummy1", "description": "Comment for create", - "cltype":"bigint", - "attacl":[], - "is_primary_key":false, - "attnotnull":true, - "attlen":null, - "attprecision":null, - "attoptions":[], - "seclabels":[], - "defval":"1" + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": true, + "attlen": "", + "attprecision": "", + "attoptions": [], + "seclabels": [], + "defval": "1" } }, { @@ -332,15 +484,15 @@ "data": { "name": "dummy2", "description": "Comment for create", - "cltype":"bigint", - "attacl":[], - "is_primary_key":false, - "attnotnull":true, - "attlen":null, - "attprecision":null, - "attoptions":[], - "seclabels":[], - "defval":"1" + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": true, + "attlen": "", + "attprecision": "", + "attoptions": [], + "seclabels": [], + "defval": "1" } }, { @@ -352,17 +504,17 @@ "data": { "name": "col_8_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for create", - "cltype":"bigint", - "attacl":[], - "is_primary_key":false, - "attnotnull":false, - "attlen":null, - "attprecision":null, - "attidentity":"a", - "colconstype":"g", - "genexpr":"dummy1 + dummy2", - "attoptions":[], - "seclabels":[] + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": "", + "attprecision": "", + "attidentity": "a", + "colconstype": "g", + "genexpr": "dummy1 + dummy2", + "attoptions": [], + "seclabels": [] }, "expected_sql_file": "create_column_int_generated_with_existing_columns.sql", "expected_msql_file": "create_column_int_generated_with_existing_columns.msql" @@ -376,9 +528,33 @@ "data": { "attnum": 8, "name": "new_col_8_$%{}[]()&*^!@\"'`\\/#", - "genexpr":"dummy1 - dummy2", + "genexpr": "dummy1 - dummy2", "description": "Comment for alter", - "attacl":{"added":[{"grantee":"PUBLIC","grantor":"enterprisedb","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false}]}]} + "attacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "enterprisedb", + "privileges": [ + { + "privilege_type": "a", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "x", + "privilege": true, + "with_grant": false + } + ] + } + ] + } }, "expected_sql_file": "alter_column_generated_with_existing_columns.sql", "expected_msql_file": "alter_column_generated_with_existing_columns.msql" @@ -392,7 +568,6 @@ "name": "new_col_8_$%{}[]()&*^!@\"'`\\/#" } }, - { "type": "create", "name": "Create Column with identity (Generated by default)", @@ -402,22 +577,22 @@ "data": { "name": "col_9_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for create", - "cltype":"bigint", - "attacl":[], - "is_primary_key":false, - "attnotnull":true, - "attlen":null, - "attprecision":null, - "attoptions":[], - "seclabels":[], - "attidentity":"d", - "seqincrement":"1", - "seqstart":"1", - "seqmin":"1", - "seqmax":"99999", - "seqcache":"10", - "seqcycle":true, - "colconstype":"i" + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": true, + "attlen": "", + "attprecision": "", + "attoptions": [], + "seclabels": [], + "attidentity": "d", + "seqincrement": "1", + "seqstart": "1", + "seqmin": "1", + "seqmax": "99999", + "seqcache": "10", + "seqcycle": true, + "colconstype": "i" }, "expected_sql_file": "create_column_int_identity_by_default.sql", "expected_msql_file": "create_column_int_identity_by_default.msql" @@ -432,11 +607,11 @@ "attnum": 9, "name": "new_col_9_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for alter", - "seqincrement":"2", - "seqmax":"200", - "seqcache":"2", - "seqcycle":true, - "seqmin":"1" + "seqincrement": "2", + "seqmax": "200", + "seqcache": "2", + "seqcycle": true, + "seqmin": "1" }, "expected_sql_file": "alter_column_identity_by_default.sql", "expected_msql_file": "alter_column_identity_by_default.msql" @@ -476,8 +651,8 @@ "description": "demo comments", "is_primary_key": false, "attnotnull": true, - "attlen": null, - "attprecision": null, + "attlen": "", + "attprecision": "", "attidentity": "d", "seqincrement": "1", "seqstart": "1", diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/default/create_column_char.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/default/create_column_char.msql index f43e84a8e..4c3981b44 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/default/create_column_char.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/default/create_column_char.msql @@ -1,5 +1,5 @@ ALTER TABLE testschema."table_1_$%{}[]()&*^!@""'`\/#" - ADD COLUMN "col_2_$%{}[]()&*^!@""'`\/#" character varying(50, None) COLLATE pg_catalog."C" DEFAULT None; + ADD COLUMN "col_2_$%{}[]()&*^!@""'`\/#" character varying(50) COLLATE pg_catalog."C"; COMMENT ON COLUMN testschema."table_1_$%{}[]()&*^!@""'`\/#"."col_2_$%{}[]()&*^!@""'`\/#" - IS 'Comment for create'; \ No newline at end of file + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/default/create_column_int.msql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/default/create_column_int.msql index bde4012ff..c314b0bcf 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/default/create_column_int.msql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/default/create_column_int.msql @@ -1,5 +1,5 @@ ALTER TABLE testschema."table_1_$%{}[]()&*^!@""'`\/#" - ADD COLUMN "col_1_$%{}[]()&*^!@""'`\/#" bigint(None, None) NOT NULL DEFAULT 1; + ADD COLUMN "col_1_$%{}[]()&*^!@""'`\/#" bigint NOT NULL DEFAULT 1; COMMENT ON COLUMN testschema."table_1_$%{}[]()&*^!@""'`\/#"."col_1_$%{}[]()&*^!@""'`\/#" - IS 'Comment for create'; \ No newline at end of file + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/default/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/default/test.json index 1cced1226..7882b4958 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/default/test.json +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/columns/tests/ppas/default/test.json @@ -22,15 +22,15 @@ "data": { "name": "col_1_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for create", - "cltype":"bigint", - "attacl":[], - "is_primary_key":false, - "attnotnull":true, - "attlen":null, - "attprecision":null, - "attoptions":[], - "seclabels":[], - "defval":"1" + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": true, + "attlen": "", + "attprecision": "", + "attoptions": [], + "seclabels": [], + "defval": "1" }, "expected_sql_file": "create_column_int.sql", "expected_msql_file": "create_column_int.msql" @@ -45,8 +45,37 @@ "attnum": 1, "name": "new_col_1_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for alter", - "cltype":"real", - "attacl":{"added":[{"grantee":"PUBLIC","grantor":"enterprisedb","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false}]}]} + "cltype": "real", + "attacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "enterprisedb", + "privileges": [ + { + "privilege_type": "a", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "w", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "x", + "privilege": true, + "with_grant": false + } + ] + } + ] + } }, "expected_sql_file": "alter_column_int.sql", "expected_msql_file": "alter_column_int.msql" @@ -60,7 +89,26 @@ "data": { "attnum": 1, "name": "new_col_1_$%{}[]()&*^!@\"'`\\/#", - "attacl":{"changed":[{"grantee":"enterprisedb", "grantor":"enterprisedb","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false}]}]} + "attacl": { + "changed": [ + { + "grantee": "enterprisedb", + "grantor": "enterprisedb", + "privileges": [ + { + "privilege_type": "a", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + } + ] + } + ] + } }, "expected_sql_file": "alter_column_alt_privilege.sql", "expected_msql_file": "alter_column_alt_privilege.msql" @@ -83,16 +131,15 @@ "data": { "name": "col_2_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for create", - "cltype":"character varying", + "cltype": "character varying", "collspcname": "pg_catalog.\"C\"", - "attacl":[], - "is_primary_key":false, - "attnotnull":false, - "attlen":"50", - "attprecision":null, - "attoptions":[], - "seclabels":[], - "defval":null + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": "50", + "attprecision": "", + "attoptions": [], + "seclabels": [] }, "expected_sql_file": "create_column_char.sql", "expected_msql_file": "create_column_char.msql" @@ -110,8 +157,32 @@ "attstattarget": "5", "attstorage": "p", "description": "Comment for alter", - "cltype":"character", - "attacl":{"added":[{"grantee":"PUBLIC","grantor":"enterprisedb","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false}]}]} + "cltype": "character", + "attacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "enterprisedb", + "privileges": [ + { + "privilege_type": "a", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "x", + "privilege": true, + "with_grant": false + } + ] + } + ] + } }, "expected_sql_file": "alter_column_char.sql", "expected_msql_file": "alter_column_char.msql" @@ -125,7 +196,6 @@ "name": "new_col_2_$%{}[]()&*^!@\"'`\\/#" } }, - { "type": "create", "name": "Create Column (Numeric type with Length Precision & Variables)", @@ -135,17 +205,22 @@ "data": { "name": "col_3_$%{}[]()&*^!@\"'`\\/#", "description": "Comment for create", - "min_val":0, - "max_val":1000, - "cltype":"numeric", - "attacl":[], - "is_primary_key":false, - "attnotnull":true, - "attlen":"10", - "attprecision":"5", - "attidentity":"a", - "attoptions":[{"name":"n_distinct","value":"1"}], - "seclabels":[] + "min_val": 0, + "max_val": 1000, + "cltype": "numeric", + "attacl": [], + "is_primary_key": false, + "attnotnull": true, + "attlen": "10", + "attprecision": "5", + "attidentity": "a", + "attoptions": [ + { + "name": "n_distinct", + "value": "1" + } + ], + "seclabels": [] }, "expected_sql_file": "create_column_numeric.sql", "expected_msql_file": "create_column_numeric.msql" @@ -159,10 +234,39 @@ "data": { "name": "new_col_3_$%{}[]()&*^!@\"'`\\/#", "attnum": 3, - "attlen":"15", - "attprecision":"6", + "attlen": "15", + "attprecision": "6", "description": "Comment for alter", - "attacl":{"added":[{"grantee":"PUBLIC","grantor":"enterprisedb","privileges":[{"privilege_type":"a","privilege":true,"with_grant":false},{"privilege_type":"r","privilege":true,"with_grant":false},{"privilege_type":"w","privilege":true,"with_grant":false},{"privilege_type":"x","privilege":true,"with_grant":false}]}]} + "attacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "enterprisedb", + "privileges": [ + { + "privilege_type": "a", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "w", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "x", + "privilege": true, + "with_grant": false + } + ] + } + ] + } }, "expected_sql_file": "alter_column_numeric.sql", "expected_msql_file": "alter_column_numeric.msql" @@ -175,7 +279,7 @@ "msql_endpoint": "NODE-column.msql_id", "data": { "attnum": 3, - "attlen":"" + "attlen": "" }, "expected_sql_file": "alter_column_remove_length.sql", "expected_msql_file": "alter_column_remove_length.msql" diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/tests/Default/msql_check_constraint.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/tests/Default/alter_check_constraint_msql.sql similarity index 100% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/tests/Default/msql_check_constraint.sql rename to web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/tests/Default/alter_check_constraint_msql.sql diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/tests/Default/create_check_constraint_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/tests/Default/create_check_constraint_msql.sql new file mode 100644 index 000000000..58bfeaab2 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/tests/Default/create_check_constraint_msql.sql @@ -0,0 +1,6 @@ +ALTER TABLE public.tableforcon + ADD CONSTRAINT "Chk_$%{}[]()&*^!@""'`\/#" CHECK (col1 > 1) + NOT VALID; + +COMMENT ON CONSTRAINT "Chk_$%{}[]()&*^!@""'`\/#" ON public.tableforcon + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/tests/Default/create_check_constraint_with_valid.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/tests/Default/create_check_constraint_with_valid.sql new file mode 100644 index 000000000..40151866b --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/tests/Default/create_check_constraint_with_valid.sql @@ -0,0 +1,9 @@ +-- Constraint: Chk_valid_$%{}[]()&*^!@"'`\/# + +-- ALTER TABLE testschema.tableforcon DROP CONSTRAINT "Chk_valid_$%{}[]()&*^!@""'`\/#"; + +ALTER TABLE testschema.tableforcon + ADD CONSTRAINT "Chk_valid_$%{}[]()&*^!@""'`\/#" CHECK (col1 > 200) NO INHERIT; + +COMMENT ON CONSTRAINT "Chk_valid_$%{}[]()&*^!@""'`\/#" ON testschema.tableforcon + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/tests/Default/create_check_constraint_with_valid_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/tests/Default/create_check_constraint_with_valid_msql.sql new file mode 100644 index 000000000..1d341e03b --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/tests/Default/create_check_constraint_with_valid_msql.sql @@ -0,0 +1,5 @@ +ALTER TABLE testschema.tableforcon + ADD CONSTRAINT "Chk_valid_$%{}[]()&*^!@""'`\/#" CHECK (col1 > 200) NO INHERIT; + +COMMENT ON CONSTRAINT "Chk_valid_$%{}[]()&*^!@""'`\/#" ON testschema.tableforcon + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/tests/Default/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/tests/Default/test.json index 6e229fd91..47e180c99 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/tests/Default/test.json +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/check_constraint/tests/Default/test.json @@ -30,7 +30,8 @@ "connoinherit": false, "convalidated": true }, - "expected_sql_file": "create_check_constraint.sql" + "expected_sql_file": "create_check_constraint.sql", + "expected_msql_file": "create_check_constraint_msql.sql" }, { "type": "alter", "name": "Alter Check Constraint", @@ -43,7 +44,7 @@ "comment": "Comment for alter" }, "expected_sql_file": "alter_check_constraint.sql", - "expected_msql_file": "msql_check_constraint.sql" + "expected_msql_file": "alter_check_constraint_msql.sql" }, { "type": "delete", "name": "Drop Check Constraint", @@ -51,6 +52,21 @@ "data": { "name": "Chk_$%{}[]()&*^!@\"'`\\/#a" } + }, + { + "type": "create", + "name": "Create Check Constraint with valid = False, Inherit = True", + "endpoint": "NODE-check_constraint.obj", + "sql_endpoint": "NODE-check_constraint.sql_id", + "data": { + "name": "Chk_valid_$%{}[]()&*^!@\"'`\\/#", + "comment": "Comment for create", + "consrc": "col1 > 200", + "connoinherit": true, + "convalidated": false + }, + "expected_sql_file": "create_check_constraint_with_valid.sql", + "expected_msql_file": "create_check_constraint_with_valid_msql.sql" }, { "type": "delete", "name": "Drop Table for Check Constraint", diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/11_plus/msql_exclusion_constraint.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/11_plus/alter_exclusion_constraint_msql.sql similarity index 100% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/11_plus/msql_exclusion_constraint.sql rename to web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/11_plus/alter_exclusion_constraint_msql.sql diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/11_plus/create_exclusion_constraint_exp_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/11_plus/create_exclusion_constraint_exp_msql.sql new file mode 100644 index 000000000..08b19b141 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/11_plus/create_exclusion_constraint_exp_msql.sql @@ -0,0 +1,10 @@ +ALTER TABLE testschema.tableforexclusion + ADD CONSTRAINT "Exclusion_$%{}[]()&*^!@""'`\/#" EXCLUDE USING gist ( + (col1 + col3) WITH <>, + col2 WITH <>) + WITH (FILLFACTOR=12) + WHERE (col1 > 1) + DEFERRABLE INITIALLY DEFERRED; + +COMMENT ON CONSTRAINT "Exclusion_$%{}[]()&*^!@""'`\/#" ON testschema.tableforexclusion + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/11_plus/create_exclusion_constraint_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/11_plus/create_exclusion_constraint_msql.sql new file mode 100644 index 000000000..373174b44 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/11_plus/create_exclusion_constraint_msql.sql @@ -0,0 +1,10 @@ +ALTER TABLE testschema.tableforexclusion + ADD CONSTRAINT "Exclusion_$%{}[]()&*^!@""'`\/#" EXCLUDE USING btree ( + col2 text_pattern_ops WITH =) + INCLUDE (col1) + WITH (FILLFACTOR=12) + WHERE (col1 > 1) + DEFERRABLE INITIALLY DEFERRED; + +COMMENT ON CONSTRAINT "Exclusion_$%{}[]()&*^!@""'`\/#" ON testschema.tableforexclusion + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/11_plus/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/11_plus/test.json index 752f27846..73f6af4a8 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/11_plus/test.json +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/11_plus/test.json @@ -7,23 +7,28 @@ "sql_endpoint": "NODE-table.sql_id", "data": { "name": "tableforexclusion", - "columns": [{ - "name": "col1", - "cltype": "integer", - "is_primary_key": true - }, { - "name": "col2", - "cltype": "text" - }, { - "name": "col3", - "cltype": "integer" - }], + "columns": [ + { + "name": "col1", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "col2", + "cltype": "text" + }, + { + "name": "col3", + "cltype": "integer" + } + ], "is_partitioned": false, "schema": "testschema", "spcname": "pg_default" }, "store_object_id": true - }, { + }, + { "type": "create", "name": "Create Extension", "endpoint": "NODE-extension.obj", @@ -33,7 +38,8 @@ "version": "", "relocatable": true } - }, { + }, + { "type": "create", "name": "Create Exclusion Constraint", "endpoint": "NODE-exclusion_constraint.obj", @@ -56,10 +62,14 @@ "oper_class": "text_pattern_ops" } ], - "include": ["col1"] + "include": [ + "col1" + ] }, - "expected_sql_file": "create_exclusion_constraint.sql" - }, { + "expected_sql_file": "create_exclusion_constraint.sql", + "expected_msql_file": "create_exclusion_constraint_msql.sql" + }, + { "type": "alter", "name": "Alter Exclusion Constraint", "endpoint": "NODE-exclusion_constraint.obj_id", @@ -71,15 +81,17 @@ "fillfactor": "98" }, "expected_sql_file": "alter_exclusion_constraint.sql", - "expected_msql_file": "msql_exclusion_constraint.sql" - }, { + "expected_msql_file": "alter_exclusion_constraint_msql.sql" + }, + { "type": "delete", "name": "Drop Exclusion Constraint", "endpoint": "NODE-exclusion_constraint.delete_id", "data": { "name": "Exclusion_$%{}[]()&*^!@\"'`\\/#a" } - }, { + }, + { "type": "create", "name": "Create Exclusion Constraint with expressions", "endpoint": "NODE-exclusion_constraint.obj", @@ -111,8 +123,55 @@ } ] }, - "expected_sql_file": "create_exclusion_constraint_exp.sql" - }, { + "expected_sql_file": "create_exclusion_constraint_exp.sql", + "expected_msql_file": "create_exclusion_constraint_exp_msql.sql" + }, + { + "type": "delete", + "name": "Drop Exclusion Constraint", + "endpoint": "NODE-exclusion_constraint.delete_id", + "data": { + "name": "Exclusion_$%{}[]()&*^!@\"'`\\/#_1a" + } + }, + { + "type": "create", + "name": "Create Exclusion Constraint to remove Fillfactor", + "endpoint": "NODE-exclusion_constraint.obj", + "sql_endpoint": "NODE-exclusion_constraint.sql_id", + "data": { + "name": "Exclusion_$%{}[]()&*^!@\"'`\\/#_1", + "comment": "Comment for create", + "fillfactor": "12", + "amname": "gist", + "columns": [ + { + "column": "col2", + "order": false, + "nulls_order": false, + "operator": "<>", + "is_sort_nulls_applicable": false, + "is_exp": false + } + ] + }, + "expected_sql_file": "create_without_fillfactor.sql" + }, + { + "type": "alter", + "name": "Alter Exclusion Constraint to remove Fillfactor", + "endpoint": "NODE-exclusion_constraint.obj_id", + "sql_endpoint": "NODE-exclusion_constraint.sql_id", + "msql_endpoint": "NODE-exclusion_constraint.msql_id", + "data": { + "name": "Exclusion_$%{}[]()&*^!@\"'`\\/#_1a", + "comment": "Comment for alter", + "fillfactor": "" + }, + "expected_sql_file": "alter_without_fillfactor.sql", + "expected_msql_file": "alter_without_fillfactor_msql.sql" + }, + { "type": "delete", "name": "Drop Exclusion Constraint", "endpoint": "NODE-exclusion_constraint.delete_id", diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/default/msql_exclusion_constraint.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/default/alter_exclusion_constraint_msql.sql similarity index 100% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/default/msql_exclusion_constraint.sql rename to web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/default/alter_exclusion_constraint_msql.sql diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/default/msql_without_fillfactor.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/default/alter_without_fillfactor_msql.sql similarity index 100% rename from web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/default/msql_without_fillfactor.sql rename to web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/default/alter_without_fillfactor_msql.sql diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/default/create_exclusion_constraint_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/default/create_exclusion_constraint_msql.sql new file mode 100644 index 000000000..74d8165df --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/default/create_exclusion_constraint_msql.sql @@ -0,0 +1,9 @@ +ALTER TABLE testschema.tableforexclusion + ADD CONSTRAINT "Exclusion_$%{}[]()&*^!@""'`\/#" EXCLUDE USING gist ( + col2 WITH <>) + WITH (FILLFACTOR=12) + WHERE (col1 > 1) + DEFERRABLE INITIALLY DEFERRED; + +COMMENT ON CONSTRAINT "Exclusion_$%{}[]()&*^!@""'`\/#" ON testschema.tableforexclusion + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/default/create_without_fillfactor_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/default/create_without_fillfactor_msql.sql new file mode 100644 index 000000000..75d85f238 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/default/create_without_fillfactor_msql.sql @@ -0,0 +1,7 @@ +ALTER TABLE testschema.tableforexclusion + ADD CONSTRAINT "Exclusion_$%{}[]()&*^!@""'`\/#_1" EXCLUDE USING gist ( + col2 WITH <>) + WITH (FILLFACTOR=12); + +COMMENT ON CONSTRAINT "Exclusion_$%{}[]()&*^!@""'`\/#_1" ON testschema.tableforexclusion + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/default/exclusion_constraint_exp_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/default/exclusion_constraint_exp_msql.sql new file mode 100644 index 000000000..b3e03df13 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/default/exclusion_constraint_exp_msql.sql @@ -0,0 +1,10 @@ +ALTER TABLE testschema.tableforexclusion + ADD CONSTRAINT "Exclusion_$%{}[]()&*^!@""'`\/#" EXCLUDE USING gist ( + col2 WITH <>, + (col1+col3) WITH <>) + WITH (FILLFACTOR=12) + WHERE (col1 > 1) + DEFERRABLE INITIALLY DEFERRED; + +COMMENT ON CONSTRAINT "Exclusion_$%{}[]()&*^!@""'`\/#" ON testschema.tableforexclusion + IS 'Comment for create'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/default/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/default/test.json index ed4f091d7..3f46c3ef1 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/default/test.json +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/constraints/exclusion_constraint/tests/default/test.json @@ -7,23 +7,28 @@ "sql_endpoint": "NODE-table.sql_id", "data": { "name": "tableforexclusion", - "columns": [{ - "name": "col1", - "cltype": "integer", - "is_primary_key": true - }, { - "name": "col2", - "cltype": "text" - }, { - "name": "col3", - "cltype": "integer" - }], + "columns": [ + { + "name": "col1", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "col2", + "cltype": "text" + }, + { + "name": "col3", + "cltype": "integer" + } + ], "is_partitioned": false, "schema": "testschema", "spcname": "pg_default" }, "store_object_id": true - }, { + }, + { "type": "create", "name": "Create Extension", "endpoint": "NODE-extension.obj", @@ -33,7 +38,8 @@ "version": "", "relocatable": true } - }, { + }, + { "type": "create", "name": "Create Exclusion Constraint", "endpoint": "NODE-exclusion_constraint.obj", @@ -57,8 +63,10 @@ } ] }, - "expected_sql_file": "create_exclusion_constraint.sql" - }, { + "expected_sql_file": "create_exclusion_constraint.sql", + "expected_msql_file": "create_exclusion_constraint_msql.sql" + }, + { "type": "alter", "name": "Alter Exclusion Constraint", "endpoint": "NODE-exclusion_constraint.obj_id", @@ -70,15 +78,17 @@ "fillfactor": "98" }, "expected_sql_file": "alter_exclusion_constraint.sql", - "expected_msql_file": "msql_exclusion_constraint.sql" - }, { + "expected_msql_file": "alter_exclusion_constraint_msql.sql" + }, + { "type": "delete", "name": "Drop Exclusion Constraint", "endpoint": "NODE-exclusion_constraint.delete_id", "data": { "name": "Exclusion_$%{}[]()&*^!@\"'`\\/#a" } - }, { + }, + { "type": "create", "name": "Create Exclusion Constraint to remove Fillfactor", "endpoint": "NODE-exclusion_constraint.obj", @@ -100,7 +110,8 @@ ] }, "expected_sql_file": "create_without_fillfactor.sql" - }, { + }, + { "type": "alter", "name": "Alter Exclusion Constraint to remove Fillfactor", "endpoint": "NODE-exclusion_constraint.obj_id", @@ -112,15 +123,17 @@ "fillfactor": "" }, "expected_sql_file": "alter_without_fillfactor.sql", - "expected_msql_file": "msql_without_fillfactor.sql" - }, { + "expected_msql_file": "alter_without_fillfactor_msql.sql" + }, + { "type": "delete", "name": "Drop Exclusion Constraint", "endpoint": "NODE-exclusion_constraint.delete_id", "data": { "name": "Exclusion_$%{}[]()&*^!@\"'`\\/#_1a" } - }, { + }, + { "type": "create", "name": "Create Exclusion Constraint with expressions", "endpoint": "NODE-exclusion_constraint.obj", @@ -152,14 +165,51 @@ } ] }, - "expected_sql_file": "create_exclusion_constraint_exp.sql" - }, { + "expected_sql_file": "create_exclusion_constraint_exp.sql", + "expected_msql_file": "exclusion_constraint_exp_msql.sql" + }, + { "type": "delete", "name": "Drop Exclusion Constraint", "endpoint": "NODE-exclusion_constraint.delete_id", "data": { "name": "Exclusion_$%{}[]()&*^!@\"'`\\/#_1a" } + }, + { + "type": "create", + "name": "Create Exclusion Constraint with expressions", + "endpoint": "NODE-exclusion_constraint.obj", + "sql_endpoint": "NODE-exclusion_constraint.sql_id", + "data": { + "name": "Exclusion_$%{}[]()&*^!@\"'`\\/#", + "comment": "Comment for create", + "fillfactor": "12", + "amname": "gist", + "condeferrable": true, + "condeferred": true, + "indconstraint": "col1 > 1", + "columns": [ + { + "column": "col2", + "order": false, + "nulls_order": false, + "operator": "<>", + "is_sort_nulls_applicable": false, + "is_exp": false + }, + { + "column": "(col1+col3)", + "order": false, + "nulls_order": false, + "operator": "<>", + "is_sort_nulls_applicable": false, + "is_exp": true + } + ] + }, + "expected_sql_file": "create_exclusion_constraint_exp.sql", + "expected_msql_file": "exclusion_constraint_exp_msql.sql" } ] } diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/test_indexes.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/test_indexes.json index e6aac2922..a548f5eff 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/test_indexes.json +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/indexes/tests/default/test_indexes.json @@ -20,7 +20,8 @@ "schema": "public" }, "store_object_id": true - }, { + }, + { "type": "create", "name": "Create btree index with ASC and NULLS LAST", "endpoint": "NODE-index.obj", @@ -54,14 +55,16 @@ }, "expected_sql_file": "create_btree_asc_null_last.sql", "expected_msql_file": "create_btree_asc_null_last_msql.sql" - }, { + }, + { "type": "delete", "name": "Drop index", "endpoint": "NODE-index.delete_id", "data": { "name": "Idx_$%{}[]()&*^!@\"'`\\/#" } - }, { + }, + { "type": "create", "name": "Create btree index with ASC and NULLS FIRST", "endpoint": "NODE-index.obj", @@ -95,14 +98,16 @@ }, "expected_sql_file": "create_btree_asc_null_first.sql", "expected_msql_file": "create_btree_asc_null_first_msql.sql" - }, { + }, + { "type": "delete", "name": "Drop index", "endpoint": "NODE-index.delete_id", "data": { "name": "Idx_$%{}[]()&*^!@\"'`\\/#" } - }, { + }, + { "type": "create", "name": "Create btree index with DESC and NULLS LAST", "endpoint": "NODE-index.obj", @@ -136,14 +141,16 @@ }, "expected_sql_file": "create_btree_desc_null_last.sql", "expected_msql_file": "create_btree_desc_null_last_msql.sql" - }, { + }, + { "type": "delete", "name": "Drop index", "endpoint": "NODE-index.delete_id", "data": { "name": "Idx_$%{}[]()&*^!@\"'`\\/#" } - }, { + }, + { "type": "create", "name": "Create btree index with DESC and NULLS FIRST", "endpoint": "NODE-index.obj", @@ -174,7 +181,8 @@ }, "expected_sql_file": "create_btree_desc_null_first.sql", "expected_msql_file": "create_btree_desc_null_first_msql.sql" - }, { + }, + { "type": "alter", "name": "Alter index name, fill factor, comment and clustered", "endpoint": "NODE-index.obj_id", @@ -201,14 +209,16 @@ }, "expected_sql_file": "alter_reset_fillfactor_cluster.sql", "expected_msql_file": "alter_reset_fillfactor_cluster_msql.sql" - }, { + }, + { "type": "delete", "name": "Drop index", "endpoint": "NODE-index.delete_id", "data": { "name": "Idx1_$%{}[]()&*^!@\"'`\\/#" } - }, { + }, + { "type": "create", "name": "Create hash index", "endpoint": "NODE-index.obj", @@ -232,14 +242,16 @@ }, "expected_sql_file": "create_hash_index.sql", "expected_msql_file": "create_hash_index_msql.sql" - }, { + }, + { "type": "delete", "name": "Drop hash index", "endpoint": "NODE-index.delete_id", "data": { "name": "Idx_$%{}[]()&*^!@\"'`\\/#" } - }, { + }, + { "type": "delete", "name": "Drop Table", "endpoint": "NODE-table.delete_id", diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_delete_policy_with_using.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_delete_policy_with_using.sql new file mode 100644 index 000000000..71bd2b585 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_delete_policy_with_using.sql @@ -0,0 +1,10 @@ +-- POLICY: test_delete_rls_policy_$%{}[]()&*^!@"'`\/# + +-- DROP POLICY "test_delete_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy; + +CREATE POLICY "test_delete_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + AS RESTRICTIVE + FOR DELETE + TO public + USING ((salary < '1000000000000'::bigint)); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_delete_policy_with_using_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_delete_policy_with_using_msql.sql new file mode 100644 index 000000000..6aaa35aa4 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_delete_policy_with_using_msql.sql @@ -0,0 +1,2 @@ +ALTER POLICY "test_delete_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy + USING (salary < 1000000000000); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_select_policy.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_select_policy.sql new file mode 100644 index 000000000..6e8d8f22d --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_select_policy.sql @@ -0,0 +1,10 @@ +-- POLICY: test_select_policy_rls_$%{}[]()&*^!@"'`\/# + +-- DROP POLICY "test_select_policy_rls_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy; + +CREATE POLICY "test_select_policy_rls_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + AS PERMISSIVE + FOR SELECT + TO public + USING ((name = (CURRENT_USER)::text)); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_select_policy_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_select_policy_msql.sql new file mode 100644 index 000000000..038fb0843 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_select_policy_msql.sql @@ -0,0 +1,2 @@ +ALTER POLICY "test_select_policy_rls_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy + USING (name = current_user); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_simple_all_policy.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_simple_all_policy.sql new file mode 100644 index 000000000..a8c3bce65 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_simple_all_policy.sql @@ -0,0 +1,11 @@ +-- POLICY: test_all_rls_policy_$%{}[]()&*^!@"'`\/# + +-- DROP POLICY "test_all_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy; + +CREATE POLICY "test_all_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + AS RESTRICTIVE + FOR ALL + TO public + USING (true) + WITH CHECK (true); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_simple_all_policy_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_simple_all_policy_msql.sql new file mode 100644 index 000000000..53f404cbd --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_simple_all_policy_msql.sql @@ -0,0 +1,5 @@ +ALTER POLICY "test_all_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy + USING (true); + +ALTER POLICY "test_all_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy + WITH CHECK (true); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_simple_insert_policy.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_simple_insert_policy.sql new file mode 100644 index 000000000..6176d08dc --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_simple_insert_policy.sql @@ -0,0 +1,10 @@ +-- POLICY: test_simple_insert_rls_policy_$%{}[]()&*^!@"'`\/# + +-- DROP POLICY "test_simple_insert_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy; + +CREATE POLICY "test_simple_insert_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + AS PERMISSIVE + FOR INSERT + TO public + WITH CHECK (((CURRENT_USER)::text = name)); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_simple_insert_policy_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_simple_insert_policy_msql.sql new file mode 100644 index 000000000..9b292234e --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_simple_insert_policy_msql.sql @@ -0,0 +1,2 @@ +ALTER POLICY "test_simple_insert_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy + WITH CHECK (current_user = name); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_update_policy_with_check_and_using.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_update_policy_with_check_and_using.sql new file mode 100644 index 000000000..4f10bae5d --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_update_policy_with_check_and_using.sql @@ -0,0 +1,11 @@ +-- POLICY: test_update_rls_policy_$%{}[]()&*^!@"'`\/# + +-- DROP POLICY "test_update_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy; + +CREATE POLICY "test_update_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + AS RESTRICTIVE + FOR UPDATE + TO public + USING (((CURRENT_USER)::text = name)) + WITH CHECK ((emp_id <> 0)); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_update_policy_with_check_and_using_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_update_policy_with_check_and_using_msql.sql new file mode 100644 index 000000000..e278b94da --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/alter_update_policy_with_check_and_using_msql.sql @@ -0,0 +1,5 @@ +ALTER POLICY "test_update_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy + USING (current_user=name); + +ALTER POLICY "test_update_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy + WITH CHECK (emp_id != 0); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_delete_policy_with_using.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_delete_policy_with_using.sql new file mode 100644 index 000000000..da2d81e02 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_delete_policy_with_using.sql @@ -0,0 +1,10 @@ +-- POLICY: test_delete_rls_policy_$%{}[]()&*^!@"'`\/# + +-- DROP POLICY "test_delete_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy; + +CREATE POLICY "test_delete_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + AS RESTRICTIVE + FOR DELETE + TO public + USING (((CURRENT_USER)::text = name)); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_delete_policy_with_using_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_delete_policy_with_using_msql.sql new file mode 100644 index 000000000..fbacba3b6 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_delete_policy_with_using_msql.sql @@ -0,0 +1,6 @@ +CREATE POLICY "test_delete_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + AS RESTRICTIVE + FOR DELETE + TO public + USING (current_user = name); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_insert_policy.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_insert_policy.sql deleted file mode 100644 index 2e00347f9..000000000 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_insert_policy.sql +++ /dev/null @@ -1,9 +0,0 @@ --- POLICY: insert_policy - --- DROP POLICY insert_policy ON public.test_rls_policy; - -CREATE POLICY insert_policy - ON public.test_rls_policy - AS PERMISSIVE - FOR INSERT - TO public; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_select_policy.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_select_policy.sql index 06fb52b0a..2d2f7e275 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_select_policy.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_select_policy.sql @@ -1,8 +1,8 @@ --- POLICY: select_policy +-- POLICY: test_select_policy_rls_$%{}[]()&*^!@"'`\/# --- DROP POLICY select_policy ON public.test_rls_policy; +-- DROP POLICY "test_select_policy_rls_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy; -CREATE POLICY select_policy +CREATE POLICY "test_select_policy_rls_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy AS PERMISSIVE FOR SELECT diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_select_policy_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_select_policy_msql.sql new file mode 100644 index 000000000..a76d0818c --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_select_policy_msql.sql @@ -0,0 +1,5 @@ +CREATE POLICY "test_select_policy_rls_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + AS PERMISSIVE + FOR SELECT + TO public; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_simple_all_policy.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_simple_all_policy.sql new file mode 100644 index 000000000..be647dfcb --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_simple_all_policy.sql @@ -0,0 +1,9 @@ +-- POLICY: test_all_rls_policy_$%{}[]()&*^!@"'`\/# + +-- DROP POLICY "test_all_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy; + +CREATE POLICY "test_all_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + AS RESTRICTIVE + FOR ALL + TO public; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_simple_all_policy_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_simple_all_policy_msql.sql new file mode 100644 index 000000000..e0d2f6d7e --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_simple_all_policy_msql.sql @@ -0,0 +1,5 @@ +CREATE POLICY "test_all_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + AS RESTRICTIVE + FOR ALL + TO public; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_simple_insert_policy.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_simple_insert_policy.sql new file mode 100644 index 000000000..99d856869 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_simple_insert_policy.sql @@ -0,0 +1,9 @@ +-- POLICY: test_simple_insert_rls_policy_$%{}[]()&*^!@"'`\/# + +-- DROP POLICY "test_simple_insert_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy; + +CREATE POLICY "test_simple_insert_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + AS PERMISSIVE + FOR INSERT + TO public; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_simple_insert_policy_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_simple_insert_policy_msql.sql new file mode 100644 index 000000000..ad1986a82 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_simple_insert_policy_msql.sql @@ -0,0 +1,5 @@ +CREATE POLICY "test_simple_insert_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + AS PERMISSIVE + FOR INSERT + TO public; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_update_policy_with_check_and_using.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_update_policy_with_check_and_using.sql new file mode 100644 index 000000000..c850b0ba2 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_update_policy_with_check_and_using.sql @@ -0,0 +1,11 @@ +-- POLICY: test_update_rls_policy_$%{}[]()&*^!@"'`\/# + +-- DROP POLICY "test_update_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy; + +CREATE POLICY "test_update_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + AS RESTRICTIVE + FOR UPDATE + TO public + USING (true) + WITH CHECK ((name <> NULL::text)); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_update_policy_with_check_and_using_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_update_policy_with_check_and_using_msql.sql new file mode 100644 index 000000000..02fca09a0 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/create_update_policy_with_check_and_using_msql.sql @@ -0,0 +1,7 @@ +CREATE POLICY "test_update_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + AS RESTRICTIVE + FOR UPDATE + TO public + USING (true) + WITH CHECK (name != null); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/test.json index 02455a8a6..fff033ad2 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/test.json +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/10_plus/test.json @@ -30,29 +30,199 @@ }, { "type": "create", - "name": "Create select RLS policy", + "name": "Create simple select event RLS policy", "endpoint": "NODE-row_security_policy.obj", "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql", "data": { - "name": "select_policy", + "name": "test_select_policy_rls_$%{}[]()&*^!@\"'`\\/#", "event": "SELECT", "policyowner": "public", + "schema": "public", + "type": "PERMISSIVE" + }, + "expected_sql_file": "create_select_policy.sql", + "expected_msql_file": "create_select_policy_msql.sql" + }, + { + "type": "alter", + "name": "Alter simple select event RLS policy with using clause", + "endpoint": "NODE-row_security_policy.obj_id", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql_id", + "data": { + "name": "test_select_policy_rls_$%{}[]()&*^!@\"'`\\/#", + "using": "name = current_user", "schema": "public" }, - "expected_sql_file": "create_select_policy.sql" + "expected_sql_file": "alter_select_policy.sql", + "expected_msql_file": "alter_select_policy_msql.sql" + }, + { + "type": "delete", + "name": "Drop policy", + "endpoint": "NODE-row_security_policy.delete_id", + "data": { + "name": "test_select_rls_policy_$%{}[]()&*^!@\"'`\\/#" + } }, { "type": "create", - "name": "Create INSERT RLS policy", + "name": "Create simple insert event RLS policy", "endpoint": "NODE-row_security_policy.obj", "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql", "data": { - "name": "insert_policy", - "event": "INSERT", + "name": "test_simple_insert_rls_policy_$%{}[]()&*^!@\"'`\\/#", "policyowner": "public", + "event": "INSERT", + "withcheck": "", + "type": "PERMISSIVE", "schema": "public" }, - "expected_sql_file": "create_insert_policy.sql" + "expected_sql_file": "create_simple_insert_policy.sql", + "expected_msql_file": "create_simple_insert_policy_msql.sql" + }, + { + "type": "alter", + "name": "Alter simple insert event RLS policy by adding check", + "endpoint": "NODE-row_security_policy.obj_id", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql_id", + "data": { + "name": "test_simple_insert_rls_policy_$%{}[]()&*^!@\"'`\\/#", + "withcheck": "current_user = name", + "schema": "public" + }, + "expected_sql_file": "alter_simple_insert_policy.sql", + "expected_msql_file": "alter_simple_insert_policy_msql.sql" + }, + { + "type": "delete", + "name": "Drop policy", + "endpoint": "NODE-row_security_policy.delete_id", + "data": { + "name": "test_simple_insert_rls_policy_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create update event restrictive RLS policy with check and using clause", + "endpoint": "NODE-row_security_policy.obj", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql", + "data": { + "name": "test_update_rls_policy_$%{}[]()&*^!@\"'`\\/#", + "policyowner": "public", + "event": "UPDATE", + "using": "true", + "withcheck": "name != null", + "type": "RESTRICTIVE", + "schema": "public" + }, + "expected_sql_file": "create_update_policy_with_check_and_using.sql", + "expected_msql_file": "create_update_policy_with_check_and_using_msql.sql" + }, + { + "type": "alter", + "name": "Alter update event restrictive RLS policy with check and using clause", + "endpoint": "NODE-row_security_policy.obj_id", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql_id", + "data": { + "name": "test_update_rls_policy_$%{}[]()&*^!@\"'`\\/#", + "withcheck": "emp_id != 0", + "using": "current_user=name" + }, + "expected_sql_file": "alter_update_policy_with_check_and_using.sql", + "expected_msql_file": "alter_update_policy_with_check_and_using_msql.sql" + }, + { + "type": "delete", + "name": "Drop policy", + "endpoint": "NODE-row_security_policy.delete_id", + "data": { + "name": "test_update_rls_policy_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create delete event restrictive RLS policy with check", + "endpoint": "NODE-row_security_policy.obj", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql", + "data": { + "name": "test_delete_rls_policy_$%{}[]()&*^!@\"'`\\/#", + "policyowner": "public", + "event": "DELETE", + "using": "current_user = name", + "withcheck": "", + "type": "RESTRICTIVE", + "schema": "public" + }, + "expected_sql_file": "create_delete_policy_with_using.sql", + "expected_msql_file": "create_delete_policy_with_using_msql.sql" + }, + { + "type": "alter", + "name": "Alter delete event restrictive RLS policy by changing check clause", + "endpoint": "NODE-row_security_policy.obj_id", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql_id", + "data": { + "name": "test_delete_rls_policy_$%{}[]()&*^!@\"'`\\/#", + "using": "salary < 1000000000000", + "schema": "public" + }, + "expected_sql_file": "alter_delete_policy_with_using.sql", + "expected_msql_file": "alter_delete_policy_with_using_msql.sql" + }, + { + "type": "delete", + "name": "Drop policy", + "endpoint": "NODE-row_security_policy.delete_id", + "data": { + "name": "test_delete_rls_policy_update_name_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create simple all event restrictive RLS policy", + "endpoint": "NODE-row_security_policy.obj", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql", + "data": { + "name": "test_all_rls_policy_$%{}[]()&*^!@\"'`\\/#", + "policyowner": "public", + "event": "ALL", + "type": "RESTRICTIVE", + "schema": "public" + }, + "expected_sql_file": "create_simple_all_policy.sql", + "expected_msql_file": "create_simple_all_policy_msql.sql" + }, + { + "type": "alter", + "name": "Alter simple all event restrictive RLS policy with using & check clause", + "endpoint": "NODE-row_security_policy.obj_id", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql_id", + "data": { + "name": "test_all_rls_policy_$%{}[]()&*^!@\"'`\\/#", + "using": "true", + "withcheck": "true", + "schema": "public" + }, + "expected_sql_file": "alter_simple_all_policy.sql", + "expected_msql_file": "alter_simple_all_policy_msql.sql" + }, + { + "type": "delete", + "name": "Drop policy", + "endpoint": "NODE-row_security_policy.delete_id", + "data": { + "name": "test_all_rls_policy_$%{}[]()&*^!@\"'`\\/#" + } }, { "type": "create", @@ -89,7 +259,7 @@ "schema": "public", "using": "true", "withcheck": "true", - "type":"RESTRICTIVE" + "type": "RESTRICTIVE" }, "expected_sql_file": "create_all_event_policy.sql" }, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/12_plus/alter_select_policy.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/12_plus/alter_select_policy.sql new file mode 100644 index 000000000..8d3163125 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/12_plus/alter_select_policy.sql @@ -0,0 +1,10 @@ +-- POLICY: test_select_policy_rls_$%{}[]()&*^!@"'`\/# + +-- DROP POLICY "test_select_policy_rls_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy; + +CREATE POLICY "test_select_policy_rls_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + AS PERMISSIVE + FOR SELECT + TO public + USING ((name = CURRENT_USER)); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/12_plus/alter_simple_insert_policy.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/12_plus/alter_simple_insert_policy.sql new file mode 100644 index 000000000..07ddc1bb0 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/12_plus/alter_simple_insert_policy.sql @@ -0,0 +1,10 @@ +-- POLICY: test_simple_insert_rls_policy_$%{}[]()&*^!@"'`\/# + +-- DROP POLICY "test_simple_insert_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy; + +CREATE POLICY "test_simple_insert_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + AS PERMISSIVE + FOR INSERT + TO public + WITH CHECK ((CURRENT_USER = name)); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/12_plus/alter_update_policy_with_check_and_using.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/12_plus/alter_update_policy_with_check_and_using.sql new file mode 100644 index 000000000..3ee498102 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/12_plus/alter_update_policy_with_check_and_using.sql @@ -0,0 +1,11 @@ +-- POLICY: test_update_rls_policy_$%{}[]()&*^!@"'`\/# + +-- DROP POLICY "test_update_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy; + +CREATE POLICY "test_update_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + AS RESTRICTIVE + FOR UPDATE + TO public + USING ((CURRENT_USER = name)) + WITH CHECK ((emp_id <> 0)); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/12_plus/create_delete_policy_with_using.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/12_plus/create_delete_policy_with_using.sql new file mode 100644 index 000000000..cdbe5872f --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/12_plus/create_delete_policy_with_using.sql @@ -0,0 +1,10 @@ +-- POLICY: test_delete_rls_policy_$%{}[]()&*^!@"'`\/# + +-- DROP POLICY "test_delete_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy; + +CREATE POLICY "test_delete_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + AS RESTRICTIVE + FOR DELETE + TO public + USING ((CURRENT_USER = name)); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/12_plus/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/12_plus/test.json new file mode 100644 index 000000000..fff033ad2 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/12_plus/test.json @@ -0,0 +1,275 @@ +{ + "scenarios": [ + { + "type": "create", + "name": "Create Table For RLS policy", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "test_rls_policy", + "columns": [ + { + "name": "emp_id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "text" + }, + { + "name": "salary", + "cltype": "bigint" + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create simple select event RLS policy", + "endpoint": "NODE-row_security_policy.obj", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql", + "data": { + "name": "test_select_policy_rls_$%{}[]()&*^!@\"'`\\/#", + "event": "SELECT", + "policyowner": "public", + "schema": "public", + "type": "PERMISSIVE" + }, + "expected_sql_file": "create_select_policy.sql", + "expected_msql_file": "create_select_policy_msql.sql" + }, + { + "type": "alter", + "name": "Alter simple select event RLS policy with using clause", + "endpoint": "NODE-row_security_policy.obj_id", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql_id", + "data": { + "name": "test_select_policy_rls_$%{}[]()&*^!@\"'`\\/#", + "using": "name = current_user", + "schema": "public" + }, + "expected_sql_file": "alter_select_policy.sql", + "expected_msql_file": "alter_select_policy_msql.sql" + }, + { + "type": "delete", + "name": "Drop policy", + "endpoint": "NODE-row_security_policy.delete_id", + "data": { + "name": "test_select_rls_policy_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create simple insert event RLS policy", + "endpoint": "NODE-row_security_policy.obj", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql", + "data": { + "name": "test_simple_insert_rls_policy_$%{}[]()&*^!@\"'`\\/#", + "policyowner": "public", + "event": "INSERT", + "withcheck": "", + "type": "PERMISSIVE", + "schema": "public" + }, + "expected_sql_file": "create_simple_insert_policy.sql", + "expected_msql_file": "create_simple_insert_policy_msql.sql" + }, + { + "type": "alter", + "name": "Alter simple insert event RLS policy by adding check", + "endpoint": "NODE-row_security_policy.obj_id", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql_id", + "data": { + "name": "test_simple_insert_rls_policy_$%{}[]()&*^!@\"'`\\/#", + "withcheck": "current_user = name", + "schema": "public" + }, + "expected_sql_file": "alter_simple_insert_policy.sql", + "expected_msql_file": "alter_simple_insert_policy_msql.sql" + }, + { + "type": "delete", + "name": "Drop policy", + "endpoint": "NODE-row_security_policy.delete_id", + "data": { + "name": "test_simple_insert_rls_policy_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create update event restrictive RLS policy with check and using clause", + "endpoint": "NODE-row_security_policy.obj", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql", + "data": { + "name": "test_update_rls_policy_$%{}[]()&*^!@\"'`\\/#", + "policyowner": "public", + "event": "UPDATE", + "using": "true", + "withcheck": "name != null", + "type": "RESTRICTIVE", + "schema": "public" + }, + "expected_sql_file": "create_update_policy_with_check_and_using.sql", + "expected_msql_file": "create_update_policy_with_check_and_using_msql.sql" + }, + { + "type": "alter", + "name": "Alter update event restrictive RLS policy with check and using clause", + "endpoint": "NODE-row_security_policy.obj_id", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql_id", + "data": { + "name": "test_update_rls_policy_$%{}[]()&*^!@\"'`\\/#", + "withcheck": "emp_id != 0", + "using": "current_user=name" + }, + "expected_sql_file": "alter_update_policy_with_check_and_using.sql", + "expected_msql_file": "alter_update_policy_with_check_and_using_msql.sql" + }, + { + "type": "delete", + "name": "Drop policy", + "endpoint": "NODE-row_security_policy.delete_id", + "data": { + "name": "test_update_rls_policy_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create delete event restrictive RLS policy with check", + "endpoint": "NODE-row_security_policy.obj", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql", + "data": { + "name": "test_delete_rls_policy_$%{}[]()&*^!@\"'`\\/#", + "policyowner": "public", + "event": "DELETE", + "using": "current_user = name", + "withcheck": "", + "type": "RESTRICTIVE", + "schema": "public" + }, + "expected_sql_file": "create_delete_policy_with_using.sql", + "expected_msql_file": "create_delete_policy_with_using_msql.sql" + }, + { + "type": "alter", + "name": "Alter delete event restrictive RLS policy by changing check clause", + "endpoint": "NODE-row_security_policy.obj_id", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql_id", + "data": { + "name": "test_delete_rls_policy_$%{}[]()&*^!@\"'`\\/#", + "using": "salary < 1000000000000", + "schema": "public" + }, + "expected_sql_file": "alter_delete_policy_with_using.sql", + "expected_msql_file": "alter_delete_policy_with_using_msql.sql" + }, + { + "type": "delete", + "name": "Drop policy", + "endpoint": "NODE-row_security_policy.delete_id", + "data": { + "name": "test_delete_rls_policy_update_name_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create simple all event restrictive RLS policy", + "endpoint": "NODE-row_security_policy.obj", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql", + "data": { + "name": "test_all_rls_policy_$%{}[]()&*^!@\"'`\\/#", + "policyowner": "public", + "event": "ALL", + "type": "RESTRICTIVE", + "schema": "public" + }, + "expected_sql_file": "create_simple_all_policy.sql", + "expected_msql_file": "create_simple_all_policy_msql.sql" + }, + { + "type": "alter", + "name": "Alter simple all event restrictive RLS policy with using & check clause", + "endpoint": "NODE-row_security_policy.obj_id", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql_id", + "data": { + "name": "test_all_rls_policy_$%{}[]()&*^!@\"'`\\/#", + "using": "true", + "withcheck": "true", + "schema": "public" + }, + "expected_sql_file": "alter_simple_all_policy.sql", + "expected_msql_file": "alter_simple_all_policy_msql.sql" + }, + { + "type": "delete", + "name": "Drop policy", + "endpoint": "NODE-row_security_policy.delete_id", + "data": { + "name": "test_all_rls_policy_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create RLS policy", + "endpoint": "NODE-row_security_policy.obj", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "data": { + "name": "test", + "schema": "public" + }, + "expected_sql_file": "create_public_policy.sql" + }, + { + "type": "alter", + "name": "Alter policy name", + "endpoint": "NODE-row_security_policy.obj_id", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql_id", + "data": { + "name": "policy_1" + }, + "expected_sql_file": "alter_policy.sql", + "expected_msql_file": "alter_policy_msql.sql" + }, + { + "type": "create", + "name": "Create RLS policy for event 'ALL'", + "endpoint": "NODE-row_security_policy.obj", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "data": { + "name": "all_event_policy", + "event": "ALL", + "policyowner": "public", + "schema": "public", + "using": "true", + "withcheck": "true", + "type": "RESTRICTIVE" + }, + "expected_sql_file": "create_all_event_policy.sql" + }, + { + "type": "delete", + "name": "Drop policy", + "endpoint": "NODE-row_security_policy.delete_id", + "data": { + "name": "test_delete_policy_$%{}[]()&*^!@\"'`\\/#" + } + } + ] +} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_delete_policy_with_using.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_delete_policy_with_using.sql new file mode 100644 index 000000000..7ec042fa2 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_delete_policy_with_using.sql @@ -0,0 +1,9 @@ +-- POLICY: test_delete_rls_policy_$%{}[]()&*^!@"'`\/# + +-- DROP POLICY "test_delete_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy; + +CREATE POLICY "test_delete_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + FOR DELETE + TO public + USING ((salary < '1000000000000'::bigint)); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_delete_policy_with_using_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_delete_policy_with_using_msql.sql new file mode 100644 index 000000000..6aaa35aa4 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_delete_policy_with_using_msql.sql @@ -0,0 +1,2 @@ +ALTER POLICY "test_delete_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy + USING (salary < 1000000000000); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_insert_policy_with_check.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_insert_policy_with_check.sql new file mode 100644 index 000000000..7b8f6911b --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_insert_policy_with_check.sql @@ -0,0 +1,9 @@ +-- POLICY: test_insert_rls_policy_update_name_$%{}[]()&*^!@"'`\/# + +-- DROP POLICY "test_insert_rls_policy_update_name_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy; + +CREATE POLICY "test_insert_rls_policy_update_name_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + FOR INSERT + TO public + WITH CHECK (((salary <> 0) AND (salary < 100000))); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_insert_policy_with_check_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_insert_policy_with_check_msql.sql new file mode 100644 index 000000000..fccf8d326 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_insert_policy_with_check_msql.sql @@ -0,0 +1,5 @@ +ALTER POLICY "test_insert_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy + WITH CHECK ((salary <> 0) AND (salary < 100000)); + +ALTER POLICY "test_insert_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy + RENAME TO "test_insert_rls_policy_update_name_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_policy.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_policy.sql deleted file mode 100644 index 948053081..000000000 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_policy.sql +++ /dev/null @@ -1,9 +0,0 @@ --- POLICY: policy_1 - --- DROP POLICY policy_1 ON public.test_rls_policy; - -CREATE POLICY policy_1 - ON public.test_rls_policy - FOR ALL - TO public; - diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_policy_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_policy_msql.sql deleted file mode 100644 index ae36ebff1..000000000 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_policy_msql.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER POLICY test ON public.test_rls_policy - RENAME TO policy_1; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_select_policy.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_select_policy.sql new file mode 100644 index 000000000..72eb94176 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_select_policy.sql @@ -0,0 +1,9 @@ +-- POLICY: test_select_policy_rls_$%{}[]()&*^!@"'`\/# + +-- DROP POLICY "test_select_policy_rls_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy; + +CREATE POLICY "test_select_policy_rls_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + FOR SELECT + TO public + USING ((name = ("current_user"())::text)); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_select_policy_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_select_policy_msql.sql new file mode 100644 index 000000000..038fb0843 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_select_policy_msql.sql @@ -0,0 +1,2 @@ +ALTER POLICY "test_select_policy_rls_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy + USING (name = current_user); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_simple_all_policy.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_simple_all_policy.sql new file mode 100644 index 000000000..76748970e --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_simple_all_policy.sql @@ -0,0 +1,10 @@ +-- POLICY: test_all_rls_policy_$%{}[]()&*^!@"'`\/# + +-- DROP POLICY "test_all_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy; + +CREATE POLICY "test_all_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + FOR ALL + TO public + USING (true) + WITH CHECK (true); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_simple_all_policy_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_simple_all_policy_msql.sql new file mode 100644 index 000000000..53f404cbd --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_simple_all_policy_msql.sql @@ -0,0 +1,5 @@ +ALTER POLICY "test_all_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy + USING (true); + +ALTER POLICY "test_all_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy + WITH CHECK (true); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_simple_insert_policy.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_simple_insert_policy.sql new file mode 100644 index 000000000..49ebd5d55 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_simple_insert_policy.sql @@ -0,0 +1,9 @@ +-- POLICY: test_simple_insert_rls_policy_$%{}[]()&*^!@"'`\/# + +-- DROP POLICY "test_simple_insert_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy; + +CREATE POLICY "test_simple_insert_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + FOR INSERT + TO public + WITH CHECK ((("current_user"())::text = name)); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_simple_insert_policy_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_simple_insert_policy_msql.sql new file mode 100644 index 000000000..9b292234e --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_simple_insert_policy_msql.sql @@ -0,0 +1,2 @@ +ALTER POLICY "test_simple_insert_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy + WITH CHECK (current_user = name); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_update_policy_with_check_and_using.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_update_policy_with_check_and_using.sql new file mode 100644 index 000000000..b7db9e25e --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_update_policy_with_check_and_using.sql @@ -0,0 +1,10 @@ +-- POLICY: test_update_rls_policy_$%{}[]()&*^!@"'`\/# + +-- DROP POLICY "test_update_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy; + +CREATE POLICY "test_update_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + FOR UPDATE + TO public + USING ((("current_user"())::text = name)) + WITH CHECK ((emp_id <> 0)); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_update_policy_with_check_and_using_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_update_policy_with_check_and_using_msql.sql new file mode 100644 index 000000000..e278b94da --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/alter_update_policy_with_check_and_using_msql.sql @@ -0,0 +1,5 @@ +ALTER POLICY "test_update_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy + USING (current_user=name); + +ALTER POLICY "test_update_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy + WITH CHECK (emp_id != 0); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_all_event_policy.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_all_event_policy.sql deleted file mode 100644 index 42e442c19..000000000 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_all_event_policy.sql +++ /dev/null @@ -1,11 +0,0 @@ --- POLICY: all_event_policy - --- DROP POLICY all_event_policy ON public.test_rls_policy; - -CREATE POLICY all_event_policy - ON public.test_rls_policy - FOR ALL - TO public - USING (true) - WITH CHECK (true); - diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_delete_policy_with_using.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_delete_policy_with_using.sql new file mode 100644 index 000000000..088e460d3 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_delete_policy_with_using.sql @@ -0,0 +1,9 @@ +-- POLICY: test_delete_rls_policy_$%{}[]()&*^!@"'`\/# + +-- DROP POLICY "test_delete_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy; + +CREATE POLICY "test_delete_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + FOR DELETE + TO public + USING ((("current_user"())::text = name)); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_delete_policy_with_using_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_delete_policy_with_using_msql.sql new file mode 100644 index 000000000..1bf68d73c --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_delete_policy_with_using_msql.sql @@ -0,0 +1,5 @@ +CREATE POLICY "test_delete_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + FOR DELETE + TO public + USING (current_user = name); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_insert_policy.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_insert_policy.sql deleted file mode 100644 index 4e370b6e1..000000000 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_insert_policy.sql +++ /dev/null @@ -1,9 +0,0 @@ --- POLICY: insert_policy - --- DROP POLICY insert_policy ON public.test_rls_policy; - -CREATE POLICY insert_policy - ON public.test_rls_policy - FOR INSERT - TO public; - diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_insert_policy_with_check.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_insert_policy_with_check.sql new file mode 100644 index 000000000..ff51b77e7 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_insert_policy_with_check.sql @@ -0,0 +1,9 @@ +-- POLICY: test_insert_rls_policy_$%{}[]()&*^!@"'`\/# + +-- DROP POLICY "test_insert_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy; + +CREATE POLICY "test_insert_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + FOR INSERT + TO public + WITH CHECK (((salary <> 0) AND (salary > 0))); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_insert_policy_with_check_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_insert_policy_with_check_msql.sql new file mode 100644 index 000000000..d92bbac2f --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_insert_policy_with_check_msql.sql @@ -0,0 +1,5 @@ +CREATE POLICY "test_insert_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + FOR INSERT + TO public + WITH CHECK (salary != 0 and salary > 0); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_public_policy.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_public_policy.sql deleted file mode 100644 index 9c8ef1efb..000000000 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_public_policy.sql +++ /dev/null @@ -1,9 +0,0 @@ --- POLICY: test - --- DROP POLICY test ON public.test_rls_policy; - -CREATE POLICY test - ON public.test_rls_policy - FOR ALL - TO public; - diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_select_policy.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_select_policy.sql index 0cd97bee2..abc9328d4 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_select_policy.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_select_policy.sql @@ -1,9 +1,8 @@ --- POLICY: select_policy +-- POLICY: test_select_policy_rls_$%{}[]()&*^!@"'`\/# --- DROP POLICY select_policy ON public.test_rls_policy; +-- DROP POLICY "test_select_policy_rls_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy; -CREATE POLICY select_policy +CREATE POLICY "test_select_policy_rls_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy FOR SELECT TO public; - diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_select_policy_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_select_policy_msql.sql new file mode 100644 index 000000000..7829ec2cf --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_select_policy_msql.sql @@ -0,0 +1,4 @@ +CREATE POLICY "test_select_policy_rls_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + FOR SELECT + TO public; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_simple_all_policy.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_simple_all_policy.sql new file mode 100644 index 000000000..2d468e4bf --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_simple_all_policy.sql @@ -0,0 +1,8 @@ +-- POLICY: test_all_rls_policy_$%{}[]()&*^!@"'`\/# + +-- DROP POLICY "test_all_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy; + +CREATE POLICY "test_all_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + FOR ALL + TO public; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_simple_all_policy_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_simple_all_policy_msql.sql new file mode 100644 index 000000000..b2f11a390 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_simple_all_policy_msql.sql @@ -0,0 +1,4 @@ +CREATE POLICY "test_all_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + FOR ALL + TO public; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_simple_insert_policy.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_simple_insert_policy.sql new file mode 100644 index 000000000..8187596c2 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_simple_insert_policy.sql @@ -0,0 +1,8 @@ +-- POLICY: test_simple_insert_rls_policy_$%{}[]()&*^!@"'`\/# + +-- DROP POLICY "test_simple_insert_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy; + +CREATE POLICY "test_simple_insert_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + FOR INSERT + TO public; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_simple_insert_policy_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_simple_insert_policy_msql.sql new file mode 100644 index 000000000..6d3bb919c --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_simple_insert_policy_msql.sql @@ -0,0 +1,4 @@ +CREATE POLICY "test_simple_insert_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + FOR INSERT + TO public; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_update_policy_with_check_and_using.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_update_policy_with_check_and_using.sql new file mode 100644 index 000000000..4e1281cc1 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_update_policy_with_check_and_using.sql @@ -0,0 +1,10 @@ +-- POLICY: test_update_rls_policy_$%{}[]()&*^!@"'`\/# + +-- DROP POLICY "test_update_rls_policy_$%{}[]()&*^!@""'`\/#" ON public.test_rls_policy; + +CREATE POLICY "test_update_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + FOR UPDATE + TO public + USING (true) + WITH CHECK ((name <> NULL::text)); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_update_policy_with_check_and_using_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_update_policy_with_check_and_using_msql.sql new file mode 100644 index 000000000..0070865fa --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/create_update_policy_with_check_and_using_msql.sql @@ -0,0 +1,6 @@ +CREATE POLICY "test_update_rls_policy_$%{}[]()&*^!@""'`\/#" + ON public.test_rls_policy + FOR UPDATE + TO public + USING (true) + WITH CHECK (name != null); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/test.json index 02455a8a6..b7162b0a8 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/test.json +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/tests/default/test.json @@ -30,75 +30,197 @@ }, { "type": "create", - "name": "Create select RLS policy", + "name": "Create simple select event RLS policy", "endpoint": "NODE-row_security_policy.obj", "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql", "data": { - "name": "select_policy", + "name": "test_select_policy_rls_$%{}[]()&*^!@\"'`\\/#", "event": "SELECT", "policyowner": "public", "schema": "public" }, - "expected_sql_file": "create_select_policy.sql" - }, - { - "type": "create", - "name": "Create INSERT RLS policy", - "endpoint": "NODE-row_security_policy.obj", - "sql_endpoint": "NODE-row_security_policy.sql_id", - "data": { - "name": "insert_policy", - "event": "INSERT", - "policyowner": "public", - "schema": "public" - }, - "expected_sql_file": "create_insert_policy.sql" - }, - { - "type": "create", - "name": "Create RLS policy", - "endpoint": "NODE-row_security_policy.obj", - "sql_endpoint": "NODE-row_security_policy.sql_id", - "data": { - "name": "test", - "schema": "public" - }, - "expected_sql_file": "create_public_policy.sql" + "expected_sql_file": "create_select_policy.sql", + "expected_msql_file": "create_select_policy_msql.sql" }, { "type": "alter", - "name": "Alter policy name", + "name": "Alter simple select event RLS policy with using clause", "endpoint": "NODE-row_security_policy.obj_id", "sql_endpoint": "NODE-row_security_policy.sql_id", "msql_endpoint": "NODE-row_security_policy.msql_id", "data": { - "name": "policy_1" + "name": "test_select_policy_rls_$%{}[]()&*^!@\"'`\\/#", + "using": "name = current_user", + "schema": "public" }, - "expected_sql_file": "alter_policy.sql", - "expected_msql_file": "alter_policy_msql.sql" - }, - { - "type": "create", - "name": "Create RLS policy for event 'ALL'", - "endpoint": "NODE-row_security_policy.obj", - "sql_endpoint": "NODE-row_security_policy.sql_id", - "data": { - "name": "all_event_policy", - "event": "ALL", - "policyowner": "public", - "schema": "public", - "using": "true", - "withcheck": "true", - "type":"RESTRICTIVE" - }, - "expected_sql_file": "create_all_event_policy.sql" + "expected_sql_file": "alter_select_policy.sql", + "expected_msql_file": "alter_select_policy_msql.sql" }, { "type": "delete", "name": "Drop policy", "endpoint": "NODE-row_security_policy.delete_id", "data": { - "name": "test_delete_policy_$%{}[]()&*^!@\"'`\\/#" + "name": "test_select_rls_policy_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create simple insert event RLS policy", + "endpoint": "NODE-row_security_policy.obj", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql", + "data": { + "name": "test_simple_insert_rls_policy_$%{}[]()&*^!@\"'`\\/#", + "policyowner": "public", + "event": "INSERT", + "withcheck": "", + "type": "PERMISSIVE", + "schema": "public" + }, + "expected_sql_file": "create_simple_insert_policy.sql", + "expected_msql_file": "create_simple_insert_policy_msql.sql" + }, + { + "type": "alter", + "name": "Alter simple insert event RLS policy by adding check", + "endpoint": "NODE-row_security_policy.obj_id", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql_id", + "data": { + "name": "test_simple_insert_rls_policy_$%{}[]()&*^!@\"'`\\/#", + "withcheck": "current_user = name", + "schema": "public" + }, + "expected_sql_file": "alter_simple_insert_policy.sql", + "expected_msql_file": "alter_simple_insert_policy_msql.sql" + }, + { + "type": "delete", + "name": "Drop policy", + "endpoint": "NODE-row_security_policy.delete_id", + "data": { + "name": "test_simple_insert_rls_policy_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create update event RLS policy with check and using clause", + "endpoint": "NODE-row_security_policy.obj", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql", + "data": { + "name": "test_update_rls_policy_$%{}[]()&*^!@\"'`\\/#", + "policyowner": "public", + "event": "UPDATE", + "using": "true", + "withcheck": "name != null", + "type": "PERMISSIVE", + "schema": "public" + }, + "expected_sql_file": "create_update_policy_with_check_and_using.sql", + "expected_msql_file": "create_update_policy_with_check_and_using_msql.sql" + }, + { + "type": "alter", + "name": "Alter update event RLS policy with check and using clause", + "endpoint": "NODE-row_security_policy.obj_id", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql_id", + "data": { + "name": "test_update_rls_policy_$%{}[]()&*^!@\"'`\\/#", + "withcheck": "emp_id != 0", + "using": "current_user=name" + }, + "expected_sql_file": "alter_update_policy_with_check_and_using.sql", + "expected_msql_file": "alter_update_policy_with_check_and_using_msql.sql" + }, + { + "type": "delete", + "name": "Drop policy", + "endpoint": "NODE-row_security_policy.delete_id", + "data": { + "name": "test_update_rls_policy_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create delete event RLS policy with check", + "endpoint": "NODE-row_security_policy.obj", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql", + "data": { + "name": "test_delete_rls_policy_$%{}[]()&*^!@\"'`\\/#", + "policyowner": "public", + "event": "DELETE", + "using": "current_user = name", + "withcheck": "", + "type": "PERMISSIVE", + "schema": "public" + }, + "expected_sql_file": "create_delete_policy_with_using.sql", + "expected_msql_file": "create_delete_policy_with_using_msql.sql" + }, + { + "type": "alter", + "name": "Alter delete event RLS policy by changing check clause", + "endpoint": "NODE-row_security_policy.obj_id", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql_id", + "data": { + "name": "test_delete_rls_policy_$%{}[]()&*^!@\"'`\\/#", + "using": "salary < 1000000000000", + "schema": "public" + }, + "expected_sql_file": "alter_delete_policy_with_using.sql", + "expected_msql_file": "alter_delete_policy_with_using_msql.sql" + }, + { + "type": "delete", + "name": "Drop policy", + "endpoint": "NODE-row_security_policy.delete_id", + "data": { + "name": "test_delete_rls_policy_update_name_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create simple all event RLS policy", + "endpoint": "NODE-row_security_policy.obj", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql", + "data": { + "name": "test_all_rls_policy_$%{}[]()&*^!@\"'`\\/#", + "policyowner": "public", + "event": "ALL", + "type": "PERMISSIVE", + "schema": "public" + }, + "expected_sql_file": "create_simple_all_policy.sql", + "expected_msql_file": "create_simple_all_policy_msql.sql" + }, + { + "type": "alter", + "name": "Alter simple all event RLS policy with using & check clause", + "endpoint": "NODE-row_security_policy.obj_id", + "sql_endpoint": "NODE-row_security_policy.sql_id", + "msql_endpoint": "NODE-row_security_policy.msql_id", + "data": { + "name": "test_all_rls_policy_$%{}[]()&*^!@\"'`\\/#", + "using": "true", + "withcheck": "true", + "schema": "public" + }, + "expected_sql_file": "alter_simple_all_policy.sql", + "expected_msql_file": "alter_simple_all_policy_msql.sql" + }, + { + "type": "delete", + "name": "Drop policy", + "endpoint": "NODE-row_security_policy.delete_id", + "data": { + "name": "test_all_rls_policy_$%{}[]()&*^!@\"'`\\/#" } } ] diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/test.json index 935f56f8d..81e6cf1ba 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/test.json +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/rules/tests/default/test.json @@ -23,7 +23,8 @@ "spcname": "pg_default" }, "store_object_id": true - }, { + }, + { "type": "create", "name": "Create Rule for insert event", "endpoint": "NODE-rule.obj", @@ -39,7 +40,8 @@ }, "expected_sql_file": "create_insert_event_rule.sql", "expected_msql_file": "create_insert_event_rule_msql.sql" - }, { + }, + { "type": "alter", "name": "Alter Rule for insert event", "endpoint": "NODE-rule.obj_id", @@ -57,7 +59,8 @@ }, "expected_sql_file": "alter_insert_event_rule.sql", "expected_msql_file": "alter_insert_event_rule_msql.sql" - }, { + }, + { "type": "alter", "name": "Alter Rule insert to update event with complex commands", "endpoint": "NODE-rule.obj_id", @@ -68,7 +71,8 @@ }, "expected_sql_file": "alter_insert_event_rule_complex.sql", "expected_msql_file": "alter_insert_event_rule_complex_msql.sql" - }, { + }, + { "type": "alter", "name": "Alter Rule for insert event to statements NOTHING", "endpoint": "NODE-rule.obj_id", @@ -79,7 +83,8 @@ }, "expected_sql_file": "alter_insert_event_rule_nothing.sql", "expected_msql_file": "alter_insert_event_rule_nothing_msql.sql" - }, { + }, + { "type": "alter", "name": "Alter Rule for insert with NOTHING to Update", "endpoint": "NODE-rule.obj_id", @@ -90,14 +95,16 @@ }, "expected_sql_file": "alter_insert_event_rule_nothing_update.sql", "expected_msql_file": "alter_insert_event_rule_nothing_update_msql.sql" - }, { + }, + { "type": "delete", "name": "Drop Rule", "endpoint": "NODE-rule.delete_id", "data": { "name": "test_insert_rule1_$%{}[]()&*^!@\"'`\\/#" } - }, { + }, + { "type": "create", "name": "Create Rule for update event", "endpoint": "NODE-rule.obj", @@ -113,7 +120,8 @@ }, "expected_sql_file": "create_update_event_rule.sql", "expected_msql_file": "create_update_event_rule_msql.sql" - }, { + }, + { "type": "alter", "name": "Alter Rule for update event", "endpoint": "NODE-rule.obj_id", @@ -138,7 +146,8 @@ "data": { "name": "test_update_rule1_$%{}[]()&*^!@\"'`\\/#" } - }, { + }, + { "type": "create", "name": "Create Rule for delete event", "endpoint": "NODE-rule.obj", @@ -152,7 +161,8 @@ }, "expected_sql_file": "create_delete_event_rule.sql", "expected_msql_file": "create_delete_event_rule_msql.sql" - }, { + }, + { "type": "alter", "name": "Alter Rule for delete event", "endpoint": "NODE-rule.obj_id", diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/alter_table_with_toast_table.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/alter_table_with_toast_table.sql new file mode 100644 index 000000000..e0b9cfd3c --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/alter_table_with_toast_table.sql @@ -0,0 +1,33 @@ +-- Table: public.table_with_custom_autovaccum_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" +( + col1 character varying(10)[] COLLATE pg_catalog."default", + col2 date +) +WITH ( + OIDS = FALSE, + toast.autovacuum_enabled = FALSE, + autovacuum_analyze_scale_factor = 0.2, + autovacuum_analyze_threshold = 60, + autovacuum_freeze_max_age = 20000000, + autovacuum_vacuum_cost_delay = 25, + autovacuum_vacuum_cost_limit = 100, + autovacuum_vacuum_scale_factor = 0.3, + autovacuum_vacuum_threshold = 60, + autovacuum_freeze_min_age = 500000, + autovacuum_freeze_table_age = 1300000, + toast.autovacuum_freeze_max_age = 2000000, + toast.autovacuum_vacuum_cost_delay = 50, + toast.autovacuum_vacuum_cost_limit = 13, + toast.autovacuum_vacuum_threshold = 70 +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + IS 'custom auto vacuum'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/alter_table_with_toast_table_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/alter_table_with_toast_table_msql.sql new file mode 100644 index 000000000..f738d3ec8 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/alter_table_with_toast_table_msql.sql @@ -0,0 +1,15 @@ +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" SET ( + autovacuum_analyze_threshold = 60, + autovacuum_vacuum_cost_limit = 100 +); +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" RESET ( + autovacuum_enabled +); + +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" SET ( + toast.autovacuum_enabled = false, + toast.autovacuum_freeze_max_age = 2000000, + toast.autovacuum_vacuum_cost_delay = 50, + toast.autovacuum_vacuum_cost_limit = 13, + toast.autovacuum_vacuum_threshold = 70 +); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_partition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_partition.sql new file mode 100644 index 000000000..601e79796 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_partition.sql @@ -0,0 +1,28 @@ +-- Table: public.table_with_patition_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_patition_$%{}[]()&*^!@""'`\/#" +( + id integer, + status text COLLATE pg_catalog."default", + arr numeric +) PARTITION BY LIST (status) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#" + IS 'partition table'; + +-- Partitions SQL + +CREATE TABLE IF NOT EXISTS public.cust_active PARTITION OF public."table_with_patition_$%{}[]()&*^!@""'`\/#" + FOR VALUES IN ('ACTIVE'); + +ALTER TABLE public.cust_active + OWNER to postgres; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_partition_msql.sql new file mode 100644 index 000000000..a5fb12c7f --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_partition_msql.sql @@ -0,0 +1,18 @@ +CREATE TABLE IF NOT EXISTS public."table_with_patition_$%{}[]()&*^!@""'`\/#" +( + id integer, + status text, + arr numeric +) PARTITION BY LIST (status) +WITH ( + OIDS = FALSE +); + +ALTER TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#" + IS 'partition table'; + +CREATE TABLE IF NOT EXISTS public.cust_active PARTITION OF public."table_with_patition_$%{}[]()&*^!@""'`\/#" + FOR VALUES IN ('ACTIVE'); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_range_partition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_range_partition.sql new file mode 100644 index 000000000..e873317a4 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_range_partition.sql @@ -0,0 +1,25 @@ +-- Table: public.table_with_range_patition_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_range_patition_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_range_patition_$%{}[]()&*^!@""'`\/#" +( + id integer, + status text COLLATE pg_catalog."default", + arr numeric +) PARTITION BY RANGE (arr) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_range_patition_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +-- Partitions SQL + +CREATE TABLE IF NOT EXISTS public."cust_arr_small PARTITION" PARTITION OF public."table_with_range_patition_$%{}[]()&*^!@""'`\/#" + FOR VALUES FROM ('20') TO ('25'); + +ALTER TABLE public."cust_arr_small PARTITION" + OWNER to postgres; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_range_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_range_partition_msql.sql new file mode 100644 index 000000000..9a512427f --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/create_table_with_range_partition_msql.sql @@ -0,0 +1,15 @@ +CREATE TABLE IF NOT EXISTS public."table_with_range_patition_$%{}[]()&*^!@""'`\/#" +( + id integer, + status text, + arr numeric +) PARTITION BY RANGE (arr) +WITH ( + OIDS = FALSE +); + +ALTER TABLE public."table_with_range_patition_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +CREATE TABLE IF NOT EXISTS public."cust_arr_small PARTITION" PARTITION OF public."table_with_range_patition_$%{}[]()&*^!@""'`\/#" + FOR VALUES FROM (20) TO (25); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/test.json new file mode 100644 index 000000000..4ff6931e9 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/10_plus/test.json @@ -0,0 +1,1836 @@ +{ + "scenarios": [ + { + "type": "create", + "name": "Create Table without primary key", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col3", + "cltype": "boolean", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col4", + "cltype": "character varying", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 30, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col5", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": 20, + "attprecision": 10, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col6", + "cltype": "timestamp with time zone", + "attacl": [], + "min_val_attlen": 0, + "max_val_attlen": 6, + "is_primary_key": false, + "attnotnull": false, + "attlen": 5, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_without_primary_key.sql", + "expected_msql_file": "create_table_without_primary_key_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table to change column data types", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "cltype": "bigint" + }, + { + "attnum": 2, + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "cltype": "character varying" + }, + { + "attnum": 6, + "attlen": null, + "cltype": "time without time zone" + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_change_col_data_type.sql", + "expected_msql_file": "alter_table_change_col_data_type_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add pk", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "attnotnull": true, + "is_primary_key": true + } + ] + }, + "primary_key": { + "added": [ + { + "columns": [ + { + "column": "col1" + } + ], + "include": [] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_pk_not_null_constraint.sql", + "expected_msql_file": "alter_table_add_pk_not_null_constraint_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add null constraint, rename column", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "name": "col1_rename", + "is_primary_key": false + }, + { + "attnum": 4, + "attnotnull": true + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_null_constraint_rename_col.sql", + "expected_msql_file": "alter_table_add_null_constraint_rename_col_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table add pk", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with primary key", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [ + { + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "integer", + "attacl": [], + "is_primary_key": true, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "json", + "attacl": [], + "is_primary_key": false, + "attnotnull": true, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_pk.sql", + "expected_msql_file": "create_table_with_pk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add columns", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "columns": { + "added": [ + { + "name": "col3_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": 10, + "attprecision": 5, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col4_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_cols.sql", + "expected_msql_file": "alter_table_add_cols_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table delete columns", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "columns": { + "deleted": [ + { + "attoptions": [], + "attacl": [], + "seclabels": [], + "name": "col2_$%{}[]()&*^!@\\\"'`\\\\/#", + "atttypid": 114, + "attnum": 2, + "cltype": "json", + "collspcname": "", + "description": null, + "edit_types": [ + "json", + "jsonb" + ], + "is_primary_key": false, + "attstattarget": -1, + "attnotnull": true, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attndims": 0, + "atttypmod": -1, + "attstorage": "x", + "defval": null, + "typname": "json", + "displaytypname": "json", + "elemoid": 114, + "typnspname": "pg_catalog", + "defaultstorage": "x", + "indkey": "1", + "isdup": false, + "is_fk": false, + "is_sys_column": false, + "relname": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "is_view_only": false, + "is_pk": false, + "old_attidentity": "a" + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_delete_cols.sql", + "expected_msql_file": "alter_table_delete_cols_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table delete columns", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with pk & check constraint", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "create table comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [ + { + "name": "custom_pk", + "comment": "custom pk created", + "fillfactor": "11", + "condeferrable": true, + "condeferred": true, + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "time with time zone", + "attacl": [], + "min_val_attlen": 0, + "max_val_attlen": 6, + "is_primary_key": false, + "attnotnull": false, + "attlen": 5, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "character", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 12, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [ + { + "name": "chk_const", + "consrc": "col2 != null", + "convalidated": false, + "comment": "chk const comment" + } + ], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_pk_chk.sql", + "expected_msql_file": "create_table_with_pk_chk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add unique constraint", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "unique_constraint": { + "added": [ + { + "name": "unique", + "fillfactor": "13", + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ] + } + }, + "expected_sql_file": "alter_table_add_unique_const.sql", + "expected_msql_file": "alter_table_add_unique_const_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table delete constraints", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "check_constraint": { + "deleted": [ + { + "name": "chk_const", + "consrc": "col2 <> NULL::bpchar", + "connoinherit": false, + "convalidated": false, + "relname": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "nspname": "public", + "comment": "chk const comment", + "conislocal": true + } + ] + }, + "unique_constraint": { + "deleted": [ + { + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"\"'`\\\\/#" + } + ], + "name": "unique", + "comment": null, + "spcname": "pg_default", + "fillfactor": "13", + "condeferrable": false, + "condeferred": false, + "include": [], + "col_count": 1, + "conislocal": true + } + ] + } + }, + "expected_sql_file": "alter_table_delete_constraints.sql", + "expected_msql_file": "alter_table_delete_constraints_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with pk & chk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table for FK reference", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "fk_reference_tbl", + "columns": [ + { + "name": "id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "bigint" + } + ], + "primary_key": [ + { + "columns": [ + { + "column": "id" + } + ], + "include": [] + } + ], + "unique_constraint": [ + { + "name": "", + "columns": [ + { + "column": "name" + } + ], + "include": [] + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create Table with fk constraint", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col3", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [ + { + "name": "fk_test", + "comment": "fk comment", + "condeferrable": true, + "confmatchtype": true, + "columns": [ + { + "local_column": "col1", + "references": "", + "referenced": "id" + } + ], + "confupdtype": "a", + "confdeltype": "a", + "autoindex": false, + "coveringindex": null + } + ], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "create_table_with_fk.sql", + "expected_msql_file": "create_table_with_fk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add one more fk", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "foreign_key": { + "added": [ + { + "name": "fk2", + "columns": [ + { + "local_column": "col2", + "references": "", + "referenced": "name" + } + ], + "confupdtype": "a", + "confdeltype": "a", + "autoindex": false, + "coveringindex": null + } + ] + } + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "alter_table_add_another_fk.sql", + "expected_msql_file": "alter_table_add_another_fk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add exclude constraint", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "exclude_constraint": { + "added": [ + { + "name": "ex_constr", + "amname": "gist", + "columns": [ + { + "column": "col1", + "is_exp": false, + "order": false, + "nulls_order": false, + "operator": "<>", + "is_sort_nulls_applicable": false + } + ], + "include": [] + } + ] + } + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "alter_table_add_exclude_constraint.sql", + "expected_msql_file": "alter_table_add_exclude_constraint_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with fk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with custom auto-vacuum", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "custom auto vacuum", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "t", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "character varying[]", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 10, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "date", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor", + "value": 0.2 + }, + { + "name": "autovacuum_analyze_threshold", + "value": 55 + }, + { + "name": "autovacuum_freeze_max_age", + "value": 20000000 + }, + { + "name": "autovacuum_vacuum_cost_delay", + "value": 25 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 10 + }, + { + "name": "autovacuum_vacuum_scale_factor", + "value": 0.3 + }, + { + "name": "autovacuum_vacuum_threshold", + "value": 60 + }, + { + "name": "autovacuum_freeze_min_age", + "value": 500000 + }, + { + "name": "autovacuum_freeze_table_age", + "value": 1300000 + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "autovacuum_custom": true + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_custom_autovacuum.sql", + "expected_msql_file": "create_table_with_custom_autovacuum_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add toast table", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#", + "autovacuum_enabled": "x", + "toast_autovacuum": true, + "toast_autovacuum_enabled": "f", + "vacuum_table": { + "changed": [ + { + "name": "autovacuum_analyze_threshold", + "value": 60 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 100 + } + ] + }, + "vacuum_toast": { + "changed": [ + { + "name": "autovacuum_freeze_max_age", + "value": 2000000 + }, + { + "name": "autovacuum_vacuum_cost_delay", + "value": 50 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 13 + }, + { + "name": "autovacuum_vacuum_threshold", + "value": 70 + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_with_toast_table.sql", + "expected_msql_file": "alter_table_with_toast_table_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with fk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with advanced options", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "relhasoids": true, + "description": "test comment", + "relpersistence": true, + "fillfactor": "50", + "parallel_workers": "", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "double precision", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "numrange", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": true, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "rlspolicy": true + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_advanced_options.sql", + "expected_msql_file": "create_table_with_advanced_options_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table update grants", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#", + "rlspolicy": false, + "forcerlspolicy": false, + "relacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + } + ] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_update_grants.sql", + "expected_msql_file": "alter_table_update_grants_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with advanced options", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table for like table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "like_tbl", + "columns": [ + { + "name": "id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "text" + } + ], + "primary_key": [ + { + "columns": [ + { + "column": "id" + } + ], + "include": [] + } + ], + "unique_constraint": [ + { + "name": "", + "columns": [ + { + "column": "name" + } + ], + "include": [] + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create Table using like table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "test ", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": true, + "like_constraints": true, + "like_indexes": true, + "like_storage": true, + "like_comments": true, + "like_relation": "public.like_tbl" + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "create_table_with_lik_tbl.sql", + "expected_msql_file": "create_table_with_lik_tbl_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table update grants", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#", + "description": "test comment", + "fillfactor": "13", + "replica_identity": "", + "relacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "D", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "x", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "t", + "privilege": true, + "with_grant": false + } + ] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_update_grants2.sql", + "expected_msql_file": "alter_table_update_grants2_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with advanced options", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with list partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_patition_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "partition table", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_active", + "values_in": "'ACTIVE'", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "list", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "status", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "status" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_partition.sql", + "expected_msql_file": "create_table_with_partition_msql.sql" + }, + { + "type": "create", + "name": "Create Table with range partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_range_patition_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_arr_small PARTITION", + "values_from": "20", + "values_to": "25", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "range", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "status", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "arr" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_range_partition.sql", + "expected_msql_file": "create_table_with_range_partition_msql.sql" + } + ] +} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/alter_table_with_toast_table.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/alter_table_with_toast_table.sql new file mode 100644 index 000000000..e0b9cfd3c --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/alter_table_with_toast_table.sql @@ -0,0 +1,33 @@ +-- Table: public.table_with_custom_autovaccum_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" +( + col1 character varying(10)[] COLLATE pg_catalog."default", + col2 date +) +WITH ( + OIDS = FALSE, + toast.autovacuum_enabled = FALSE, + autovacuum_analyze_scale_factor = 0.2, + autovacuum_analyze_threshold = 60, + autovacuum_freeze_max_age = 20000000, + autovacuum_vacuum_cost_delay = 25, + autovacuum_vacuum_cost_limit = 100, + autovacuum_vacuum_scale_factor = 0.3, + autovacuum_vacuum_threshold = 60, + autovacuum_freeze_min_age = 500000, + autovacuum_freeze_table_age = 1300000, + toast.autovacuum_freeze_max_age = 2000000, + toast.autovacuum_vacuum_cost_delay = 50, + toast.autovacuum_vacuum_cost_limit = 13, + toast.autovacuum_vacuum_threshold = 70 +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + IS 'custom auto vacuum'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/alter_table_with_toast_table_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/alter_table_with_toast_table_msql.sql new file mode 100644 index 000000000..a1a588be7 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/alter_table_with_toast_table_msql.sql @@ -0,0 +1,14 @@ +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" SET ( + autovacuum_analyze_threshold = 60, + autovacuum_vacuum_cost_limit = 100 +); +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" RESET ( + autovacuum_enabled +); +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" SET ( + toast.autovacuum_enabled = false, + toast.autovacuum_freeze_max_age = 2000000, + toast.autovacuum_vacuum_cost_delay = 50, + toast.autovacuum_vacuum_cost_limit = 13, + toast.autovacuum_vacuum_threshold = 70 +); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_table_with_hash_partition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_table_with_hash_partition.sql new file mode 100644 index 000000000..0b562ef15 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_table_with_hash_partition.sql @@ -0,0 +1,28 @@ +-- Table: public.table_with_hash_patition_$%{}[]()&*^!@\"'`\\/# + +-- DROP TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" +( + id bigint, + name text COLLATE pg_catalog."default", + arr numeric +) PARTITION BY HASH (id) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" + IS 'hash partition'; + +-- Partitions SQL + +CREATE TABLE IF NOT EXISTS public.cust_part11 PARTITION OF public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" + FOR VALUES WITH (modulus 2, remainder 1); + +ALTER TABLE public.cust_part11 + OWNER to postgres; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_table_with_hash_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_table_with_hash_partition_msql.sql new file mode 100644 index 000000000..3fdc6da06 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/create_table_with_hash_partition_msql.sql @@ -0,0 +1,18 @@ +CREATE TABLE IF NOT EXISTS public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" +( + id bigint, + name text, + arr numeric +) PARTITION BY HASH (id) +WITH ( + OIDS = FALSE +); + +ALTER TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" + IS 'hash partition'; + +CREATE TABLE IF NOT EXISTS public.cust_part11 PARTITION OF public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" + FOR VALUES WITH (MODULUS 2, REMAINDER 1); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/test.json new file mode 100644 index 000000000..8a4475337 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/11_plus/test.json @@ -0,0 +1,1986 @@ +{ + "scenarios": [ + { + "type": "create", + "name": "Create Table without primary key", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col3", + "cltype": "boolean", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col4", + "cltype": "character varying", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 30, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col5", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": 20, + "attprecision": 10, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col6", + "cltype": "timestamp with time zone", + "attacl": [], + "min_val_attlen": 0, + "max_val_attlen": 6, + "is_primary_key": false, + "attnotnull": false, + "attlen": 5, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_without_primary_key.sql", + "expected_msql_file": "create_table_without_primary_key_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table to change column data types", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "cltype": "bigint" + }, + { + "attnum": 2, + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "cltype": "character varying" + }, + { + "attnum": 6, + "attlen": null, + "cltype": "time without time zone" + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_change_col_data_type.sql", + "expected_msql_file": "alter_table_change_col_data_type_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add pk", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "attnotnull": true, + "is_primary_key": true + } + ] + }, + "primary_key": { + "added": [ + { + "columns": [ + { + "column": "col1" + } + ], + "include": [] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_pk_not_null_constraint.sql", + "expected_msql_file": "alter_table_add_pk_not_null_constraint_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add null constraint, rename column", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "name": "col1_rename", + "is_primary_key": false + }, + { + "attnum": 4, + "attnotnull": true + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_null_constraint_rename_col.sql", + "expected_msql_file": "alter_table_add_null_constraint_rename_col_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table add pk", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with primary key", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [ + { + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "integer", + "attacl": [], + "is_primary_key": true, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "json", + "attacl": [], + "is_primary_key": false, + "attnotnull": true, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_pk.sql", + "expected_msql_file": "create_table_with_pk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add columns", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "columns": { + "added": [ + { + "name": "col3_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": 10, + "attprecision": 5, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col4_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_cols.sql", + "expected_msql_file": "alter_table_add_cols_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table delete columns", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "columns": { + "deleted": [ + { + "attoptions": [], + "attacl": [], + "seclabels": [], + "name": "col2_$%{}[]()&*^!@\\\"'`\\\\/#", + "atttypid": 114, + "attnum": 2, + "cltype": "json", + "collspcname": "", + "description": null, + "edit_types": [ + "json", + "jsonb" + ], + "is_primary_key": false, + "attstattarget": -1, + "attnotnull": true, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attndims": 0, + "atttypmod": -1, + "attstorage": "x", + "defval": null, + "typname": "json", + "displaytypname": "json", + "elemoid": 114, + "typnspname": "pg_catalog", + "defaultstorage": "x", + "indkey": "1", + "isdup": false, + "is_fk": false, + "is_sys_column": false, + "relname": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "is_view_only": false, + "is_pk": false, + "old_attidentity": "a" + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_delete_cols.sql", + "expected_msql_file": "alter_table_delete_cols_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table delete columns", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with pk & check constraint", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "create table comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [ + { + "name": "custom_pk", + "comment": "custom pk created", + "fillfactor": "11", + "condeferrable": true, + "condeferred": true, + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "time with time zone", + "attacl": [], + "min_val_attlen": 0, + "max_val_attlen": 6, + "is_primary_key": false, + "attnotnull": false, + "attlen": 5, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "character", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 12, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [ + { + "name": "chk_const", + "consrc": "col2 != null", + "convalidated": false, + "comment": "chk const comment" + } + ], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_pk_chk.sql", + "expected_msql_file": "create_table_with_pk_chk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add unique constraint", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "unique_constraint": { + "added": [ + { + "name": "unique", + "fillfactor": "13", + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ] + } + }, + "expected_sql_file": "alter_table_add_unique_const.sql", + "expected_msql_file": "alter_table_add_unique_const_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table delete constraints", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "check_constraint": { + "deleted": [ + { + "name": "chk_const", + "consrc": "col2 <> NULL::bpchar", + "connoinherit": false, + "convalidated": false, + "relname": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "nspname": "public", + "comment": "chk const comment", + "conislocal": true + } + ] + }, + "unique_constraint": { + "deleted": [ + { + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"\"'`\\\\/#" + } + ], + "name": "unique", + "comment": null, + "spcname": "pg_default", + "fillfactor": "13", + "condeferrable": false, + "condeferred": false, + "include": [], + "col_count": 1, + "conislocal": true + } + ] + } + }, + "expected_sql_file": "alter_table_delete_constraints.sql", + "expected_msql_file": "alter_table_delete_constraints_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with pk & chk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table for FK reference", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "fk_reference_tbl", + "columns": [ + { + "name": "id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "bigint" + } + ], + "primary_key": [ + { + "columns": [ + { + "column": "id" + } + ], + "include": [] + } + ], + "unique_constraint": [ + { + "name": "", + "columns": [ + { + "column": "name" + } + ], + "include": [] + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create Table with fk constraint", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col3", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [ + { + "name": "fk_test", + "comment": "fk comment", + "condeferrable": true, + "confmatchtype": true, + "columns": [ + { + "local_column": "col1", + "references": "", + "referenced": "id" + } + ], + "confupdtype": "a", + "confdeltype": "a", + "autoindex": false, + "coveringindex": null + } + ], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "create_table_with_fk.sql", + "expected_msql_file": "create_table_with_fk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add one more fk", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "foreign_key": { + "added": [ + { + "name": "fk2", + "columns": [ + { + "local_column": "col2", + "references": "", + "referenced": "name" + } + ], + "confupdtype": "a", + "confdeltype": "a", + "autoindex": false, + "coveringindex": null + } + ] + } + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "alter_table_add_another_fk.sql", + "expected_msql_file": "alter_table_add_another_fk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add exclude constraint", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "exclude_constraint": { + "added": [ + { + "name": "ex_constr", + "amname": "gist", + "columns": [ + { + "column": "col1", + "is_exp": false, + "order": false, + "nulls_order": false, + "operator": "<>", + "is_sort_nulls_applicable": false + } + ], + "include": [] + } + ] + } + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "alter_table_add_exclude_constraint.sql", + "expected_msql_file": "alter_table_add_exclude_constraint_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with fk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with custom auto-vacuum", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "custom auto vacuum", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "t", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "character varying[]", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 10, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "date", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor", + "value": 0.2 + }, + { + "name": "autovacuum_analyze_threshold", + "value": 55 + }, + { + "name": "autovacuum_freeze_max_age", + "value": 20000000 + }, + { + "name": "autovacuum_vacuum_cost_delay", + "value": 25 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 10 + }, + { + "name": "autovacuum_vacuum_scale_factor", + "value": 0.3 + }, + { + "name": "autovacuum_vacuum_threshold", + "value": 60 + }, + { + "name": "autovacuum_freeze_min_age", + "value": 500000 + }, + { + "name": "autovacuum_freeze_table_age", + "value": 1300000 + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "autovacuum_custom": true + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_custom_autovacuum.sql", + "expected_msql_file": "create_table_with_custom_autovacuum_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add toast table", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#", + "autovacuum_enabled": "x", + "toast_autovacuum": true, + "toast_autovacuum_enabled": "f", + "vacuum_table": { + "changed": [ + { + "name": "autovacuum_analyze_threshold", + "value": 60 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 100 + } + ] + }, + "vacuum_toast": { + "changed": [ + { + "name": "autovacuum_freeze_max_age", + "value": 2000000 + }, + { + "name": "autovacuum_vacuum_cost_delay", + "value": 50 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 13 + }, + { + "name": "autovacuum_vacuum_threshold", + "value": 70 + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_with_toast_table.sql", + "expected_msql_file": "alter_table_with_toast_table_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with fk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with advanced options", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "relhasoids": true, + "description": "test comment", + "relpersistence": true, + "fillfactor": "50", + "parallel_workers": "", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "double precision", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "numrange", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": true, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "rlspolicy": true + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_advanced_options.sql", + "expected_msql_file": "create_table_with_advanced_options_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table update grants", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#", + "rlspolicy": false, + "forcerlspolicy": false, + "relacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + } + ] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_update_grants.sql", + "expected_msql_file": "alter_table_update_grants_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with advanced options", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table for like table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "like_tbl", + "columns": [ + { + "name": "id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "text" + } + ], + "primary_key": [ + { + "columns": [ + { + "column": "id" + } + ], + "include": [] + } + ], + "unique_constraint": [ + { + "name": "", + "columns": [ + { + "column": "name" + } + ], + "include": [] + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create Table using like table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "test ", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": true, + "like_constraints": true, + "like_indexes": true, + "like_storage": true, + "like_comments": true, + "like_relation": "public.like_tbl" + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "create_table_with_lik_tbl.sql", + "expected_msql_file": "create_table_with_lik_tbl_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table update grants", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#", + "description": "test comment", + "fillfactor": "13", + "replica_identity": "", + "relacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "D", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "x", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "t", + "privilege": true, + "with_grant": false + } + ] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_update_grants2.sql", + "expected_msql_file": "alter_table_update_grants2_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with advanced options", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with list partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_patition_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "partition table", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_active", + "values_in": "'ACTIVE'", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "list", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "status", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "status" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_partition.sql", + "expected_msql_file": "create_table_with_partition_msql.sql" + }, + { + "type": "create", + "name": "Create Table with range partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_range_patition_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_arr_small PARTITION", + "values_from": "20", + "values_to": "25", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "range", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "status", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "arr" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_range_partition.sql", + "expected_msql_file": "create_table_with_range_partition_msql.sql" + }, + { + "type": "create", + "name": "Create Table with hash partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_hash_patition_$%{}[]()&*^!@\\\"'`\\\\/#", + "relowner": "postgres", + "relacl": [], + "description": "hash partition", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_part11", + "values_modulus": "2", + "values_remainder": "1", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "hash", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "name", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "id" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_hash_partition.sql", + "expected_msql_file": "create_table_with_hash_partition_msql.sql" + } + ] +} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_another_fk.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_another_fk.sql new file mode 100644 index 000000000..42d22f4ad --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_another_fk.sql @@ -0,0 +1,31 @@ +-- Table: public.table_with_fk_constraints$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" +( + col1 integer, + col2 bigint, + col3 text COLLATE pg_catalog."default", + CONSTRAINT fk2 FOREIGN KEY (col2) + REFERENCES public.fk_reference_tbl (name) MATCH SIMPLE + ON UPDATE NO ACTION + ON DELETE NO ACTION + NOT VALID, + CONSTRAINT fk_test FOREIGN KEY (col1) + REFERENCES public.fk_reference_tbl (id) MATCH FULL + ON UPDATE NO ACTION + ON DELETE NO ACTION + DEFERRABLE +) + +TABLESPACE pg_default; + +ALTER TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'test comment'; + +COMMENT ON CONSTRAINT fk_test ON public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'fk comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_another_fk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_another_fk_msql.sql new file mode 100644 index 000000000..bdcbfcb62 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_another_fk_msql.sql @@ -0,0 +1,6 @@ +ALTER TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT fk2 FOREIGN KEY (col2) + REFERENCES public.fk_reference_tbl (name) + ON UPDATE NO ACTION + ON DELETE NO ACTION + NOT VALID; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_cols.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_cols.sql new file mode 100644 index 000000000..cf4aa6043 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_cols.sql @@ -0,0 +1,20 @@ +-- Table: public.simple_table_with_pk$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" integer NOT NULL, + "col2_$%{}[]()&*^!@\""'`\\/#" json NOT NULL, + "col3_$%{}[]()&*^!@\""'`\\/#" numeric(10,5), + "col4_$%{}[]()&*^!@\""'`\\/#" text COLLATE pg_catalog."default", + CONSTRAINT "simple_table_with_pk$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY ("col1_$%{}[]()&*^!@\""""'`\\/#") +) + +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_cols_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_cols_msql.sql new file mode 100644 index 000000000..776060df2 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_cols_msql.sql @@ -0,0 +1,5 @@ +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + ADD COLUMN "col3_$%{}[]()&*^!@\""'`\\/#" numeric(10, 5); + +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + ADD COLUMN "col4_$%{}[]()&*^!@\""'`\\/#" text; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_exclude_constraint.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_exclude_constraint.sql new file mode 100644 index 000000000..b9af2ccce --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_exclude_constraint.sql @@ -0,0 +1,34 @@ +-- Table: public.table_with_fk_constraints$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" +( + col1 integer, + col2 bigint, + col3 text COLLATE pg_catalog."default", + CONSTRAINT fk2 FOREIGN KEY (col2) + REFERENCES public.fk_reference_tbl (name) MATCH SIMPLE + ON UPDATE NO ACTION + ON DELETE NO ACTION + NOT VALID, + CONSTRAINT fk_test FOREIGN KEY (col1) + REFERENCES public.fk_reference_tbl (id) MATCH FULL + ON UPDATE NO ACTION + ON DELETE NO ACTION + DEFERRABLE, + CONSTRAINT ex_constr EXCLUDE USING gist ( + col1 WITH <>) + +) + +TABLESPACE pg_default; + +ALTER TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'test comment'; + +COMMENT ON CONSTRAINT fk_test ON public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'fk comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_exclude_constraint_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_exclude_constraint_msql.sql new file mode 100644 index 000000000..3a027c684 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_exclude_constraint_msql.sql @@ -0,0 +1,3 @@ +ALTER TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT ex_constr EXCLUDE USING gist ( + col1 WITH <>); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_null_constraint_rename_col.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_null_constraint_rename_col.sql new file mode 100644 index 000000000..5031c5a00 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_null_constraint_rename_col.sql @@ -0,0 +1,22 @@ +-- Table: public.simple_table_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_$%{}[]()&*^!@""'`\/#" +( + col1_rename bigint NOT NULL, + col2 character varying COLLATE pg_catalog."default", + col3 boolean, + col4 character varying(30) COLLATE pg_catalog."default" NOT NULL, + col5 numeric(20,10), + col6 time(5) without time zone, + CONSTRAINT "simple_table_$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY (col1_rename) +) + +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_null_constraint_rename_col_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_null_constraint_rename_col_msql.sql new file mode 100644 index 000000000..bf6a926cb --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_null_constraint_rename_col_msql.sql @@ -0,0 +1,5 @@ +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + RENAME col1 TO col1_rename; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN col4 SET NOT NULL; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_partition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_partition.sql new file mode 100644 index 000000000..02547e7a2 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_partition.sql @@ -0,0 +1,34 @@ +-- Table: public.table_with_patition_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_patition_$%{}[]()&*^!@""'`\/#" +( + id integer, + status text COLLATE pg_catalog."default", + arr numeric +) PARTITION BY LIST (status); + +ALTER TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#" + IS 'partition table'; + +-- Partitions SQL + +CREATE TABLE IF NOT EXISTS public.cust_active PARTITION OF public."table_with_patition_$%{}[]()&*^!@""'`\/#" + FOR VALUES IN ('ACTIVE'); + +ALTER TABLE public.cust_active + OWNER to postgres; +CREATE TABLE IF NOT EXISTS public.cust_active PARTITION OF public."table_with_patition_$%{}[]()&*^!@""'`\/#" + FOR VALUES IN ('ACTIVE'); + +ALTER TABLE public.cust_active + OWNER to postgres; +CREATE TABLE IF NOT EXISTS public.cust_archived PARTITION OF public."table_with_patition_$%{}[]()&*^!@""'`\/#" + FOR VALUES IN ('EXPIRED'); + +ALTER TABLE public.cust_archived + OWNER to postgres; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_pk_not_null_constraint.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_pk_not_null_constraint.sql new file mode 100644 index 000000000..594c1a5e4 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_pk_not_null_constraint.sql @@ -0,0 +1,22 @@ +-- Table: public.simple_table_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_$%{}[]()&*^!@""'`\/#" +( + col1 bigint NOT NULL, + col2 character varying COLLATE pg_catalog."default", + col3 boolean, + col4 character varying(30) COLLATE pg_catalog."default", + col5 numeric(20,10), + col6 time(5) without time zone, + CONSTRAINT "simple_table_$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY (col1) +) + +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_pk_not_null_constraint_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_pk_not_null_constraint_msql.sql new file mode 100644 index 000000000..628422d72 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_pk_not_null_constraint_msql.sql @@ -0,0 +1,4 @@ +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN col1 SET NOT NULL; +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + ADD PRIMARY KEY (col1); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_unique_const.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_unique_const.sql new file mode 100644 index 000000000..f89442368 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_unique_const.sql @@ -0,0 +1,28 @@ +-- Table: public.table_with_pk_chk_constraints$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" time(5) with time zone NOT NULL, + col2 character(12) COLLATE pg_catalog."default", + CONSTRAINT custom_pk PRIMARY KEY ("col1_$%{}[]()&*^!@\""""'`\\/#") + WITH (FILLFACTOR=11) + DEFERRABLE INITIALLY DEFERRED, + CONSTRAINT "unique" UNIQUE ("col1_$%{}[]()&*^!@\""""'`\\/#") + WITH (FILLFACTOR=13), + CONSTRAINT chk_const CHECK (col2 <> NULL::bpchar) +) + +TABLESPACE pg_default; + +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'create table comment'; +COMMENT ON CONSTRAINT custom_pk ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'custom pk created'; + +COMMENT ON CONSTRAINT chk_const ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'chk const comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_unique_const_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_unique_const_msql.sql new file mode 100644 index 000000000..d5ade04d6 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_add_unique_const_msql.sql @@ -0,0 +1,3 @@ +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT "unique" UNIQUE ("col1_$%{}[]()&*^!@\""'`\\/#") + WITH (FILLFACTOR=13); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_change_col_data_type.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_change_col_data_type.sql new file mode 100644 index 000000000..b9497c6f9 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_change_col_data_type.sql @@ -0,0 +1,21 @@ +-- Table: public.simple_table_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_$%{}[]()&*^!@""'`\/#" +( + col1 bigint, + col2 character varying COLLATE pg_catalog."default", + col3 boolean, + col4 character varying(30) COLLATE pg_catalog."default", + col5 numeric(20,10), + col6 time(5) without time zone +) + +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_change_col_data_type_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_change_col_data_type_msql.sql new file mode 100644 index 000000000..290f24244 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_change_col_data_type_msql.sql @@ -0,0 +1,8 @@ +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN col1 TYPE bigint; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN col2 TYPE character varying COLLATE pg_catalog."default"; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN col6 TYPE time(5) without time zone ; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_delete_cols.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_delete_cols.sql new file mode 100644 index 000000000..f6870cd57 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_delete_cols.sql @@ -0,0 +1,19 @@ +-- Table: public.simple_table_with_pk$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" integer NOT NULL, + "col3_$%{}[]()&*^!@\""'`\\/#" numeric(10,5), + "col4_$%{}[]()&*^!@\""'`\\/#" text COLLATE pg_catalog."default", + CONSTRAINT "simple_table_with_pk$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY ("col1_$%{}[]()&*^!@\""""'`\\/#") +) + +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_delete_cols_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_delete_cols_msql.sql new file mode 100644 index 000000000..673ff675b --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_delete_cols_msql.sql @@ -0,0 +1 @@ +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" DROP COLUMN "col2_$%{}[]()&*^!@\""'`\\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_delete_constraints.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_delete_constraints.sql new file mode 100644 index 000000000..bc80c6e74 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_delete_constraints.sql @@ -0,0 +1,22 @@ +-- Table: public.table_with_pk_chk_constraints$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" time(5) with time zone NOT NULL, + col2 character(12) COLLATE pg_catalog."default", + CONSTRAINT custom_pk PRIMARY KEY ("col1_$%{}[]()&*^!@\""""'`\\/#") + WITH (FILLFACTOR=11) + DEFERRABLE INITIALLY DEFERRED +) + +TABLESPACE pg_default; + +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'create table comment'; +COMMENT ON CONSTRAINT custom_pk ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'custom pk created'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_delete_constraints_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_delete_constraints_msql.sql new file mode 100644 index 000000000..47a3cf8db --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_delete_constraints_msql.sql @@ -0,0 +1,2 @@ +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" DROP CONSTRAINT "unique"; +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" DROP CONSTRAINT chk_const; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_update_grants.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_update_grants.sql new file mode 100644 index 000000000..10d5abe88 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_update_grants.sql @@ -0,0 +1,24 @@ +-- Table: public.table_with_advanced_options_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#"; + +CREATE UNLOGGED TABLE IF NOT EXISTS public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" +( + col1 double precision, + col2 numrange +) + +WITH ( + FILLFACTOR = 50 +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +GRANT ALL ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" TO postgres; + +GRANT SELECT ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" TO PUBLIC; + +COMMENT ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_update_grants2.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_update_grants2.sql new file mode 100644 index 000000000..2b9d8f89f --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_update_grants2.sql @@ -0,0 +1,26 @@ +-- Table: public.table_like_tbl$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_like_tbl$%{}[]()&*^!@""'`\/#" +( + id integer NOT NULL, + name text COLLATE pg_catalog."default", + CONSTRAINT "table_like_tbl$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY (id), + CONSTRAINT "table_like_tbl$%{}[]()&*^!@""'`\/#_name_key" UNIQUE (name) +) + +WITH ( + FILLFACTOR = 13 +) +TABLESPACE pg_default; + +ALTER TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +GRANT ALL ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" TO postgres; + +GRANT REFERENCES, TRIGGER, TRUNCATE ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" TO PUBLIC; + +COMMENT ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_update_grants2_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_update_grants2_msql.sql new file mode 100644 index 000000000..0213d64fa --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_update_grants2_msql.sql @@ -0,0 +1,7 @@ +ALTER TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + SET (FILLFACTOR=13); + +COMMENT ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + IS 'test comment'; + +GRANT TRUNCATE, REFERENCES, TRIGGER ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" TO PUBLIC; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_update_grants_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_update_grants_msql.sql new file mode 100644 index 000000000..363195b79 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_update_grants_msql.sql @@ -0,0 +1,7 @@ +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + DISABLE ROW LEVEL SECURITY; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + NO FORCE ROW LEVEL SECURITY; + +GRANT SELECT ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" TO PUBLIC; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_with_toast_table.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_with_toast_table.sql new file mode 100644 index 000000000..8ce89cc1f --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_with_toast_table.sql @@ -0,0 +1,33 @@ +-- Table: public.table_with_custom_autovaccum_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" +( + col1 character varying(10)[] COLLATE pg_catalog."default", + col2 date +) + +WITH ( + toast.autovacuum_enabled = FALSE, + autovacuum_analyze_scale_factor = 0.2, + autovacuum_analyze_threshold = 60, + autovacuum_freeze_max_age = 20000000, + autovacuum_vacuum_cost_delay = 25, + autovacuum_vacuum_cost_limit = 100, + autovacuum_vacuum_scale_factor = 0.3, + autovacuum_vacuum_threshold = 60, + autovacuum_freeze_min_age = 500000, + autovacuum_freeze_table_age = 1300000, + toast.autovacuum_freeze_max_age = 2000000, + toast.autovacuum_vacuum_cost_delay = 50, + toast.autovacuum_vacuum_cost_limit = 13, + toast.autovacuum_vacuum_threshold = 70 +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + IS 'custom auto vacuum'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_with_toast_table_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_with_toast_table_msql.sql new file mode 100644 index 000000000..a1a588be7 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/alter_table_with_toast_table_msql.sql @@ -0,0 +1,14 @@ +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" SET ( + autovacuum_analyze_threshold = 60, + autovacuum_vacuum_cost_limit = 100 +); +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" RESET ( + autovacuum_enabled +); +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" SET ( + toast.autovacuum_enabled = false, + toast.autovacuum_freeze_max_age = 2000000, + toast.autovacuum_vacuum_cost_delay = 50, + toast.autovacuum_vacuum_cost_limit = 13, + toast.autovacuum_vacuum_threshold = 70 +); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_advanced_options.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_advanced_options.sql new file mode 100644 index 000000000..88afb68f1 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_advanced_options.sql @@ -0,0 +1,26 @@ +-- Table: public.table_with_advanced_options_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#"; + +CREATE UNLOGGED TABLE IF NOT EXISTS public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" +( + col1 double precision, + col2 numrange +) + +WITH ( + FILLFACTOR = 50 +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + ENABLE ROW LEVEL SECURITY; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + FORCE ROW LEVEL SECURITY; + +COMMENT ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_advanced_options_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_advanced_options_msql.sql new file mode 100644 index 000000000..b78ca959a --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_advanced_options_msql.sql @@ -0,0 +1,21 @@ +CREATE UNLOGGED TABLE IF NOT EXISTS public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" +( + col1 double precision, + col2 numrange +) + +WITH ( + FILLFACTOR = 50 +); + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + ENABLE ROW LEVEL SECURITY; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + FORCE ROW LEVEL SECURITY; + +COMMENT ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_custom_autovacuum.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_custom_autovacuum.sql new file mode 100644 index 000000000..5af0c41e0 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_custom_autovacuum.sql @@ -0,0 +1,29 @@ +-- Table: public.table_with_custom_autovaccum_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" +( + col1 character varying(10)[] COLLATE pg_catalog."default", + col2 date +) + +WITH ( + autovacuum_enabled = TRUE, + autovacuum_analyze_scale_factor = 0.2, + autovacuum_analyze_threshold = 55, + autovacuum_freeze_max_age = 20000000, + autovacuum_vacuum_cost_delay = 25, + autovacuum_vacuum_cost_limit = 10, + autovacuum_vacuum_scale_factor = 0.3, + autovacuum_vacuum_threshold = 60, + autovacuum_freeze_min_age = 500000, + autovacuum_freeze_table_age = 1300000 +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + IS 'custom auto vacuum'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_custom_autovacuum_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_custom_autovacuum_msql.sql new file mode 100644 index 000000000..0a8f1c451 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_custom_autovacuum_msql.sql @@ -0,0 +1,24 @@ +CREATE TABLE IF NOT EXISTS public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" +( + col1 character varying(10)[], + col2 date +) + +WITH ( + autovacuum_enabled = TRUE, + autovacuum_analyze_scale_factor = 0.2, + autovacuum_analyze_threshold = 55, + autovacuum_freeze_max_age = 20000000, + autovacuum_vacuum_cost_delay = 25, + autovacuum_vacuum_cost_limit = 10, + autovacuum_vacuum_scale_factor = 0.3, + autovacuum_vacuum_threshold = 60, + autovacuum_freeze_min_age = 500000, + autovacuum_freeze_table_age = 1300000 +); + +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + IS 'custom auto vacuum'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_fk.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_fk.sql new file mode 100644 index 000000000..08f7379b1 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_fk.sql @@ -0,0 +1,26 @@ +-- Table: public.table_with_fk_constraints$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" +( + col1 integer, + col2 bigint, + col3 text COLLATE pg_catalog."default", + CONSTRAINT fk_test FOREIGN KEY (col1) + REFERENCES public.fk_reference_tbl (id) MATCH FULL + ON UPDATE NO ACTION + ON DELETE NO ACTION + DEFERRABLE +) + +TABLESPACE pg_default; + +ALTER TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'test comment'; + +COMMENT ON CONSTRAINT fk_test ON public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'fk comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_fk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_fk_msql.sql new file mode 100644 index 000000000..291171321 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_fk_msql.sql @@ -0,0 +1,21 @@ +CREATE TABLE IF NOT EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" +( + col1 integer, + col2 bigint, + col3 text, + CONSTRAINT fk_test FOREIGN KEY (col1) + REFERENCES public.fk_reference_tbl (id) MATCH FULL + ON UPDATE NO ACTION + ON DELETE NO ACTION + DEFERRABLE + NOT VALID +); + +ALTER TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'test comment'; + +COMMENT ON CONSTRAINT fk_test ON public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'fk comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_hash_partition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_hash_partition.sql new file mode 100644 index 000000000..0fba3df76 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_hash_partition.sql @@ -0,0 +1,24 @@ +-- Table: public.table_with_hash_patition_$%{}[]()&*^!@\"'`\\/# + +-- DROP TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" +( + id bigint, + name text COLLATE pg_catalog."default", + arr numeric +) PARTITION BY HASH (id); + +ALTER TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" + IS 'hash partition'; + +-- Partitions SQL + +CREATE TABLE IF NOT EXISTS public.cust_part11 PARTITION OF public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" + FOR VALUES WITH (modulus 2, remainder 1); + +ALTER TABLE public.cust_part11 + OWNER to postgres; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_hash_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_hash_partition_msql.sql new file mode 100644 index 000000000..2f9ea03f4 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_hash_partition_msql.sql @@ -0,0 +1,15 @@ +CREATE TABLE IF NOT EXISTS public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" +( + id bigint, + name text, + arr numeric +) PARTITION BY HASH (id); + +ALTER TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" + IS 'hash partition'; + +CREATE TABLE IF NOT EXISTS public.cust_part11 PARTITION OF public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" + FOR VALUES WITH (MODULUS 2, REMAINDER 1); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_lik_tbl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_lik_tbl.sql new file mode 100644 index 000000000..04be033f7 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_lik_tbl.sql @@ -0,0 +1,19 @@ +-- Table: public.table_like_tbl$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_like_tbl$%{}[]()&*^!@""'`\/#" +( + id integer NOT NULL, + name text COLLATE pg_catalog."default", + CONSTRAINT "table_like_tbl$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY (id), + CONSTRAINT "table_like_tbl$%{}[]()&*^!@""'`\/#_name_key" UNIQUE (name) +) + +TABLESPACE pg_default; + +ALTER TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + IS 'test '; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_lik_tbl_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_lik_tbl_msql.sql new file mode 100644 index 000000000..b29e2e126 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_lik_tbl_msql.sql @@ -0,0 +1,16 @@ +CREATE TABLE IF NOT EXISTS public."table_like_tbl$%{}[]()&*^!@""'`\/#" +( + LIKE public.like_tbl + INCLUDING DEFAULTS + INCLUDING CONSTRAINTS + INCLUDING INDEXES + INCLUDING STORAGE + INCLUDING COMMENTS + +); + +ALTER TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + IS 'test '; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_partition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_partition.sql new file mode 100644 index 000000000..635c79bcf --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_partition.sql @@ -0,0 +1,24 @@ +-- Table: public.table_with_patition_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_patition_$%{}[]()&*^!@""'`\/#" +( + id integer, + status text COLLATE pg_catalog."default", + arr numeric +) PARTITION BY LIST (status); + +ALTER TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#" + IS 'partition table'; + +-- Partitions SQL + +CREATE TABLE IF NOT EXISTS public.cust_active PARTITION OF public."table_with_patition_$%{}[]()&*^!@""'`\/#" + FOR VALUES IN ('ACTIVE'); + +ALTER TABLE public.cust_active + OWNER to postgres; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_partition_msql.sql new file mode 100644 index 000000000..0b25e4d16 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_partition_msql.sql @@ -0,0 +1,15 @@ +CREATE TABLE IF NOT EXISTS public."table_with_patition_$%{}[]()&*^!@""'`\/#" +( + id integer, + status text, + arr numeric +) PARTITION BY LIST (status); + +ALTER TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#" + IS 'partition table'; + +CREATE TABLE IF NOT EXISTS public.cust_active PARTITION OF public."table_with_patition_$%{}[]()&*^!@""'`\/#" + FOR VALUES IN ('ACTIVE'); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_pk.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_pk.sql new file mode 100644 index 000000000..d560b4d3d --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_pk.sql @@ -0,0 +1,18 @@ +-- Table: public.simple_table_with_pk$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" integer NOT NULL, + "col2_$%{}[]()&*^!@\""'`\\/#" json NOT NULL, + CONSTRAINT "simple_table_with_pk$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY ("col1_$%{}[]()&*^!@\""""'`\\/#") +) + +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_pk_chk.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_pk_chk.sql new file mode 100644 index 000000000..c89a49661 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_pk_chk.sql @@ -0,0 +1,26 @@ +-- Table: public.table_with_pk_chk_constraints$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" time(5) with time zone NOT NULL, + col2 character(12) COLLATE pg_catalog."default", + CONSTRAINT custom_pk PRIMARY KEY ("col1_$%{}[]()&*^!@\""""'`\\/#") + WITH (FILLFACTOR=11) + DEFERRABLE INITIALLY DEFERRED, + CONSTRAINT chk_const CHECK (col2 <> NULL::bpchar) +) + +TABLESPACE pg_default; + +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'create table comment'; +COMMENT ON CONSTRAINT custom_pk ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'custom pk created'; + +COMMENT ON CONSTRAINT chk_const ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'chk const comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_pk_chk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_pk_chk_msql.sql new file mode 100644 index 000000000..89729a0cd --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_pk_chk_msql.sql @@ -0,0 +1,20 @@ +CREATE TABLE IF NOT EXISTS public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" time(5) with time zone, + col2 character(12), + CONSTRAINT custom_pk PRIMARY KEY ("col1_$%{}[]()&*^!@\""'`\\/#") + WITH (FILLFACTOR=11) + DEFERRABLE INITIALLY DEFERRED, + CONSTRAINT chk_const CHECK (col2 != null) +); + +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'create table comment'; +COMMENT ON CONSTRAINT custom_pk ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'custom pk created'; + +COMMENT ON CONSTRAINT chk_const ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'chk const comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_pk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_pk_msql.sql new file mode 100644 index 000000000..3b417adec --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_pk_msql.sql @@ -0,0 +1,12 @@ +CREATE TABLE IF NOT EXISTS public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" integer, + "col2_$%{}[]()&*^!@\""'`\\/#" json NOT NULL, + PRIMARY KEY ("col1_$%{}[]()&*^!@\""'`\\/#") +); + +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_range_partition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_range_partition.sql new file mode 100644 index 000000000..cf98bd3fb --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_range_partition.sql @@ -0,0 +1,21 @@ +-- Table: public.table_with_range_patition_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_range_patition_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_range_patition_$%{}[]()&*^!@""'`\/#" +( + id integer, + status text COLLATE pg_catalog."default", + arr numeric +) PARTITION BY RANGE (arr); + +ALTER TABLE public."table_with_range_patition_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +-- Partitions SQL + +CREATE TABLE IF NOT EXISTS public."cust_arr_small PARTITION" PARTITION OF public."table_with_range_patition_$%{}[]()&*^!@""'`\/#" + FOR VALUES FROM ('20') TO ('25'); + +ALTER TABLE public."cust_arr_small PARTITION" + OWNER to postgres; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_range_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_range_partition_msql.sql new file mode 100644 index 000000000..5f8a8283a --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_with_range_partition_msql.sql @@ -0,0 +1,12 @@ +CREATE TABLE IF NOT EXISTS public."table_with_range_patition_$%{}[]()&*^!@""'`\/#" +( + id integer, + status text, + arr numeric +) PARTITION BY RANGE (arr); + +ALTER TABLE public."table_with_range_patition_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +CREATE TABLE IF NOT EXISTS public."cust_arr_small PARTITION" PARTITION OF public."table_with_range_patition_$%{}[]()&*^!@""'`\/#" + FOR VALUES FROM (20) TO (25); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_without_primary_key.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_without_primary_key.sql new file mode 100644 index 000000000..46eec1520 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_without_primary_key.sql @@ -0,0 +1,21 @@ +-- Table: public.simple_table_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_$%{}[]()&*^!@""'`\/#" +( + col1 integer, + col2 text COLLATE pg_catalog."default", + col3 boolean, + col4 character varying(30) COLLATE pg_catalog."default", + col5 numeric(20,10), + col6 timestamp(5) with time zone +) + +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_without_primary_key_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_without_primary_key_msql.sql new file mode 100644 index 000000000..a343f07dc --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/create_table_without_primary_key_msql.sql @@ -0,0 +1,15 @@ +CREATE TABLE IF NOT EXISTS public."simple_table_$%{}[]()&*^!@""'`\/#" +( + col1 integer, + col2 text, + col3 boolean, + col4 character varying(30), + col5 numeric(20, 10), + col6 timestamp(5) with time zone +); + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/test.json new file mode 100644 index 000000000..8a4475337 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/12_plus/test.json @@ -0,0 +1,1986 @@ +{ + "scenarios": [ + { + "type": "create", + "name": "Create Table without primary key", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col3", + "cltype": "boolean", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col4", + "cltype": "character varying", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 30, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col5", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": 20, + "attprecision": 10, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col6", + "cltype": "timestamp with time zone", + "attacl": [], + "min_val_attlen": 0, + "max_val_attlen": 6, + "is_primary_key": false, + "attnotnull": false, + "attlen": 5, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_without_primary_key.sql", + "expected_msql_file": "create_table_without_primary_key_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table to change column data types", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "cltype": "bigint" + }, + { + "attnum": 2, + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "cltype": "character varying" + }, + { + "attnum": 6, + "attlen": null, + "cltype": "time without time zone" + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_change_col_data_type.sql", + "expected_msql_file": "alter_table_change_col_data_type_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add pk", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "attnotnull": true, + "is_primary_key": true + } + ] + }, + "primary_key": { + "added": [ + { + "columns": [ + { + "column": "col1" + } + ], + "include": [] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_pk_not_null_constraint.sql", + "expected_msql_file": "alter_table_add_pk_not_null_constraint_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add null constraint, rename column", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "name": "col1_rename", + "is_primary_key": false + }, + { + "attnum": 4, + "attnotnull": true + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_null_constraint_rename_col.sql", + "expected_msql_file": "alter_table_add_null_constraint_rename_col_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table add pk", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with primary key", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [ + { + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "integer", + "attacl": [], + "is_primary_key": true, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "json", + "attacl": [], + "is_primary_key": false, + "attnotnull": true, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_pk.sql", + "expected_msql_file": "create_table_with_pk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add columns", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "columns": { + "added": [ + { + "name": "col3_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": 10, + "attprecision": 5, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col4_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_cols.sql", + "expected_msql_file": "alter_table_add_cols_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table delete columns", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "columns": { + "deleted": [ + { + "attoptions": [], + "attacl": [], + "seclabels": [], + "name": "col2_$%{}[]()&*^!@\\\"'`\\\\/#", + "atttypid": 114, + "attnum": 2, + "cltype": "json", + "collspcname": "", + "description": null, + "edit_types": [ + "json", + "jsonb" + ], + "is_primary_key": false, + "attstattarget": -1, + "attnotnull": true, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attndims": 0, + "atttypmod": -1, + "attstorage": "x", + "defval": null, + "typname": "json", + "displaytypname": "json", + "elemoid": 114, + "typnspname": "pg_catalog", + "defaultstorage": "x", + "indkey": "1", + "isdup": false, + "is_fk": false, + "is_sys_column": false, + "relname": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "is_view_only": false, + "is_pk": false, + "old_attidentity": "a" + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_delete_cols.sql", + "expected_msql_file": "alter_table_delete_cols_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table delete columns", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with pk & check constraint", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "create table comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [ + { + "name": "custom_pk", + "comment": "custom pk created", + "fillfactor": "11", + "condeferrable": true, + "condeferred": true, + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "time with time zone", + "attacl": [], + "min_val_attlen": 0, + "max_val_attlen": 6, + "is_primary_key": false, + "attnotnull": false, + "attlen": 5, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "character", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 12, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [ + { + "name": "chk_const", + "consrc": "col2 != null", + "convalidated": false, + "comment": "chk const comment" + } + ], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_pk_chk.sql", + "expected_msql_file": "create_table_with_pk_chk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add unique constraint", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "unique_constraint": { + "added": [ + { + "name": "unique", + "fillfactor": "13", + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ] + } + }, + "expected_sql_file": "alter_table_add_unique_const.sql", + "expected_msql_file": "alter_table_add_unique_const_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table delete constraints", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "check_constraint": { + "deleted": [ + { + "name": "chk_const", + "consrc": "col2 <> NULL::bpchar", + "connoinherit": false, + "convalidated": false, + "relname": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "nspname": "public", + "comment": "chk const comment", + "conislocal": true + } + ] + }, + "unique_constraint": { + "deleted": [ + { + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"\"'`\\\\/#" + } + ], + "name": "unique", + "comment": null, + "spcname": "pg_default", + "fillfactor": "13", + "condeferrable": false, + "condeferred": false, + "include": [], + "col_count": 1, + "conislocal": true + } + ] + } + }, + "expected_sql_file": "alter_table_delete_constraints.sql", + "expected_msql_file": "alter_table_delete_constraints_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with pk & chk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table for FK reference", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "fk_reference_tbl", + "columns": [ + { + "name": "id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "bigint" + } + ], + "primary_key": [ + { + "columns": [ + { + "column": "id" + } + ], + "include": [] + } + ], + "unique_constraint": [ + { + "name": "", + "columns": [ + { + "column": "name" + } + ], + "include": [] + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create Table with fk constraint", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col3", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [ + { + "name": "fk_test", + "comment": "fk comment", + "condeferrable": true, + "confmatchtype": true, + "columns": [ + { + "local_column": "col1", + "references": "", + "referenced": "id" + } + ], + "confupdtype": "a", + "confdeltype": "a", + "autoindex": false, + "coveringindex": null + } + ], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "create_table_with_fk.sql", + "expected_msql_file": "create_table_with_fk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add one more fk", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "foreign_key": { + "added": [ + { + "name": "fk2", + "columns": [ + { + "local_column": "col2", + "references": "", + "referenced": "name" + } + ], + "confupdtype": "a", + "confdeltype": "a", + "autoindex": false, + "coveringindex": null + } + ] + } + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "alter_table_add_another_fk.sql", + "expected_msql_file": "alter_table_add_another_fk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add exclude constraint", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "exclude_constraint": { + "added": [ + { + "name": "ex_constr", + "amname": "gist", + "columns": [ + { + "column": "col1", + "is_exp": false, + "order": false, + "nulls_order": false, + "operator": "<>", + "is_sort_nulls_applicable": false + } + ], + "include": [] + } + ] + } + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "alter_table_add_exclude_constraint.sql", + "expected_msql_file": "alter_table_add_exclude_constraint_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with fk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with custom auto-vacuum", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "custom auto vacuum", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "t", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "character varying[]", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 10, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "date", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor", + "value": 0.2 + }, + { + "name": "autovacuum_analyze_threshold", + "value": 55 + }, + { + "name": "autovacuum_freeze_max_age", + "value": 20000000 + }, + { + "name": "autovacuum_vacuum_cost_delay", + "value": 25 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 10 + }, + { + "name": "autovacuum_vacuum_scale_factor", + "value": 0.3 + }, + { + "name": "autovacuum_vacuum_threshold", + "value": 60 + }, + { + "name": "autovacuum_freeze_min_age", + "value": 500000 + }, + { + "name": "autovacuum_freeze_table_age", + "value": 1300000 + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "autovacuum_custom": true + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_custom_autovacuum.sql", + "expected_msql_file": "create_table_with_custom_autovacuum_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add toast table", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#", + "autovacuum_enabled": "x", + "toast_autovacuum": true, + "toast_autovacuum_enabled": "f", + "vacuum_table": { + "changed": [ + { + "name": "autovacuum_analyze_threshold", + "value": 60 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 100 + } + ] + }, + "vacuum_toast": { + "changed": [ + { + "name": "autovacuum_freeze_max_age", + "value": 2000000 + }, + { + "name": "autovacuum_vacuum_cost_delay", + "value": 50 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 13 + }, + { + "name": "autovacuum_vacuum_threshold", + "value": 70 + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_with_toast_table.sql", + "expected_msql_file": "alter_table_with_toast_table_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with fk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with advanced options", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "relhasoids": true, + "description": "test comment", + "relpersistence": true, + "fillfactor": "50", + "parallel_workers": "", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "double precision", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "numrange", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": true, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "rlspolicy": true + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_advanced_options.sql", + "expected_msql_file": "create_table_with_advanced_options_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table update grants", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#", + "rlspolicy": false, + "forcerlspolicy": false, + "relacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + } + ] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_update_grants.sql", + "expected_msql_file": "alter_table_update_grants_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with advanced options", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table for like table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "like_tbl", + "columns": [ + { + "name": "id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "text" + } + ], + "primary_key": [ + { + "columns": [ + { + "column": "id" + } + ], + "include": [] + } + ], + "unique_constraint": [ + { + "name": "", + "columns": [ + { + "column": "name" + } + ], + "include": [] + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create Table using like table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "test ", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": true, + "like_constraints": true, + "like_indexes": true, + "like_storage": true, + "like_comments": true, + "like_relation": "public.like_tbl" + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "create_table_with_lik_tbl.sql", + "expected_msql_file": "create_table_with_lik_tbl_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table update grants", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#", + "description": "test comment", + "fillfactor": "13", + "replica_identity": "", + "relacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "D", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "x", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "t", + "privilege": true, + "with_grant": false + } + ] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_update_grants2.sql", + "expected_msql_file": "alter_table_update_grants2_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with advanced options", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with list partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_patition_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "partition table", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_active", + "values_in": "'ACTIVE'", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "list", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "status", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "status" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_partition.sql", + "expected_msql_file": "create_table_with_partition_msql.sql" + }, + { + "type": "create", + "name": "Create Table with range partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_range_patition_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_arr_small PARTITION", + "values_from": "20", + "values_to": "25", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "range", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "status", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "arr" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_range_partition.sql", + "expected_msql_file": "create_table_with_range_partition_msql.sql" + }, + { + "type": "create", + "name": "Create Table with hash partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_hash_patition_$%{}[]()&*^!@\\\"'`\\\\/#", + "relowner": "postgres", + "relacl": [], + "description": "hash partition", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_part11", + "values_modulus": "2", + "values_remainder": "1", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "hash", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "name", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "id" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_hash_partition.sql", + "expected_msql_file": "create_table_with_hash_partition_msql.sql" + } + ] +} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_another_fk.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_another_fk.sql new file mode 100644 index 000000000..41fc1d348 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_another_fk.sql @@ -0,0 +1,33 @@ +-- Table: public.table_with_fk_constraints$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" +( + col1 integer, + col2 bigint, + col3 text COLLATE pg_catalog."default", + CONSTRAINT fk2 FOREIGN KEY (col2) + REFERENCES public.fk_reference_tbl (name) MATCH SIMPLE + ON UPDATE NO ACTION + ON DELETE NO ACTION + NOT VALID, + CONSTRAINT fk_test FOREIGN KEY (col1) + REFERENCES public.fk_reference_tbl (id) MATCH FULL + ON UPDATE NO ACTION + ON DELETE NO ACTION + DEFERRABLE +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'test comment'; + +COMMENT ON CONSTRAINT fk_test ON public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'fk comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_another_fk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_another_fk_msql.sql new file mode 100644 index 000000000..bdcbfcb62 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_another_fk_msql.sql @@ -0,0 +1,6 @@ +ALTER TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT fk2 FOREIGN KEY (col2) + REFERENCES public.fk_reference_tbl (name) + ON UPDATE NO ACTION + ON DELETE NO ACTION + NOT VALID; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_cols.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_cols.sql new file mode 100644 index 000000000..920f93019 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_cols.sql @@ -0,0 +1,22 @@ +-- Table: public.simple_table_with_pk$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" integer NOT NULL, + "col2_$%{}[]()&*^!@\""'`\\/#" json NOT NULL, + "col3_$%{}[]()&*^!@\""'`\\/#" numeric(10,5), + "col4_$%{}[]()&*^!@\""'`\\/#" text COLLATE pg_catalog."default", + CONSTRAINT "simple_table_with_pk$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY ("col1_$%{}[]()&*^!@\""""'`\\/#") +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_cols_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_cols_msql.sql new file mode 100644 index 000000000..776060df2 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_cols_msql.sql @@ -0,0 +1,5 @@ +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + ADD COLUMN "col3_$%{}[]()&*^!@\""'`\\/#" numeric(10, 5); + +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + ADD COLUMN "col4_$%{}[]()&*^!@\""'`\\/#" text; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_exclude_constraint.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_exclude_constraint.sql new file mode 100644 index 000000000..e418ed66a --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_exclude_constraint.sql @@ -0,0 +1,36 @@ +-- Table: public.table_with_fk_constraints$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" +( + col1 integer, + col2 bigint, + col3 text COLLATE pg_catalog."default", + CONSTRAINT fk2 FOREIGN KEY (col2) + REFERENCES public.fk_reference_tbl (name) MATCH SIMPLE + ON UPDATE NO ACTION + ON DELETE NO ACTION + NOT VALID, + CONSTRAINT fk_test FOREIGN KEY (col1) + REFERENCES public.fk_reference_tbl (id) MATCH FULL + ON UPDATE NO ACTION + ON DELETE NO ACTION + DEFERRABLE, + CONSTRAINT ex_constr EXCLUDE USING gist ( + col1 WITH <>) + +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'test comment'; + +COMMENT ON CONSTRAINT fk_test ON public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'fk comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_exclude_constraint_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_exclude_constraint_msql.sql new file mode 100644 index 000000000..3a027c684 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_exclude_constraint_msql.sql @@ -0,0 +1,3 @@ +ALTER TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT ex_constr EXCLUDE USING gist ( + col1 WITH <>); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_null_constraint_rename_col.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_null_constraint_rename_col.sql new file mode 100644 index 000000000..2763f9b85 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_null_constraint_rename_col.sql @@ -0,0 +1,24 @@ +-- Table: public.simple_table_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_$%{}[]()&*^!@""'`\/#" +( + col1_rename bigint NOT NULL, + col2 character varying COLLATE pg_catalog."default", + col3 boolean, + col4 character varying(30) COLLATE pg_catalog."default" NOT NULL, + col5 numeric(20,10), + col6 time(5) without time zone, + CONSTRAINT "simple_table_$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY (col1_rename) +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_null_constraint_rename_col_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_null_constraint_rename_col_msql.sql new file mode 100644 index 000000000..bf6a926cb --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_null_constraint_rename_col_msql.sql @@ -0,0 +1,5 @@ +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + RENAME col1 TO col1_rename; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN col4 SET NOT NULL; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_pk_not_null_constraint.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_pk_not_null_constraint.sql new file mode 100644 index 000000000..45047b28d --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_pk_not_null_constraint.sql @@ -0,0 +1,24 @@ +-- Table: public.simple_table_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_$%{}[]()&*^!@""'`\/#" +( + col1 bigint NOT NULL, + col2 character varying COLLATE pg_catalog."default", + col3 boolean, + col4 character varying(30) COLLATE pg_catalog."default", + col5 numeric(20,10), + col6 time(5) without time zone, + CONSTRAINT "simple_table_$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY (col1) +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_pk_not_null_constraint_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_pk_not_null_constraint_msql.sql new file mode 100644 index 000000000..628422d72 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_pk_not_null_constraint_msql.sql @@ -0,0 +1,4 @@ +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN col1 SET NOT NULL; +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + ADD PRIMARY KEY (col1); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_unique_const.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_unique_const.sql new file mode 100644 index 000000000..8d6d442b8 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_unique_const.sql @@ -0,0 +1,30 @@ +-- Table: public.table_with_pk_chk_constraints$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" time(5) with time zone NOT NULL, + col2 character(12) COLLATE pg_catalog."default", + CONSTRAINT custom_pk PRIMARY KEY ("col1_$%{}[]()&*^!@\""""'`\\/#") + WITH (FILLFACTOR=11) + DEFERRABLE INITIALLY DEFERRED, + CONSTRAINT "unique" UNIQUE ("col1_$%{}[]()&*^!@\""""'`\\/#") + WITH (FILLFACTOR=13), + CONSTRAINT chk_const CHECK (col2 <> NULL::bpchar) +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'create table comment'; +COMMENT ON CONSTRAINT custom_pk ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'custom pk created'; + +COMMENT ON CONSTRAINT chk_const ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'chk const comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_unique_const_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_unique_const_msql.sql new file mode 100644 index 000000000..d5ade04d6 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_add_unique_const_msql.sql @@ -0,0 +1,3 @@ +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT "unique" UNIQUE ("col1_$%{}[]()&*^!@\""'`\\/#") + WITH (FILLFACTOR=13); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_change_col_data_type.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_change_col_data_type.sql new file mode 100644 index 000000000..44f0935c9 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_change_col_data_type.sql @@ -0,0 +1,23 @@ +-- Table: public.simple_table_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_$%{}[]()&*^!@""'`\/#" +( + col1 bigint, + col2 character varying COLLATE pg_catalog."default", + col3 boolean, + col4 character varying(30) COLLATE pg_catalog."default", + col5 numeric(20,10), + col6 time(5) without time zone +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_change_col_data_type_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_change_col_data_type_msql.sql new file mode 100644 index 000000000..290f24244 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_change_col_data_type_msql.sql @@ -0,0 +1,8 @@ +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN col1 TYPE bigint; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN col2 TYPE character varying COLLATE pg_catalog."default"; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN col6 TYPE time(5) without time zone ; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_delete_cols.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_delete_cols.sql new file mode 100644 index 000000000..e428375ea --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_delete_cols.sql @@ -0,0 +1,21 @@ +-- Table: public.simple_table_with_pk$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" integer NOT NULL, + "col3_$%{}[]()&*^!@\""'`\\/#" numeric(10,5), + "col4_$%{}[]()&*^!@\""'`\\/#" text COLLATE pg_catalog."default", + CONSTRAINT "simple_table_with_pk$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY ("col1_$%{}[]()&*^!@\""""'`\\/#") +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_delete_cols_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_delete_cols_msql.sql new file mode 100644 index 000000000..673ff675b --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_delete_cols_msql.sql @@ -0,0 +1 @@ +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" DROP COLUMN "col2_$%{}[]()&*^!@\""'`\\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_delete_constraints.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_delete_constraints.sql new file mode 100644 index 000000000..005738c12 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_delete_constraints.sql @@ -0,0 +1,24 @@ +-- Table: public.table_with_pk_chk_constraints$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" time(5) with time zone NOT NULL, + col2 character(12) COLLATE pg_catalog."default", + CONSTRAINT custom_pk PRIMARY KEY ("col1_$%{}[]()&*^!@\""""'`\\/#") + WITH (FILLFACTOR=11) + DEFERRABLE INITIALLY DEFERRED +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'create table comment'; +COMMENT ON CONSTRAINT custom_pk ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'custom pk created'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_delete_constraints_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_delete_constraints_msql.sql new file mode 100644 index 000000000..47a3cf8db --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_delete_constraints_msql.sql @@ -0,0 +1,2 @@ +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" DROP CONSTRAINT "unique"; +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" DROP CONSTRAINT chk_const; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_update_grants.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_update_grants.sql new file mode 100644 index 000000000..caba3460f --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_update_grants.sql @@ -0,0 +1,24 @@ +-- Table: public.table_with_advanced_options_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#"; + +CREATE UNLOGGED TABLE IF NOT EXISTS public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" +( + col1 double precision, + col2 numrange +) +WITH ( + OIDS = TRUE, + FILLFACTOR = 50 +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +GRANT ALL ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" TO postgres; + +GRANT SELECT ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" TO PUBLIC; + +COMMENT ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_update_grants2.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_update_grants2.sql new file mode 100644 index 000000000..00681d6ee --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_update_grants2.sql @@ -0,0 +1,26 @@ +-- Table: public.table_like_tbl$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_like_tbl$%{}[]()&*^!@""'`\/#" +( + id integer NOT NULL, + name text COLLATE pg_catalog."default", + CONSTRAINT "table_like_tbl$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY (id), + CONSTRAINT "table_like_tbl$%{}[]()&*^!@""'`\/#_name_key" UNIQUE (name) +) +WITH ( + OIDS = FALSE, + FILLFACTOR = 13 +) +TABLESPACE pg_default; + +ALTER TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +GRANT ALL ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" TO postgres; + +GRANT REFERENCES, TRIGGER, TRUNCATE ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" TO PUBLIC; + +COMMENT ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_update_grants2_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_update_grants2_msql.sql new file mode 100644 index 000000000..0213d64fa --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_update_grants2_msql.sql @@ -0,0 +1,7 @@ +ALTER TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + SET (FILLFACTOR=13); + +COMMENT ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + IS 'test comment'; + +GRANT TRUNCATE, REFERENCES, TRIGGER ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" TO PUBLIC; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_update_grants_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_update_grants_msql.sql new file mode 100644 index 000000000..363195b79 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_update_grants_msql.sql @@ -0,0 +1,7 @@ +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + DISABLE ROW LEVEL SECURITY; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + NO FORCE ROW LEVEL SECURITY; + +GRANT SELECT ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" TO PUBLIC; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_with_toast_table.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_with_toast_table.sql new file mode 100644 index 000000000..e0b9cfd3c --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_with_toast_table.sql @@ -0,0 +1,33 @@ +-- Table: public.table_with_custom_autovaccum_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" +( + col1 character varying(10)[] COLLATE pg_catalog."default", + col2 date +) +WITH ( + OIDS = FALSE, + toast.autovacuum_enabled = FALSE, + autovacuum_analyze_scale_factor = 0.2, + autovacuum_analyze_threshold = 60, + autovacuum_freeze_max_age = 20000000, + autovacuum_vacuum_cost_delay = 25, + autovacuum_vacuum_cost_limit = 100, + autovacuum_vacuum_scale_factor = 0.3, + autovacuum_vacuum_threshold = 60, + autovacuum_freeze_min_age = 500000, + autovacuum_freeze_table_age = 1300000, + toast.autovacuum_freeze_max_age = 2000000, + toast.autovacuum_vacuum_cost_delay = 50, + toast.autovacuum_vacuum_cost_limit = 13, + toast.autovacuum_vacuum_threshold = 70 +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + IS 'custom auto vacuum'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_with_toast_table_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_with_toast_table_msql.sql new file mode 100644 index 000000000..a1a588be7 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/alter_table_with_toast_table_msql.sql @@ -0,0 +1,14 @@ +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" SET ( + autovacuum_analyze_threshold = 60, + autovacuum_vacuum_cost_limit = 100 +); +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" RESET ( + autovacuum_enabled +); +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" SET ( + toast.autovacuum_enabled = false, + toast.autovacuum_freeze_max_age = 2000000, + toast.autovacuum_vacuum_cost_delay = 50, + toast.autovacuum_vacuum_cost_limit = 13, + toast.autovacuum_vacuum_threshold = 70 +); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_advanced_options.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_advanced_options.sql new file mode 100644 index 000000000..b065c4876 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_advanced_options.sql @@ -0,0 +1,26 @@ +-- Table: public.table_with_advanced_options_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#"; + +CREATE UNLOGGED TABLE IF NOT EXISTS public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" +( + col1 double precision, + col2 numrange +) +WITH ( + OIDS = TRUE, + FILLFACTOR = 50 +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + ENABLE ROW LEVEL SECURITY; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + FORCE ROW LEVEL SECURITY; + +COMMENT ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_advanced_options_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_advanced_options_msql.sql new file mode 100644 index 000000000..7a091ded3 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_advanced_options_msql.sql @@ -0,0 +1,21 @@ +CREATE UNLOGGED TABLE IF NOT EXISTS public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" +( + col1 double precision, + col2 numrange +) +WITH ( + OIDS = TRUE, + FILLFACTOR = 50 +); + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + ENABLE ROW LEVEL SECURITY; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + FORCE ROW LEVEL SECURITY; + +COMMENT ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_custom_autovacuum.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_custom_autovacuum.sql new file mode 100644 index 000000000..0664e6140 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_custom_autovacuum.sql @@ -0,0 +1,29 @@ +-- Table: public.table_with_custom_autovaccum_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" +( + col1 character varying(10)[] COLLATE pg_catalog."default", + col2 date +) +WITH ( + OIDS = FALSE, + autovacuum_enabled = TRUE, + autovacuum_analyze_scale_factor = 0.2, + autovacuum_analyze_threshold = 55, + autovacuum_freeze_max_age = 20000000, + autovacuum_vacuum_cost_delay = 25, + autovacuum_vacuum_cost_limit = 10, + autovacuum_vacuum_scale_factor = 0.3, + autovacuum_vacuum_threshold = 60, + autovacuum_freeze_min_age = 500000, + autovacuum_freeze_table_age = 1300000 +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + IS 'custom auto vacuum'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_custom_autovacuum_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_custom_autovacuum_msql.sql new file mode 100644 index 000000000..394aec38f --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_custom_autovacuum_msql.sql @@ -0,0 +1,24 @@ +CREATE TABLE IF NOT EXISTS public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" +( + col1 character varying(10)[], + col2 date +) +WITH ( + OIDS = FALSE, + autovacuum_enabled = TRUE, + autovacuum_analyze_scale_factor = 0.2, + autovacuum_analyze_threshold = 55, + autovacuum_freeze_max_age = 20000000, + autovacuum_vacuum_cost_delay = 25, + autovacuum_vacuum_cost_limit = 10, + autovacuum_vacuum_scale_factor = 0.3, + autovacuum_vacuum_threshold = 60, + autovacuum_freeze_min_age = 500000, + autovacuum_freeze_table_age = 1300000 +); + +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + IS 'custom auto vacuum'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_fk.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_fk.sql new file mode 100644 index 000000000..11e730174 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_fk.sql @@ -0,0 +1,28 @@ +-- Table: public.table_with_fk_constraints$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" +( + col1 integer, + col2 bigint, + col3 text COLLATE pg_catalog."default", + CONSTRAINT fk_test FOREIGN KEY (col1) + REFERENCES public.fk_reference_tbl (id) MATCH FULL + ON UPDATE NO ACTION + ON DELETE NO ACTION + DEFERRABLE +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'test comment'; + +COMMENT ON CONSTRAINT fk_test ON public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'fk comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_fk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_fk_msql.sql new file mode 100644 index 000000000..e2ce72027 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_fk_msql.sql @@ -0,0 +1,24 @@ +CREATE TABLE IF NOT EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" +( + col1 integer, + col2 bigint, + col3 text, + CONSTRAINT fk_test FOREIGN KEY (col1) + REFERENCES public.fk_reference_tbl (id) MATCH FULL + ON UPDATE NO ACTION + ON DELETE NO ACTION + DEFERRABLE + NOT VALID +) +WITH ( + OIDS = FALSE +); + +ALTER TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'test comment'; + +COMMENT ON CONSTRAINT fk_test ON public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'fk comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_lik_tbl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_lik_tbl.sql new file mode 100644 index 000000000..1309cdc51 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_lik_tbl.sql @@ -0,0 +1,21 @@ +-- Table: public.table_like_tbl$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_like_tbl$%{}[]()&*^!@""'`\/#" +( + id integer NOT NULL, + name text COLLATE pg_catalog."default", + CONSTRAINT "table_like_tbl$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY (id), + CONSTRAINT "table_like_tbl$%{}[]()&*^!@""'`\/#_name_key" UNIQUE (name) +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + IS 'test '; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_lik_tbl_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_lik_tbl_msql.sql new file mode 100644 index 000000000..bf9eb0733 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_lik_tbl_msql.sql @@ -0,0 +1,19 @@ +CREATE TABLE IF NOT EXISTS public."table_like_tbl$%{}[]()&*^!@""'`\/#" +( + LIKE public.like_tbl + INCLUDING DEFAULTS + INCLUDING CONSTRAINTS + INCLUDING INDEXES + INCLUDING STORAGE + INCLUDING COMMENTS + +) +WITH ( + OIDS = FALSE +); + +ALTER TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + IS 'test '; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_pk.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_pk.sql new file mode 100644 index 000000000..bcac72e98 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_pk.sql @@ -0,0 +1,20 @@ +-- Table: public.simple_table_with_pk$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" integer NOT NULL, + "col2_$%{}[]()&*^!@\""'`\\/#" json NOT NULL, + CONSTRAINT "simple_table_with_pk$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY ("col1_$%{}[]()&*^!@\""""'`\\/#") +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_pk_chk.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_pk_chk.sql new file mode 100644 index 000000000..aab4b5393 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_pk_chk.sql @@ -0,0 +1,28 @@ +-- Table: public.table_with_pk_chk_constraints$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" time(5) with time zone NOT NULL, + col2 character(12) COLLATE pg_catalog."default", + CONSTRAINT custom_pk PRIMARY KEY ("col1_$%{}[]()&*^!@\""""'`\\/#") + WITH (FILLFACTOR=11) + DEFERRABLE INITIALLY DEFERRED, + CONSTRAINT chk_const CHECK (col2 <> NULL::bpchar) +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'create table comment'; +COMMENT ON CONSTRAINT custom_pk ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'custom pk created'; + +COMMENT ON CONSTRAINT chk_const ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'chk const comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_pk_chk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_pk_chk_msql.sql new file mode 100644 index 000000000..2ba138e58 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_pk_chk_msql.sql @@ -0,0 +1,23 @@ +CREATE TABLE IF NOT EXISTS public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" time(5) with time zone, + col2 character(12), + CONSTRAINT custom_pk PRIMARY KEY ("col1_$%{}[]()&*^!@\""'`\\/#") + WITH (FILLFACTOR=11) + DEFERRABLE INITIALLY DEFERRED, + CONSTRAINT chk_const CHECK (col2 != null) +) +WITH ( + OIDS = FALSE +); + +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'create table comment'; +COMMENT ON CONSTRAINT custom_pk ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'custom pk created'; + +COMMENT ON CONSTRAINT chk_const ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'chk const comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_pk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_pk_msql.sql new file mode 100644 index 000000000..32120e75a --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_with_pk_msql.sql @@ -0,0 +1,15 @@ +CREATE TABLE IF NOT EXISTS public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" integer, + "col2_$%{}[]()&*^!@\""'`\\/#" json NOT NULL, + PRIMARY KEY ("col1_$%{}[]()&*^!@\""'`\\/#") +) +WITH ( + OIDS = FALSE +); + +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_without_primary_key.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_without_primary_key.sql new file mode 100644 index 000000000..bafbffc80 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_without_primary_key.sql @@ -0,0 +1,23 @@ +-- Table: public.simple_table_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_$%{}[]()&*^!@""'`\/#" +( + col1 integer, + col2 text COLLATE pg_catalog."default", + col3 boolean, + col4 character varying(30) COLLATE pg_catalog."default", + col5 numeric(20,10), + col6 timestamp(5) with time zone +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_without_primary_key_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_without_primary_key_msql.sql new file mode 100644 index 000000000..ec4c305e0 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/create_table_without_primary_key_msql.sql @@ -0,0 +1,18 @@ +CREATE TABLE IF NOT EXISTS public."simple_table_$%{}[]()&*^!@""'`\/#" +( + col1 integer, + col2 text, + col3 boolean, + col4 character varying(30), + col5 numeric(20, 10), + col6 timestamp(5) with time zone +) +WITH ( + OIDS = FALSE +); + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + OWNER to postgres; + +COMMENT ON TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/test.json new file mode 100644 index 000000000..e8897f937 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/pg/default/test.json @@ -0,0 +1,1538 @@ +{ + "scenarios": [ + { + "type": "create", + "name": "Create Table without primary key", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col3", + "cltype": "boolean", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col4", + "cltype": "character varying", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 30, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col5", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": 20, + "attprecision": 10, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col6", + "cltype": "timestamp with time zone", + "attacl": [], + "min_val_attlen": 0, + "max_val_attlen": 6, + "is_primary_key": false, + "attnotnull": false, + "attlen": 5, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_without_primary_key.sql", + "expected_msql_file": "create_table_without_primary_key_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table to change column data types", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "cltype": "bigint" + }, + { + "attnum": 2, + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "cltype": "character varying" + }, + { + "attnum": 6, + "attlen": null, + "cltype": "time without time zone" + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_change_col_data_type.sql", + "expected_msql_file": "alter_table_change_col_data_type_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add pk", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "attnotnull": true, + "is_primary_key": true + } + ] + }, + "primary_key": { + "added": [ + { + "columns": [ + { + "column": "col1" + } + ], + "include": [] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_pk_not_null_constraint.sql", + "expected_msql_file": "alter_table_add_pk_not_null_constraint_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add null constraint, rename column", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "name": "col1_rename", + "is_primary_key": false + }, + { + "attnum": 4, + "attnotnull": true + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_null_constraint_rename_col.sql", + "expected_msql_file": "alter_table_add_null_constraint_rename_col_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table add pk", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with primary key", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [ + { + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "integer", + "attacl": [], + "is_primary_key": true, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "json", + "attacl": [], + "is_primary_key": false, + "attnotnull": true, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_pk.sql", + "expected_msql_file": "create_table_with_pk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add columns", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "columns": { + "added": [ + { + "name": "col3_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": 10, + "attprecision": 5, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col4_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_cols.sql", + "expected_msql_file": "alter_table_add_cols_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table delete columns", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "columns": { + "deleted": [ + { + "attoptions": [], + "attacl": [], + "seclabels": [], + "name": "col2_$%{}[]()&*^!@\\\"'`\\\\/#", + "atttypid": 114, + "attnum": 2, + "cltype": "json", + "collspcname": "", + "description": null, + "edit_types": [ + "json", + "jsonb" + ], + "is_primary_key": false, + "attstattarget": -1, + "attnotnull": true, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attndims": 0, + "atttypmod": -1, + "attstorage": "x", + "defval": null, + "typname": "json", + "displaytypname": "json", + "elemoid": 114, + "typnspname": "pg_catalog", + "defaultstorage": "x", + "indkey": "1", + "isdup": false, + "is_fk": false, + "is_sys_column": false, + "relname": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "is_view_only": false, + "is_pk": false, + "old_attidentity": "a" + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_delete_cols.sql", + "expected_msql_file": "alter_table_delete_cols_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table delete columns", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with pk & check constraint", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "create table comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [ + { + "name": "custom_pk", + "comment": "custom pk created", + "fillfactor": "11", + "condeferrable": true, + "condeferred": true, + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "time with time zone", + "attacl": [], + "min_val_attlen": 0, + "max_val_attlen": 6, + "is_primary_key": false, + "attnotnull": false, + "attlen": 5, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "character", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 12, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [ + { + "name": "chk_const", + "consrc": "col2 != null", + "convalidated": false, + "comment": "chk const comment" + } + ], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_pk_chk.sql", + "expected_msql_file": "create_table_with_pk_chk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add unique constraint", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "unique_constraint": { + "added": [ + { + "name": "unique", + "fillfactor": "13", + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ] + } + }, + "expected_sql_file": "alter_table_add_unique_const.sql", + "expected_msql_file": "alter_table_add_unique_const_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table delete constraints", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "check_constraint": { + "deleted": [ + { + "name": "chk_const", + "consrc": "col2 <> NULL::bpchar", + "connoinherit": false, + "convalidated": false, + "relname": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "nspname": "public", + "comment": "chk const comment", + "conislocal": true + } + ] + }, + "unique_constraint": { + "deleted": [ + { + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"\"'`\\\\/#" + } + ], + "name": "unique", + "comment": null, + "spcname": "pg_default", + "fillfactor": "13", + "condeferrable": false, + "condeferred": false, + "include": [], + "col_count": 1, + "conislocal": true + } + ] + } + }, + "expected_sql_file": "alter_table_delete_constraints.sql", + "expected_msql_file": "alter_table_delete_constraints_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with pk & chk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table for FK reference", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "fk_reference_tbl", + "columns": [ + { + "name": "id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "bigint" + } + ], + "primary_key": [ + { + "columns": [ + { + "column": "id" + } + ], + "include": [] + } + ], + "unique_constraint": [ + { + "name": "", + "columns": [ + { + "column": "name" + } + ], + "include": [] + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create Table with fk constraint", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col3", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [ + { + "name": "fk_test", + "comment": "fk comment", + "condeferrable": true, + "confmatchtype": true, + "columns": [ + { + "local_column": "col1", + "references": "", + "referenced": "id" + } + ], + "confupdtype": "a", + "confdeltype": "a", + "autoindex": false, + "coveringindex": null + } + ], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "create_table_with_fk.sql", + "expected_msql_file": "create_table_with_fk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add one more fk", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "foreign_key": { + "added": [ + { + "name": "fk2", + "columns": [ + { + "local_column": "col2", + "references": "", + "referenced": "name" + } + ], + "confupdtype": "a", + "confdeltype": "a", + "autoindex": false, + "coveringindex": null + } + ] + } + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "alter_table_add_another_fk.sql", + "expected_msql_file": "alter_table_add_another_fk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add exclude constraint", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "exclude_constraint": { + "added": [ + { + "name": "ex_constr", + "amname": "gist", + "columns": [ + { + "column": "col1", + "is_exp": false, + "order": false, + "nulls_order": false, + "operator": "<>", + "is_sort_nulls_applicable": false + } + ], + "include": [] + } + ] + } + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "alter_table_add_exclude_constraint.sql", + "expected_msql_file": "alter_table_add_exclude_constraint_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with fk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with custom auto-vacuum", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "custom auto vacuum", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "t", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "character varying[]", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 10, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "date", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor", + "value": 0.2 + }, + { + "name": "autovacuum_analyze_threshold", + "value": 55 + }, + { + "name": "autovacuum_freeze_max_age", + "value": 20000000 + }, + { + "name": "autovacuum_vacuum_cost_delay", + "value": 25 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 10 + }, + { + "name": "autovacuum_vacuum_scale_factor", + "value": 0.3 + }, + { + "name": "autovacuum_vacuum_threshold", + "value": 60 + }, + { + "name": "autovacuum_freeze_min_age", + "value": 500000 + }, + { + "name": "autovacuum_freeze_table_age", + "value": 1300000 + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "autovacuum_custom": true + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_custom_autovacuum.sql", + "expected_msql_file": "create_table_with_custom_autovacuum_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add toast table", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#", + "autovacuum_enabled": "x", + "toast_autovacuum": true, + "toast_autovacuum_enabled": "f", + "vacuum_table": { + "changed": [ + { + "name": "autovacuum_analyze_threshold", + "value": 60 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 100 + } + ] + }, + "vacuum_toast": { + "changed": [ + { + "name": "autovacuum_freeze_max_age", + "value": 2000000 + }, + { + "name": "autovacuum_vacuum_cost_delay", + "value": 50 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 13 + }, + { + "name": "autovacuum_vacuum_threshold", + "value": 70 + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_with_toast_table.sql", + "expected_msql_file": "alter_table_with_toast_table_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with fk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with advanced options", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "relhasoids": true, + "description": "test comment", + "relpersistence": true, + "fillfactor": "50", + "parallel_workers": "", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "double precision", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "numrange", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": true, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "rlspolicy": true + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_advanced_options.sql", + "expected_msql_file": "create_table_with_advanced_options_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table update grants", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#", + "rlspolicy": false, + "forcerlspolicy": false, + "relacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + } + ] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_update_grants.sql", + "expected_msql_file": "alter_table_update_grants_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with advanced options", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table for like table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "like_tbl", + "columns": [ + { + "name": "id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "text" + } + ], + "primary_key": [ + { + "columns": [ + { + "column": "id" + } + ], + "include": [] + } + ], + "unique_constraint": [ + { + "name": "", + "columns": [ + { + "column": "name" + } + ], + "include": [] + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create Table using like table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#", + "relowner": "postgres", + "relacl": [], + "description": "test ", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": true, + "like_constraints": true, + "like_indexes": true, + "like_storage": true, + "like_comments": true, + "like_relation": "public.like_tbl" + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "create_table_with_lik_tbl.sql", + "expected_msql_file": "create_table_with_lik_tbl_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table update grants", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#", + "description": "test comment", + "fillfactor": "13", + "replica_identity": "", + "relacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "D", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "x", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "t", + "privilege": true, + "with_grant": false + } + ] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_update_grants2.sql", + "expected_msql_file": "alter_table_update_grants2_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with advanced options", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#" + } + } + ] +} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/alter_table_with_toast_table.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/alter_table_with_toast_table.sql new file mode 100644 index 000000000..94de94678 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/alter_table_with_toast_table.sql @@ -0,0 +1,33 @@ +-- Table: public.table_with_custom_autovaccum_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" +( + col1 character varying(10)[] COLLATE pg_catalog."default", + col2 timestamp without time zone +) +WITH ( + OIDS = FALSE, + toast.autovacuum_enabled = FALSE, + autovacuum_analyze_scale_factor = 0.2, + autovacuum_analyze_threshold = 60, + autovacuum_freeze_max_age = 20000000, + autovacuum_vacuum_cost_delay = 25, + autovacuum_vacuum_cost_limit = 100, + autovacuum_vacuum_scale_factor = 0.3, + autovacuum_vacuum_threshold = 60, + autovacuum_freeze_min_age = 500000, + autovacuum_freeze_table_age = 1300000, + toast.autovacuum_freeze_max_age = 2000000, + toast.autovacuum_vacuum_cost_delay = 50, + toast.autovacuum_vacuum_cost_limit = 13, + toast.autovacuum_vacuum_threshold = 70 +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + IS 'custom auto vacuum'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/alter_table_with_toast_table_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/alter_table_with_toast_table_msql.sql new file mode 100644 index 000000000..f738d3ec8 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/alter_table_with_toast_table_msql.sql @@ -0,0 +1,15 @@ +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" SET ( + autovacuum_analyze_threshold = 60, + autovacuum_vacuum_cost_limit = 100 +); +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" RESET ( + autovacuum_enabled +); + +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" SET ( + toast.autovacuum_enabled = false, + toast.autovacuum_freeze_max_age = 2000000, + toast.autovacuum_vacuum_cost_delay = 50, + toast.autovacuum_vacuum_cost_limit = 13, + toast.autovacuum_vacuum_threshold = 70 +); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_table_with_partition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_table_with_partition.sql new file mode 100644 index 000000000..8299a8961 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_table_with_partition.sql @@ -0,0 +1,28 @@ +-- Table: public.table_with_patition_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_patition_$%{}[]()&*^!@""'`\/#" +( + id integer, + status text COLLATE pg_catalog."default", + arr numeric +) PARTITION BY LIST (status) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#" + IS 'partition table'; + +-- Partitions SQL + +CREATE TABLE IF NOT EXISTS public.cust_active PARTITION OF public."table_with_patition_$%{}[]()&*^!@""'`\/#" + FOR VALUES IN ('ACTIVE'); + +ALTER TABLE public.cust_active + OWNER to enterprisedb; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_table_with_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_table_with_partition_msql.sql new file mode 100644 index 000000000..10910fbf6 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_table_with_partition_msql.sql @@ -0,0 +1,18 @@ +CREATE TABLE IF NOT EXISTS public."table_with_patition_$%{}[]()&*^!@""'`\/#" +( + id integer, + status text, + arr numeric +) PARTITION BY LIST (status) +WITH ( + OIDS = FALSE +); + +ALTER TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#" + IS 'partition table'; + +CREATE TABLE IF NOT EXISTS public.cust_active PARTITION OF public."table_with_patition_$%{}[]()&*^!@""'`\/#" + FOR VALUES IN ('ACTIVE'); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_table_with_range_partition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_table_with_range_partition.sql new file mode 100644 index 000000000..d3aff0264 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_table_with_range_partition.sql @@ -0,0 +1,25 @@ +-- Table: public.table_with_range_patition_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_range_patition_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_range_patition_$%{}[]()&*^!@""'`\/#" +( + id integer, + status text COLLATE pg_catalog."default", + arr numeric +) PARTITION BY RANGE (arr) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_range_patition_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +-- Partitions SQL + +CREATE TABLE IF NOT EXISTS public."cust_arr_small PARTITION" PARTITION OF public."table_with_range_patition_$%{}[]()&*^!@""'`\/#" + FOR VALUES FROM ('20') TO ('25'); + +ALTER TABLE public."cust_arr_small PARTITION" + OWNER to enterprisedb; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_table_with_range_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_table_with_range_partition_msql.sql new file mode 100644 index 000000000..4acd8df52 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/create_table_with_range_partition_msql.sql @@ -0,0 +1,15 @@ +CREATE TABLE IF NOT EXISTS public."table_with_range_patition_$%{}[]()&*^!@""'`\/#" +( + id integer, + status text, + arr numeric +) PARTITION BY RANGE (arr) +WITH ( + OIDS = FALSE +); + +ALTER TABLE public."table_with_range_patition_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +CREATE TABLE IF NOT EXISTS public."cust_arr_small PARTITION" PARTITION OF public."table_with_range_patition_$%{}[]()&*^!@""'`\/#" + FOR VALUES FROM (20) TO (25); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/test.json new file mode 100644 index 000000000..440f577ca --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/10_plus/test.json @@ -0,0 +1,1836 @@ +{ + "scenarios": [ + { + "type": "create", + "name": "Create Table without primary key", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col3", + "cltype": "boolean", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col4", + "cltype": "character varying", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 30, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col5", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": 20, + "attprecision": 10, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col6", + "cltype": "timestamp with time zone", + "attacl": [], + "min_val_attlen": 0, + "max_val_attlen": 6, + "is_primary_key": false, + "attnotnull": false, + "attlen": 5, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_without_primary_key.sql", + "expected_msql_file": "create_table_without_primary_key_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table to change column data types", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "cltype": "bigint" + }, + { + "attnum": 2, + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "cltype": "character varying" + }, + { + "attnum": 6, + "attlen": null, + "cltype": "time without time zone" + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_change_col_data_type.sql", + "expected_msql_file": "alter_table_change_col_data_type_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add pk", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "attnotnull": true, + "is_primary_key": true + } + ] + }, + "primary_key": { + "added": [ + { + "columns": [ + { + "column": "col1" + } + ], + "include": [] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_pk_not_null_constraint.sql", + "expected_msql_file": "alter_table_add_pk_not_null_constraint_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add null constraint, rename column", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "name": "col1_rename", + "is_primary_key": false + }, + { + "attnum": 4, + "attnotnull": true + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_null_constraint_rename_col.sql", + "expected_msql_file": "alter_table_add_null_constraint_rename_col_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table add pk", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with primary key", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [ + { + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "integer", + "attacl": [], + "is_primary_key": true, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "json", + "attacl": [], + "is_primary_key": false, + "attnotnull": true, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_pk.sql", + "expected_msql_file": "create_table_with_pk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add columns", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "columns": { + "added": [ + { + "name": "col3_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": 10, + "attprecision": 5, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col4_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_cols.sql", + "expected_msql_file": "alter_table_add_cols_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table delete columns", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "columns": { + "deleted": [ + { + "attoptions": [], + "attacl": [], + "seclabels": [], + "name": "col2_$%{}[]()&*^!@\\\"'`\\\\/#", + "atttypid": 114, + "attnum": 2, + "cltype": "json", + "collspcname": "", + "description": null, + "edit_types": [ + "json", + "jsonb" + ], + "is_primary_key": false, + "attstattarget": -1, + "attnotnull": true, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attndims": 0, + "atttypmod": -1, + "attstorage": "x", + "defval": null, + "typname": "json", + "displaytypname": "json", + "elemoid": 114, + "typnspname": "pg_catalog", + "defaultstorage": "x", + "indkey": "1", + "isdup": false, + "is_fk": false, + "is_sys_column": false, + "relname": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "is_view_only": false, + "is_pk": false, + "old_attidentity": "a" + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_delete_cols.sql", + "expected_msql_file": "alter_table_delete_cols_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table delete columns", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with pk & check constraint", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "create table comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [ + { + "name": "custom_pk", + "comment": "custom pk created", + "fillfactor": "11", + "condeferrable": true, + "condeferred": true, + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "time with time zone", + "attacl": [], + "min_val_attlen": 0, + "max_val_attlen": 6, + "is_primary_key": false, + "attnotnull": false, + "attlen": 5, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "character", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 12, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [ + { + "name": "chk_const", + "consrc": "col2 != null", + "convalidated": false, + "comment": "chk const comment" + } + ], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_pk_chk.sql", + "expected_msql_file": "create_table_with_pk_chk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add unique constraint", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "unique_constraint": { + "added": [ + { + "name": "unique", + "fillfactor": "13", + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ] + } + }, + "expected_sql_file": "alter_table_add_unique_const.sql", + "expected_msql_file": "alter_table_add_unique_const_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table delete constraints", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "check_constraint": { + "deleted": [ + { + "name": "chk_const", + "consrc": "col2 <> NULL::bpchar", + "connoinherit": false, + "convalidated": false, + "relname": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "nspname": "public", + "comment": "chk const comment", + "conislocal": true + } + ] + }, + "unique_constraint": { + "deleted": [ + { + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"\"'`\\\\/#" + } + ], + "name": "unique", + "comment": null, + "spcname": "pg_default", + "fillfactor": "13", + "condeferrable": false, + "condeferred": false, + "include": [], + "col_count": 1, + "conislocal": true + } + ] + } + }, + "expected_sql_file": "alter_table_delete_constraints.sql", + "expected_msql_file": "alter_table_delete_constraints_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with pk & chk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table for FK reference", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "fk_reference_tbl", + "columns": [ + { + "name": "id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "bigint" + } + ], + "primary_key": [ + { + "columns": [ + { + "column": "id" + } + ], + "include": [] + } + ], + "unique_constraint": [ + { + "name": "", + "columns": [ + { + "column": "name" + } + ], + "include": [] + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create Table with fk constraint", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col3", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [ + { + "name": "fk_test", + "comment": "fk comment", + "condeferrable": true, + "confmatchtype": true, + "columns": [ + { + "local_column": "col1", + "references": "", + "referenced": "id" + } + ], + "confupdtype": "a", + "confdeltype": "a", + "autoindex": false, + "coveringindex": null + } + ], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "create_table_with_fk.sql", + "expected_msql_file": "create_table_with_fk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add one more fk", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "foreign_key": { + "added": [ + { + "name": "fk2", + "columns": [ + { + "local_column": "col2", + "references": "", + "referenced": "name" + } + ], + "confupdtype": "a", + "confdeltype": "a", + "autoindex": false, + "coveringindex": null + } + ] + } + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "alter_table_add_another_fk.sql", + "expected_msql_file": "alter_table_add_another_fk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add exclude constraint", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "exclude_constraint": { + "added": [ + { + "name": "ex_constr", + "amname": "gist", + "columns": [ + { + "column": "col1", + "is_exp": false, + "order": false, + "nulls_order": false, + "operator": "<>", + "is_sort_nulls_applicable": false + } + ], + "include": [] + } + ] + } + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "alter_table_add_exclude_constraint.sql", + "expected_msql_file": "alter_table_add_exclude_constraint_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with fk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with custom auto-vacuum", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "custom auto vacuum", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "t", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "character varying[]", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 10, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "date", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor", + "value": 0.2 + }, + { + "name": "autovacuum_analyze_threshold", + "value": 55 + }, + { + "name": "autovacuum_freeze_max_age", + "value": 20000000 + }, + { + "name": "autovacuum_vacuum_cost_delay", + "value": 25 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 10 + }, + { + "name": "autovacuum_vacuum_scale_factor", + "value": 0.3 + }, + { + "name": "autovacuum_vacuum_threshold", + "value": 60 + }, + { + "name": "autovacuum_freeze_min_age", + "value": 500000 + }, + { + "name": "autovacuum_freeze_table_age", + "value": 1300000 + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "autovacuum_custom": true + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_custom_autovacuum.sql", + "expected_msql_file": "create_table_with_custom_autovacuum_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add toast table", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#", + "autovacuum_enabled": "x", + "toast_autovacuum": true, + "toast_autovacuum_enabled": "f", + "vacuum_table": { + "changed": [ + { + "name": "autovacuum_analyze_threshold", + "value": 60 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 100 + } + ] + }, + "vacuum_toast": { + "changed": [ + { + "name": "autovacuum_freeze_max_age", + "value": 2000000 + }, + { + "name": "autovacuum_vacuum_cost_delay", + "value": 50 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 13 + }, + { + "name": "autovacuum_vacuum_threshold", + "value": 70 + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_with_toast_table.sql", + "expected_msql_file": "alter_table_with_toast_table_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with fk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with advanced options", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "relhasoids": true, + "description": "test comment", + "relpersistence": true, + "fillfactor": "50", + "parallel_workers": "", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "double precision", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "numrange", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": true, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "rlspolicy": true + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_advanced_options.sql", + "expected_msql_file": "create_table_with_advanced_options_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table update grants", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#", + "rlspolicy": false, + "forcerlspolicy": false, + "relacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + } + ] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_update_grants.sql", + "expected_msql_file": "alter_table_update_grants_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with advanced options", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table for like table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "like_tbl", + "columns": [ + { + "name": "id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "text" + } + ], + "primary_key": [ + { + "columns": [ + { + "column": "id" + } + ], + "include": [] + } + ], + "unique_constraint": [ + { + "name": "", + "columns": [ + { + "column": "name" + } + ], + "include": [] + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create Table using like table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "test ", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": true, + "like_constraints": true, + "like_indexes": true, + "like_storage": true, + "like_comments": true, + "like_relation": "public.like_tbl" + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "create_table_with_lik_tbl.sql", + "expected_msql_file": "create_table_with_lik_tbl_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table update grants", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#", + "description": "test comment", + "fillfactor": "13", + "replica_identity": "", + "relacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "D", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "x", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "t", + "privilege": true, + "with_grant": false + } + ] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_update_grants2.sql", + "expected_msql_file": "alter_table_update_grants2_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with advanced options", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with list partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_patition_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "partition table", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_active", + "values_in": "'ACTIVE'", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "list", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "status", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "status" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_partition.sql", + "expected_msql_file": "create_table_with_partition_msql.sql" + }, + { + "type": "create", + "name": "Create Table with range partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_range_patition_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_arr_small PARTITION", + "values_from": "20", + "values_to": "25", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "range", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "status", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "arr" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_range_partition.sql", + "expected_msql_file": "create_table_with_range_partition_msql.sql" + } + ] +} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/alter_table_with_toast_table.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/alter_table_with_toast_table.sql new file mode 100644 index 000000000..94de94678 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/alter_table_with_toast_table.sql @@ -0,0 +1,33 @@ +-- Table: public.table_with_custom_autovaccum_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" +( + col1 character varying(10)[] COLLATE pg_catalog."default", + col2 timestamp without time zone +) +WITH ( + OIDS = FALSE, + toast.autovacuum_enabled = FALSE, + autovacuum_analyze_scale_factor = 0.2, + autovacuum_analyze_threshold = 60, + autovacuum_freeze_max_age = 20000000, + autovacuum_vacuum_cost_delay = 25, + autovacuum_vacuum_cost_limit = 100, + autovacuum_vacuum_scale_factor = 0.3, + autovacuum_vacuum_threshold = 60, + autovacuum_freeze_min_age = 500000, + autovacuum_freeze_table_age = 1300000, + toast.autovacuum_freeze_max_age = 2000000, + toast.autovacuum_vacuum_cost_delay = 50, + toast.autovacuum_vacuum_cost_limit = 13, + toast.autovacuum_vacuum_threshold = 70 +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + IS 'custom auto vacuum'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/alter_table_with_toast_table_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/alter_table_with_toast_table_msql.sql new file mode 100644 index 000000000..a1a588be7 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/alter_table_with_toast_table_msql.sql @@ -0,0 +1,14 @@ +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" SET ( + autovacuum_analyze_threshold = 60, + autovacuum_vacuum_cost_limit = 100 +); +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" RESET ( + autovacuum_enabled +); +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" SET ( + toast.autovacuum_enabled = false, + toast.autovacuum_freeze_max_age = 2000000, + toast.autovacuum_vacuum_cost_delay = 50, + toast.autovacuum_vacuum_cost_limit = 13, + toast.autovacuum_vacuum_threshold = 70 +); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/create_table_with_hash_partition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/create_table_with_hash_partition.sql new file mode 100644 index 000000000..750ac33d7 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/create_table_with_hash_partition.sql @@ -0,0 +1,28 @@ +-- Table: public.table_with_hash_patition_$%{}[]()&*^!@\"'`\\/# + +-- DROP TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" +( + id bigint, + name text COLLATE pg_catalog."default", + arr numeric +) PARTITION BY HASH (id) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" + IS 'hash partition'; + +-- Partitions SQL + +CREATE TABLE IF NOT EXISTS public.cust_part11 PARTITION OF public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" + FOR VALUES WITH (modulus 2, remainder 1); + +ALTER TABLE public.cust_part11 + OWNER to enterprisedb; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/create_table_with_hash_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/create_table_with_hash_partition_msql.sql new file mode 100644 index 000000000..07bcc2397 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/create_table_with_hash_partition_msql.sql @@ -0,0 +1,18 @@ +CREATE TABLE IF NOT EXISTS public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" +( + id bigint, + name text, + arr numeric +) PARTITION BY HASH (id) +WITH ( + OIDS = FALSE +); + +ALTER TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" + IS 'hash partition'; + +CREATE TABLE IF NOT EXISTS public.cust_part11 PARTITION OF public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" + FOR VALUES WITH (MODULUS 2, REMAINDER 1); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/test.json new file mode 100644 index 000000000..0938743ca --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/11_plus/test.json @@ -0,0 +1,1986 @@ +{ + "scenarios": [ + { + "type": "create", + "name": "Create Table without primary key", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col3", + "cltype": "boolean", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col4", + "cltype": "character varying", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 30, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col5", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": 20, + "attprecision": 10, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col6", + "cltype": "timestamp with time zone", + "attacl": [], + "min_val_attlen": 0, + "max_val_attlen": 6, + "is_primary_key": false, + "attnotnull": false, + "attlen": 5, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_without_primary_key.sql", + "expected_msql_file": "create_table_without_primary_key_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table to change column data types", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "cltype": "bigint" + }, + { + "attnum": 2, + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "cltype": "character varying" + }, + { + "attnum": 6, + "attlen": null, + "cltype": "time without time zone" + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_change_col_data_type.sql", + "expected_msql_file": "alter_table_change_col_data_type_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add pk", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "attnotnull": true, + "is_primary_key": true + } + ] + }, + "primary_key": { + "added": [ + { + "columns": [ + { + "column": "col1" + } + ], + "include": [] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_pk_not_null_constraint.sql", + "expected_msql_file": "alter_table_add_pk_not_null_constraint_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add null constraint, rename column", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "name": "col1_rename", + "is_primary_key": false + }, + { + "attnum": 4, + "attnotnull": true + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_null_constraint_rename_col.sql", + "expected_msql_file": "alter_table_add_null_constraint_rename_col_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table add pk", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with primary key", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [ + { + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "integer", + "attacl": [], + "is_primary_key": true, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "json", + "attacl": [], + "is_primary_key": false, + "attnotnull": true, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_pk.sql", + "expected_msql_file": "create_table_with_pk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add columns", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "columns": { + "added": [ + { + "name": "col3_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": 10, + "attprecision": 5, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col4_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_cols.sql", + "expected_msql_file": "alter_table_add_cols_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table delete columns", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "columns": { + "deleted": [ + { + "attoptions": [], + "attacl": [], + "seclabels": [], + "name": "col2_$%{}[]()&*^!@\\\"'`\\\\/#", + "atttypid": 114, + "attnum": 2, + "cltype": "json", + "collspcname": "", + "description": null, + "edit_types": [ + "json", + "jsonb" + ], + "is_primary_key": false, + "attstattarget": -1, + "attnotnull": true, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attndims": 0, + "atttypmod": -1, + "attstorage": "x", + "defval": null, + "typname": "json", + "displaytypname": "json", + "elemoid": 114, + "typnspname": "pg_catalog", + "defaultstorage": "x", + "indkey": "1", + "isdup": false, + "is_fk": false, + "is_sys_column": false, + "relname": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "is_view_only": false, + "is_pk": false, + "old_attidentity": "a" + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_delete_cols.sql", + "expected_msql_file": "alter_table_delete_cols_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table delete columns", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with pk & check constraint", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "create table comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [ + { + "name": "custom_pk", + "comment": "custom pk created", + "fillfactor": "11", + "condeferrable": true, + "condeferred": true, + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "time with time zone", + "attacl": [], + "min_val_attlen": 0, + "max_val_attlen": 6, + "is_primary_key": false, + "attnotnull": false, + "attlen": 5, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "character", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 12, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [ + { + "name": "chk_const", + "consrc": "col2 != null", + "convalidated": false, + "comment": "chk const comment" + } + ], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_pk_chk.sql", + "expected_msql_file": "create_table_with_pk_chk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add unique constraint", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "unique_constraint": { + "added": [ + { + "name": "unique", + "fillfactor": "13", + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ] + } + }, + "expected_sql_file": "alter_table_add_unique_const.sql", + "expected_msql_file": "alter_table_add_unique_const_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table delete constraints", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "check_constraint": { + "deleted": [ + { + "name": "chk_const", + "consrc": "col2 <> NULL::bpchar", + "connoinherit": false, + "convalidated": false, + "relname": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "nspname": "public", + "comment": "chk const comment", + "conislocal": true + } + ] + }, + "unique_constraint": { + "deleted": [ + { + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"\"'`\\\\/#" + } + ], + "name": "unique", + "comment": null, + "spcname": "pg_default", + "fillfactor": "13", + "condeferrable": false, + "condeferred": false, + "include": [], + "col_count": 1, + "conislocal": true + } + ] + } + }, + "expected_sql_file": "alter_table_delete_constraints.sql", + "expected_msql_file": "alter_table_delete_constraints_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with pk & chk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table for FK reference", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "fk_reference_tbl", + "columns": [ + { + "name": "id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "bigint" + } + ], + "primary_key": [ + { + "columns": [ + { + "column": "id" + } + ], + "include": [] + } + ], + "unique_constraint": [ + { + "name": "", + "columns": [ + { + "column": "name" + } + ], + "include": [] + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create Table with fk constraint", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col3", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [ + { + "name": "fk_test", + "comment": "fk comment", + "condeferrable": true, + "confmatchtype": true, + "columns": [ + { + "local_column": "col1", + "references": "", + "referenced": "id" + } + ], + "confupdtype": "a", + "confdeltype": "a", + "autoindex": false, + "coveringindex": null + } + ], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "create_table_with_fk.sql", + "expected_msql_file": "create_table_with_fk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add one more fk", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "foreign_key": { + "added": [ + { + "name": "fk2", + "columns": [ + { + "local_column": "col2", + "references": "", + "referenced": "name" + } + ], + "confupdtype": "a", + "confdeltype": "a", + "autoindex": false, + "coveringindex": null + } + ] + } + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "alter_table_add_another_fk.sql", + "expected_msql_file": "alter_table_add_another_fk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add exclude constraint", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "exclude_constraint": { + "added": [ + { + "name": "ex_constr", + "amname": "gist", + "columns": [ + { + "column": "col1", + "is_exp": false, + "order": false, + "nulls_order": false, + "operator": "<>", + "is_sort_nulls_applicable": false + } + ], + "include": [] + } + ] + } + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "alter_table_add_exclude_constraint.sql", + "expected_msql_file": "alter_table_add_exclude_constraint_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with fk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with custom auto-vacuum", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "custom auto vacuum", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "t", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "character varying[]", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 10, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "date", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor", + "value": 0.2 + }, + { + "name": "autovacuum_analyze_threshold", + "value": 55 + }, + { + "name": "autovacuum_freeze_max_age", + "value": 20000000 + }, + { + "name": "autovacuum_vacuum_cost_delay", + "value": 25 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 10 + }, + { + "name": "autovacuum_vacuum_scale_factor", + "value": 0.3 + }, + { + "name": "autovacuum_vacuum_threshold", + "value": 60 + }, + { + "name": "autovacuum_freeze_min_age", + "value": 500000 + }, + { + "name": "autovacuum_freeze_table_age", + "value": 1300000 + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "autovacuum_custom": true + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_custom_autovacuum.sql", + "expected_msql_file": "create_table_with_custom_autovacuum_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add toast table", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#", + "autovacuum_enabled": "x", + "toast_autovacuum": true, + "toast_autovacuum_enabled": "f", + "vacuum_table": { + "changed": [ + { + "name": "autovacuum_analyze_threshold", + "value": 60 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 100 + } + ] + }, + "vacuum_toast": { + "changed": [ + { + "name": "autovacuum_freeze_max_age", + "value": 2000000 + }, + { + "name": "autovacuum_vacuum_cost_delay", + "value": 50 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 13 + }, + { + "name": "autovacuum_vacuum_threshold", + "value": 70 + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_with_toast_table.sql", + "expected_msql_file": "alter_table_with_toast_table_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with fk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with advanced options", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "relhasoids": true, + "description": "test comment", + "relpersistence": true, + "fillfactor": "50", + "parallel_workers": "", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "double precision", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "numrange", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": true, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "rlspolicy": true + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_advanced_options.sql", + "expected_msql_file": "create_table_with_advanced_options_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table update grants", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#", + "rlspolicy": false, + "forcerlspolicy": false, + "relacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + } + ] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_update_grants.sql", + "expected_msql_file": "alter_table_update_grants_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with advanced options", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table for like table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "like_tbl", + "columns": [ + { + "name": "id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "text" + } + ], + "primary_key": [ + { + "columns": [ + { + "column": "id" + } + ], + "include": [] + } + ], + "unique_constraint": [ + { + "name": "", + "columns": [ + { + "column": "name" + } + ], + "include": [] + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create Table using like table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "test ", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": true, + "like_constraints": true, + "like_indexes": true, + "like_storage": true, + "like_comments": true, + "like_relation": "public.like_tbl" + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "create_table_with_lik_tbl.sql", + "expected_msql_file": "create_table_with_lik_tbl_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table update grants", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#", + "description": "test comment", + "fillfactor": "13", + "replica_identity": "", + "relacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "D", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "x", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "t", + "privilege": true, + "with_grant": false + } + ] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_update_grants2.sql", + "expected_msql_file": "alter_table_update_grants2_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with advanced options", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with list partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_patition_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "partition table", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_active", + "values_in": "'ACTIVE'", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "list", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "status", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "status" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_partition.sql", + "expected_msql_file": "create_table_with_partition_msql.sql" + }, + { + "type": "create", + "name": "Create Table with range partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_range_patition_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_arr_small PARTITION", + "values_from": "20", + "values_to": "25", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "range", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "status", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "arr" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_range_partition.sql", + "expected_msql_file": "create_table_with_range_partition_msql.sql" + }, + { + "type": "create", + "name": "Create Table with hash partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_hash_patition_$%{}[]()&*^!@\\\"'`\\\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "hash partition", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_part11", + "values_modulus": "2", + "values_remainder": "1", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "hash", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "name", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "id" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_hash_partition.sql", + "expected_msql_file": "create_table_with_hash_partition_msql.sql" + } + ] +} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_another_fk.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_another_fk.sql new file mode 100644 index 000000000..3c7cc8e4a --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_another_fk.sql @@ -0,0 +1,31 @@ +-- Table: public.table_with_fk_constraints$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" +( + col1 integer, + col2 bigint, + col3 text COLLATE pg_catalog."default", + CONSTRAINT fk2 FOREIGN KEY (col2) + REFERENCES public.fk_reference_tbl (name) MATCH SIMPLE + ON UPDATE NO ACTION + ON DELETE NO ACTION + NOT VALID, + CONSTRAINT fk_test FOREIGN KEY (col1) + REFERENCES public.fk_reference_tbl (id) MATCH FULL + ON UPDATE NO ACTION + ON DELETE NO ACTION + DEFERRABLE +) + +TABLESPACE pg_default; + +ALTER TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'test comment'; + +COMMENT ON CONSTRAINT fk_test ON public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'fk comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_another_fk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_another_fk_msql.sql new file mode 100644 index 000000000..bdcbfcb62 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_another_fk_msql.sql @@ -0,0 +1,6 @@ +ALTER TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT fk2 FOREIGN KEY (col2) + REFERENCES public.fk_reference_tbl (name) + ON UPDATE NO ACTION + ON DELETE NO ACTION + NOT VALID; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_cols.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_cols.sql new file mode 100644 index 000000000..a92d8c8ed --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_cols.sql @@ -0,0 +1,20 @@ +-- Table: public.simple_table_with_pk$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" integer NOT NULL, + "col2_$%{}[]()&*^!@\""'`\\/#" json NOT NULL, + "col3_$%{}[]()&*^!@\""'`\\/#" numeric(10,5), + "col4_$%{}[]()&*^!@\""'`\\/#" text COLLATE pg_catalog."default", + CONSTRAINT "simple_table_with_pk$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY ("col1_$%{}[]()&*^!@\""""'`\\/#") +) + +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_cols_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_cols_msql.sql new file mode 100644 index 000000000..776060df2 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_cols_msql.sql @@ -0,0 +1,5 @@ +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + ADD COLUMN "col3_$%{}[]()&*^!@\""'`\\/#" numeric(10, 5); + +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + ADD COLUMN "col4_$%{}[]()&*^!@\""'`\\/#" text; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_exclude_constraint.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_exclude_constraint.sql new file mode 100644 index 000000000..df8debbe1 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_exclude_constraint.sql @@ -0,0 +1,34 @@ +-- Table: public.table_with_fk_constraints$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" +( + col1 integer, + col2 bigint, + col3 text COLLATE pg_catalog."default", + CONSTRAINT fk2 FOREIGN KEY (col2) + REFERENCES public.fk_reference_tbl (name) MATCH SIMPLE + ON UPDATE NO ACTION + ON DELETE NO ACTION + NOT VALID, + CONSTRAINT fk_test FOREIGN KEY (col1) + REFERENCES public.fk_reference_tbl (id) MATCH FULL + ON UPDATE NO ACTION + ON DELETE NO ACTION + DEFERRABLE, + CONSTRAINT ex_constr EXCLUDE USING gist ( + col1 WITH <>) + +) + +TABLESPACE pg_default; + +ALTER TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'test comment'; + +COMMENT ON CONSTRAINT fk_test ON public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'fk comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_exclude_constraint_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_exclude_constraint_msql.sql new file mode 100644 index 000000000..3a027c684 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_exclude_constraint_msql.sql @@ -0,0 +1,3 @@ +ALTER TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT ex_constr EXCLUDE USING gist ( + col1 WITH <>); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_null_constraint_rename_col.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_null_constraint_rename_col.sql new file mode 100644 index 000000000..8bbef97a0 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_null_constraint_rename_col.sql @@ -0,0 +1,22 @@ +-- Table: public.simple_table_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_$%{}[]()&*^!@""'`\/#" +( + col1_rename bigint NOT NULL, + col2 character varying COLLATE pg_catalog."default", + col3 boolean, + col4 character varying(30) COLLATE pg_catalog."default" NOT NULL, + col5 numeric(20,10), + col6 time(5) without time zone, + CONSTRAINT "simple_table_$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY (col1_rename) +) + +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_null_constraint_rename_col_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_null_constraint_rename_col_msql.sql new file mode 100644 index 000000000..bf6a926cb --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_null_constraint_rename_col_msql.sql @@ -0,0 +1,5 @@ +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + RENAME col1 TO col1_rename; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN col4 SET NOT NULL; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_partition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_partition.sql new file mode 100644 index 000000000..569f7cfa0 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_partition.sql @@ -0,0 +1,34 @@ +-- Table: public.table_with_patition_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_patition_$%{}[]()&*^!@""'`\/#" +( + id integer, + status text COLLATE pg_catalog."default", + arr numeric +) PARTITION BY LIST (status); + +ALTER TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#" + IS 'partition table'; + +-- Partitions SQL + +CREATE TABLE IF NOT EXISTS public.cust_active PARTITION OF public."table_with_patition_$%{}[]()&*^!@""'`\/#" + FOR VALUES IN ('ACTIVE'); + +ALTER TABLE public.cust_active + OWNER to postgres; +CREATE TABLE IF NOT EXISTS public.cust_active PARTITION OF public."table_with_patition_$%{}[]()&*^!@""'`\/#" + FOR VALUES IN ('ACTIVE'); + +ALTER TABLE public.cust_active + OWNER to postgres; +CREATE TABLE IF NOT EXISTS public.cust_archived PARTITION OF public."table_with_patition_$%{}[]()&*^!@""'`\/#" + FOR VALUES IN ('EXPIRED'); + +ALTER TABLE public.cust_archived + OWNER to postgres; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_pk_not_null_constraint.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_pk_not_null_constraint.sql new file mode 100644 index 000000000..897172037 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_pk_not_null_constraint.sql @@ -0,0 +1,22 @@ +-- Table: public.simple_table_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_$%{}[]()&*^!@""'`\/#" +( + col1 bigint NOT NULL, + col2 character varying COLLATE pg_catalog."default", + col3 boolean, + col4 character varying(30) COLLATE pg_catalog."default", + col5 numeric(20,10), + col6 time(5) without time zone, + CONSTRAINT "simple_table_$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY (col1) +) + +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_pk_not_null_constraint_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_pk_not_null_constraint_msql.sql new file mode 100644 index 000000000..628422d72 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_pk_not_null_constraint_msql.sql @@ -0,0 +1,4 @@ +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN col1 SET NOT NULL; +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + ADD PRIMARY KEY (col1); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_unique_const.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_unique_const.sql new file mode 100644 index 000000000..2337fb64f --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_unique_const.sql @@ -0,0 +1,28 @@ +-- Table: public.table_with_pk_chk_constraints$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" time(5) with time zone NOT NULL, + col2 character(12) COLLATE pg_catalog."default", + CONSTRAINT custom_pk PRIMARY KEY ("col1_$%{}[]()&*^!@\""""'`\\/#") + WITH (FILLFACTOR=11) + DEFERRABLE INITIALLY DEFERRED, + CONSTRAINT "unique" UNIQUE ("col1_$%{}[]()&*^!@\""""'`\\/#") + WITH (FILLFACTOR=13), + CONSTRAINT chk_const CHECK (col2 <> NULL::bpchar) +) + +TABLESPACE pg_default; + +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'create table comment'; +COMMENT ON CONSTRAINT custom_pk ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'custom pk created'; + +COMMENT ON CONSTRAINT chk_const ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'chk const comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_unique_const_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_unique_const_msql.sql new file mode 100644 index 000000000..d5ade04d6 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_add_unique_const_msql.sql @@ -0,0 +1,3 @@ +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT "unique" UNIQUE ("col1_$%{}[]()&*^!@\""'`\\/#") + WITH (FILLFACTOR=13); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_change_col_data_type.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_change_col_data_type.sql new file mode 100644 index 000000000..660419b58 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_change_col_data_type.sql @@ -0,0 +1,21 @@ +-- Table: public.simple_table_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_$%{}[]()&*^!@""'`\/#" +( + col1 bigint, + col2 character varying COLLATE pg_catalog."default", + col3 boolean, + col4 character varying(30) COLLATE pg_catalog."default", + col5 numeric(20,10), + col6 time(5) without time zone +) + +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_change_col_data_type_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_change_col_data_type_msql.sql new file mode 100644 index 000000000..290f24244 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_change_col_data_type_msql.sql @@ -0,0 +1,8 @@ +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN col1 TYPE bigint; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN col2 TYPE character varying COLLATE pg_catalog."default"; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN col6 TYPE time(5) without time zone ; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_delete_cols.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_delete_cols.sql new file mode 100644 index 000000000..d7857c7b7 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_delete_cols.sql @@ -0,0 +1,19 @@ +-- Table: public.simple_table_with_pk$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" integer NOT NULL, + "col3_$%{}[]()&*^!@\""'`\\/#" numeric(10,5), + "col4_$%{}[]()&*^!@\""'`\\/#" text COLLATE pg_catalog."default", + CONSTRAINT "simple_table_with_pk$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY ("col1_$%{}[]()&*^!@\""""'`\\/#") +) + +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_delete_cols_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_delete_cols_msql.sql new file mode 100644 index 000000000..673ff675b --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_delete_cols_msql.sql @@ -0,0 +1 @@ +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" DROP COLUMN "col2_$%{}[]()&*^!@\""'`\\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_delete_constraints.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_delete_constraints.sql new file mode 100644 index 000000000..644a3a762 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_delete_constraints.sql @@ -0,0 +1,22 @@ +-- Table: public.table_with_pk_chk_constraints$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" time(5) with time zone NOT NULL, + col2 character(12) COLLATE pg_catalog."default", + CONSTRAINT custom_pk PRIMARY KEY ("col1_$%{}[]()&*^!@\""""'`\\/#") + WITH (FILLFACTOR=11) + DEFERRABLE INITIALLY DEFERRED +) + +TABLESPACE pg_default; + +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'create table comment'; +COMMENT ON CONSTRAINT custom_pk ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'custom pk created'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_delete_constraints_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_delete_constraints_msql.sql new file mode 100644 index 000000000..47a3cf8db --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_delete_constraints_msql.sql @@ -0,0 +1,2 @@ +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" DROP CONSTRAINT "unique"; +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" DROP CONSTRAINT chk_const; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_update_grants.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_update_grants.sql new file mode 100644 index 000000000..bb4872d37 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_update_grants.sql @@ -0,0 +1,24 @@ +-- Table: public.table_with_advanced_options_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#"; + +CREATE UNLOGGED TABLE IF NOT EXISTS public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" +( + col1 double precision, + col2 numrange +) + +WITH ( + FILLFACTOR = 50 +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +GRANT ALL ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" TO enterprisedb; + +GRANT SELECT ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" TO PUBLIC; + +COMMENT ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_update_grants2.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_update_grants2.sql new file mode 100644 index 000000000..c28a10a77 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_update_grants2.sql @@ -0,0 +1,26 @@ +-- Table: public.table_like_tbl$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_like_tbl$%{}[]()&*^!@""'`\/#" +( + id integer NOT NULL, + name text COLLATE pg_catalog."default", + CONSTRAINT "table_like_tbl$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY (id), + CONSTRAINT "table_like_tbl$%{}[]()&*^!@""'`\/#_name_key" UNIQUE (name) +) + +WITH ( + FILLFACTOR = 13 +) +TABLESPACE pg_default; + +ALTER TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +GRANT ALL ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" TO enterprisedb; + +GRANT REFERENCES, TRIGGER, TRUNCATE ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" TO PUBLIC; + +COMMENT ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_update_grants2_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_update_grants2_msql.sql new file mode 100644 index 000000000..0213d64fa --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_update_grants2_msql.sql @@ -0,0 +1,7 @@ +ALTER TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + SET (FILLFACTOR=13); + +COMMENT ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + IS 'test comment'; + +GRANT TRUNCATE, REFERENCES, TRIGGER ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" TO PUBLIC; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_update_grants_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_update_grants_msql.sql new file mode 100644 index 000000000..363195b79 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_update_grants_msql.sql @@ -0,0 +1,7 @@ +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + DISABLE ROW LEVEL SECURITY; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + NO FORCE ROW LEVEL SECURITY; + +GRANT SELECT ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" TO PUBLIC; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_with_toast_table.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_with_toast_table.sql new file mode 100644 index 000000000..08ccc0d10 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_with_toast_table.sql @@ -0,0 +1,33 @@ +-- Table: public.table_with_custom_autovaccum_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" +( + col1 character varying(10)[] COLLATE pg_catalog."default", + col2 timestamp without time zone +) + +WITH ( + toast.autovacuum_enabled = FALSE, + autovacuum_analyze_scale_factor = 0.2, + autovacuum_analyze_threshold = 60, + autovacuum_freeze_max_age = 20000000, + autovacuum_vacuum_cost_delay = 25, + autovacuum_vacuum_cost_limit = 100, + autovacuum_vacuum_scale_factor = 0.3, + autovacuum_vacuum_threshold = 60, + autovacuum_freeze_min_age = 500000, + autovacuum_freeze_table_age = 1300000, + toast.autovacuum_freeze_max_age = 2000000, + toast.autovacuum_vacuum_cost_delay = 50, + toast.autovacuum_vacuum_cost_limit = 13, + toast.autovacuum_vacuum_threshold = 70 +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + IS 'custom auto vacuum'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_with_toast_table_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_with_toast_table_msql.sql new file mode 100644 index 000000000..a1a588be7 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/alter_table_with_toast_table_msql.sql @@ -0,0 +1,14 @@ +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" SET ( + autovacuum_analyze_threshold = 60, + autovacuum_vacuum_cost_limit = 100 +); +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" RESET ( + autovacuum_enabled +); +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" SET ( + toast.autovacuum_enabled = false, + toast.autovacuum_freeze_max_age = 2000000, + toast.autovacuum_vacuum_cost_delay = 50, + toast.autovacuum_vacuum_cost_limit = 13, + toast.autovacuum_vacuum_threshold = 70 +); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_advanced_options.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_advanced_options.sql new file mode 100644 index 000000000..5c8b14229 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_advanced_options.sql @@ -0,0 +1,26 @@ +-- Table: public.table_with_advanced_options_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#"; + +CREATE UNLOGGED TABLE IF NOT EXISTS public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" +( + col1 double precision, + col2 numrange +) + +WITH ( + FILLFACTOR = 50 +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + ENABLE ROW LEVEL SECURITY; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + FORCE ROW LEVEL SECURITY; + +COMMENT ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_advanced_options_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_advanced_options_msql.sql new file mode 100644 index 000000000..df6124f75 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_advanced_options_msql.sql @@ -0,0 +1,21 @@ +CREATE UNLOGGED TABLE IF NOT EXISTS public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" +( + col1 double precision, + col2 numrange +) + +WITH ( + FILLFACTOR = 50 +); + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + ENABLE ROW LEVEL SECURITY; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + FORCE ROW LEVEL SECURITY; + +COMMENT ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_custom_autovacuum.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_custom_autovacuum.sql new file mode 100644 index 000000000..5318261b0 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_custom_autovacuum.sql @@ -0,0 +1,29 @@ +-- Table: public.table_with_custom_autovaccum_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" +( + col1 character varying(10)[] COLLATE pg_catalog."default", + col2 timestamp without time zone +) + +WITH ( + autovacuum_enabled = TRUE, + autovacuum_analyze_scale_factor = 0.2, + autovacuum_analyze_threshold = 55, + autovacuum_freeze_max_age = 20000000, + autovacuum_vacuum_cost_delay = 25, + autovacuum_vacuum_cost_limit = 10, + autovacuum_vacuum_scale_factor = 0.3, + autovacuum_vacuum_threshold = 60, + autovacuum_freeze_min_age = 500000, + autovacuum_freeze_table_age = 1300000 +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + IS 'custom auto vacuum'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_custom_autovacuum_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_custom_autovacuum_msql.sql new file mode 100644 index 000000000..178f38473 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_custom_autovacuum_msql.sql @@ -0,0 +1,24 @@ +CREATE TABLE IF NOT EXISTS public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" +( + col1 character varying(10)[], + col2 date +) + +WITH ( + autovacuum_enabled = TRUE, + autovacuum_analyze_scale_factor = 0.2, + autovacuum_analyze_threshold = 55, + autovacuum_freeze_max_age = 20000000, + autovacuum_vacuum_cost_delay = 25, + autovacuum_vacuum_cost_limit = 10, + autovacuum_vacuum_scale_factor = 0.3, + autovacuum_vacuum_threshold = 60, + autovacuum_freeze_min_age = 500000, + autovacuum_freeze_table_age = 1300000 +); + +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + IS 'custom auto vacuum'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_fk.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_fk.sql new file mode 100644 index 000000000..43ce55fa7 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_fk.sql @@ -0,0 +1,26 @@ +-- Table: public.table_with_fk_constraints$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" +( + col1 integer, + col2 bigint, + col3 text COLLATE pg_catalog."default", + CONSTRAINT fk_test FOREIGN KEY (col1) + REFERENCES public.fk_reference_tbl (id) MATCH FULL + ON UPDATE NO ACTION + ON DELETE NO ACTION + DEFERRABLE +) + +TABLESPACE pg_default; + +ALTER TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'test comment'; + +COMMENT ON CONSTRAINT fk_test ON public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'fk comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_fk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_fk_msql.sql new file mode 100644 index 000000000..19aa1c9e1 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_fk_msql.sql @@ -0,0 +1,21 @@ +CREATE TABLE IF NOT EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" +( + col1 integer, + col2 bigint, + col3 text, + CONSTRAINT fk_test FOREIGN KEY (col1) + REFERENCES public.fk_reference_tbl (id) MATCH FULL + ON UPDATE NO ACTION + ON DELETE NO ACTION + DEFERRABLE + NOT VALID +); + +ALTER TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'test comment'; + +COMMENT ON CONSTRAINT fk_test ON public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'fk comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_hash_partition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_hash_partition.sql new file mode 100644 index 000000000..dcb9005ae --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_hash_partition.sql @@ -0,0 +1,24 @@ +-- Table: public.table_with_hash_patition_$%{}[]()&*^!@\"'`\\/# + +-- DROP TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" +( + id bigint, + name text COLLATE pg_catalog."default", + arr numeric +) PARTITION BY HASH (id); + +ALTER TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" + IS 'hash partition'; + +-- Partitions SQL + +CREATE TABLE IF NOT EXISTS public.cust_part11 PARTITION OF public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" + FOR VALUES WITH (modulus 2, remainder 1); + +ALTER TABLE public.cust_part11 + OWNER to enterprisedb; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_hash_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_hash_partition_msql.sql new file mode 100644 index 000000000..6335e6930 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_hash_partition_msql.sql @@ -0,0 +1,15 @@ +CREATE TABLE IF NOT EXISTS public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" +( + id bigint, + name text, + arr numeric +) PARTITION BY HASH (id); + +ALTER TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" + IS 'hash partition'; + +CREATE TABLE IF NOT EXISTS public.cust_part11 PARTITION OF public."table_with_hash_patition_$%{}[]()&*^!@\""'`\\/#" + FOR VALUES WITH (MODULUS 2, REMAINDER 1); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_lik_tbl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_lik_tbl.sql new file mode 100644 index 000000000..53f33e9b0 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_lik_tbl.sql @@ -0,0 +1,19 @@ +-- Table: public.table_like_tbl$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_like_tbl$%{}[]()&*^!@""'`\/#" +( + id integer NOT NULL, + name text COLLATE pg_catalog."default", + CONSTRAINT "table_like_tbl$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY (id), + CONSTRAINT "table_like_tbl$%{}[]()&*^!@""'`\/#_name_key" UNIQUE (name) +) + +TABLESPACE pg_default; + +ALTER TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + IS 'test '; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_lik_tbl_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_lik_tbl_msql.sql new file mode 100644 index 000000000..aece04364 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_lik_tbl_msql.sql @@ -0,0 +1,16 @@ +CREATE TABLE IF NOT EXISTS public."table_like_tbl$%{}[]()&*^!@""'`\/#" +( + LIKE public.like_tbl + INCLUDING DEFAULTS + INCLUDING CONSTRAINTS + INCLUDING INDEXES + INCLUDING STORAGE + INCLUDING COMMENTS + +); + +ALTER TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + IS 'test '; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_partition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_partition.sql new file mode 100644 index 000000000..30c085ab0 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_partition.sql @@ -0,0 +1,24 @@ +-- Table: public.table_with_patition_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_patition_$%{}[]()&*^!@""'`\/#" +( + id integer, + status text COLLATE pg_catalog."default", + arr numeric +) PARTITION BY LIST (status); + +ALTER TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#" + IS 'partition table'; + +-- Partitions SQL + +CREATE TABLE IF NOT EXISTS public.cust_active PARTITION OF public."table_with_patition_$%{}[]()&*^!@""'`\/#" + FOR VALUES IN ('ACTIVE'); + +ALTER TABLE public.cust_active + OWNER to enterprisedb; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_partition_msql.sql new file mode 100644 index 000000000..cec8de288 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_partition_msql.sql @@ -0,0 +1,15 @@ +CREATE TABLE IF NOT EXISTS public."table_with_patition_$%{}[]()&*^!@""'`\/#" +( + id integer, + status text, + arr numeric +) PARTITION BY LIST (status); + +ALTER TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_patition_$%{}[]()&*^!@""'`\/#" + IS 'partition table'; + +CREATE TABLE IF NOT EXISTS public.cust_active PARTITION OF public."table_with_patition_$%{}[]()&*^!@""'`\/#" + FOR VALUES IN ('ACTIVE'); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_pk.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_pk.sql new file mode 100644 index 000000000..c8b032010 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_pk.sql @@ -0,0 +1,18 @@ +-- Table: public.simple_table_with_pk$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" integer NOT NULL, + "col2_$%{}[]()&*^!@\""'`\\/#" json NOT NULL, + CONSTRAINT "simple_table_with_pk$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY ("col1_$%{}[]()&*^!@\""""'`\\/#") +) + +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_pk_chk.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_pk_chk.sql new file mode 100644 index 000000000..7669add67 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_pk_chk.sql @@ -0,0 +1,26 @@ +-- Table: public.table_with_pk_chk_constraints$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" time(5) with time zone NOT NULL, + col2 character(12) COLLATE pg_catalog."default", + CONSTRAINT custom_pk PRIMARY KEY ("col1_$%{}[]()&*^!@\""""'`\\/#") + WITH (FILLFACTOR=11) + DEFERRABLE INITIALLY DEFERRED, + CONSTRAINT chk_const CHECK (col2 <> NULL::bpchar) +) + +TABLESPACE pg_default; + +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'create table comment'; +COMMENT ON CONSTRAINT custom_pk ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'custom pk created'; + +COMMENT ON CONSTRAINT chk_const ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'chk const comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_pk_chk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_pk_chk_msql.sql new file mode 100644 index 000000000..6be77999e --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_pk_chk_msql.sql @@ -0,0 +1,20 @@ +CREATE TABLE IF NOT EXISTS public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" time(5) with time zone, + col2 character(12), + CONSTRAINT custom_pk PRIMARY KEY ("col1_$%{}[]()&*^!@\""'`\\/#") + WITH (FILLFACTOR=11) + DEFERRABLE INITIALLY DEFERRED, + CONSTRAINT chk_const CHECK (col2 != null) +); + +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'create table comment'; +COMMENT ON CONSTRAINT custom_pk ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'custom pk created'; + +COMMENT ON CONSTRAINT chk_const ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'chk const comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_pk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_pk_msql.sql new file mode 100644 index 000000000..a34aa01ec --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_pk_msql.sql @@ -0,0 +1,12 @@ +CREATE TABLE IF NOT EXISTS public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" integer, + "col2_$%{}[]()&*^!@\""'`\\/#" json NOT NULL, + PRIMARY KEY ("col1_$%{}[]()&*^!@\""'`\\/#") +); + +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_range_partition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_range_partition.sql new file mode 100644 index 000000000..d0b66e47c --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_range_partition.sql @@ -0,0 +1,21 @@ +-- Table: public.table_with_range_patition_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_range_patition_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_range_patition_$%{}[]()&*^!@""'`\/#" +( + id integer, + status text COLLATE pg_catalog."default", + arr numeric +) PARTITION BY RANGE (arr); + +ALTER TABLE public."table_with_range_patition_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +-- Partitions SQL + +CREATE TABLE IF NOT EXISTS public."cust_arr_small PARTITION" PARTITION OF public."table_with_range_patition_$%{}[]()&*^!@""'`\/#" + FOR VALUES FROM ('20') TO ('25'); + +ALTER TABLE public."cust_arr_small PARTITION" + OWNER to enterprisedb; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_range_partition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_range_partition_msql.sql new file mode 100644 index 000000000..d1f690feb --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_with_range_partition_msql.sql @@ -0,0 +1,12 @@ +CREATE TABLE IF NOT EXISTS public."table_with_range_patition_$%{}[]()&*^!@""'`\/#" +( + id integer, + status text, + arr numeric +) PARTITION BY RANGE (arr); + +ALTER TABLE public."table_with_range_patition_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +CREATE TABLE IF NOT EXISTS public."cust_arr_small PARTITION" PARTITION OF public."table_with_range_patition_$%{}[]()&*^!@""'`\/#" + FOR VALUES FROM (20) TO (25); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_without_primary_key.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_without_primary_key.sql new file mode 100644 index 000000000..21a61793c --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_without_primary_key.sql @@ -0,0 +1,21 @@ +-- Table: public.simple_table_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_$%{}[]()&*^!@""'`\/#" +( + col1 integer, + col2 text COLLATE pg_catalog."default", + col3 boolean, + col4 character varying(30) COLLATE pg_catalog."default", + col5 numeric(20,10), + col6 timestamp(5) with time zone +) + +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_without_primary_key_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_without_primary_key_msql.sql new file mode 100644 index 000000000..4b454e18c --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/create_table_without_primary_key_msql.sql @@ -0,0 +1,15 @@ +CREATE TABLE IF NOT EXISTS public."simple_table_$%{}[]()&*^!@""'`\/#" +( + col1 integer, + col2 text, + col3 boolean, + col4 character varying(30), + col5 numeric(20, 10), + col6 timestamp(5) with time zone +); + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/test.json new file mode 100644 index 000000000..0938743ca --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/12_plus/test.json @@ -0,0 +1,1986 @@ +{ + "scenarios": [ + { + "type": "create", + "name": "Create Table without primary key", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col3", + "cltype": "boolean", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col4", + "cltype": "character varying", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 30, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col5", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": 20, + "attprecision": 10, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col6", + "cltype": "timestamp with time zone", + "attacl": [], + "min_val_attlen": 0, + "max_val_attlen": 6, + "is_primary_key": false, + "attnotnull": false, + "attlen": 5, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_without_primary_key.sql", + "expected_msql_file": "create_table_without_primary_key_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table to change column data types", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "cltype": "bigint" + }, + { + "attnum": 2, + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "cltype": "character varying" + }, + { + "attnum": 6, + "attlen": null, + "cltype": "time without time zone" + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_change_col_data_type.sql", + "expected_msql_file": "alter_table_change_col_data_type_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add pk", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "attnotnull": true, + "is_primary_key": true + } + ] + }, + "primary_key": { + "added": [ + { + "columns": [ + { + "column": "col1" + } + ], + "include": [] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_pk_not_null_constraint.sql", + "expected_msql_file": "alter_table_add_pk_not_null_constraint_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add null constraint, rename column", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "name": "col1_rename", + "is_primary_key": false + }, + { + "attnum": 4, + "attnotnull": true + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_null_constraint_rename_col.sql", + "expected_msql_file": "alter_table_add_null_constraint_rename_col_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table add pk", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with primary key", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [ + { + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "integer", + "attacl": [], + "is_primary_key": true, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "json", + "attacl": [], + "is_primary_key": false, + "attnotnull": true, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_pk.sql", + "expected_msql_file": "create_table_with_pk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add columns", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "columns": { + "added": [ + { + "name": "col3_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": 10, + "attprecision": 5, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col4_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_cols.sql", + "expected_msql_file": "alter_table_add_cols_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table delete columns", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "columns": { + "deleted": [ + { + "attoptions": [], + "attacl": [], + "seclabels": [], + "name": "col2_$%{}[]()&*^!@\\\"'`\\\\/#", + "atttypid": 114, + "attnum": 2, + "cltype": "json", + "collspcname": "", + "description": null, + "edit_types": [ + "json", + "jsonb" + ], + "is_primary_key": false, + "attstattarget": -1, + "attnotnull": true, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attndims": 0, + "atttypmod": -1, + "attstorage": "x", + "defval": null, + "typname": "json", + "displaytypname": "json", + "elemoid": 114, + "typnspname": "pg_catalog", + "defaultstorage": "x", + "indkey": "1", + "isdup": false, + "is_fk": false, + "is_sys_column": false, + "relname": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "is_view_only": false, + "is_pk": false, + "old_attidentity": "a" + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_delete_cols.sql", + "expected_msql_file": "alter_table_delete_cols_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table delete columns", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with pk & check constraint", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "create table comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [ + { + "name": "custom_pk", + "comment": "custom pk created", + "fillfactor": "11", + "condeferrable": true, + "condeferred": true, + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "time with time zone", + "attacl": [], + "min_val_attlen": 0, + "max_val_attlen": 6, + "is_primary_key": false, + "attnotnull": false, + "attlen": 5, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "character", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 12, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [ + { + "name": "chk_const", + "consrc": "col2 != null", + "convalidated": false, + "comment": "chk const comment" + } + ], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_pk_chk.sql", + "expected_msql_file": "create_table_with_pk_chk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add unique constraint", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "unique_constraint": { + "added": [ + { + "name": "unique", + "fillfactor": "13", + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ] + } + }, + "expected_sql_file": "alter_table_add_unique_const.sql", + "expected_msql_file": "alter_table_add_unique_const_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table delete constraints", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "check_constraint": { + "deleted": [ + { + "name": "chk_const", + "consrc": "col2 <> NULL::bpchar", + "connoinherit": false, + "convalidated": false, + "relname": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "nspname": "public", + "comment": "chk const comment", + "conislocal": true + } + ] + }, + "unique_constraint": { + "deleted": [ + { + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"\"'`\\\\/#" + } + ], + "name": "unique", + "comment": null, + "spcname": "pg_default", + "fillfactor": "13", + "condeferrable": false, + "condeferred": false, + "include": [], + "col_count": 1, + "conislocal": true + } + ] + } + }, + "expected_sql_file": "alter_table_delete_constraints.sql", + "expected_msql_file": "alter_table_delete_constraints_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with pk & chk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table for FK reference", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "fk_reference_tbl", + "columns": [ + { + "name": "id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "bigint" + } + ], + "primary_key": [ + { + "columns": [ + { + "column": "id" + } + ], + "include": [] + } + ], + "unique_constraint": [ + { + "name": "", + "columns": [ + { + "column": "name" + } + ], + "include": [] + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create Table with fk constraint", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col3", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [ + { + "name": "fk_test", + "comment": "fk comment", + "condeferrable": true, + "confmatchtype": true, + "columns": [ + { + "local_column": "col1", + "references": "", + "referenced": "id" + } + ], + "confupdtype": "a", + "confdeltype": "a", + "autoindex": false, + "coveringindex": null + } + ], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "create_table_with_fk.sql", + "expected_msql_file": "create_table_with_fk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add one more fk", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "foreign_key": { + "added": [ + { + "name": "fk2", + "columns": [ + { + "local_column": "col2", + "references": "", + "referenced": "name" + } + ], + "confupdtype": "a", + "confdeltype": "a", + "autoindex": false, + "coveringindex": null + } + ] + } + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "alter_table_add_another_fk.sql", + "expected_msql_file": "alter_table_add_another_fk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add exclude constraint", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "exclude_constraint": { + "added": [ + { + "name": "ex_constr", + "amname": "gist", + "columns": [ + { + "column": "col1", + "is_exp": false, + "order": false, + "nulls_order": false, + "operator": "<>", + "is_sort_nulls_applicable": false + } + ], + "include": [] + } + ] + } + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "alter_table_add_exclude_constraint.sql", + "expected_msql_file": "alter_table_add_exclude_constraint_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with fk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with custom auto-vacuum", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "custom auto vacuum", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "t", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "character varying[]", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 10, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "date", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor", + "value": 0.2 + }, + { + "name": "autovacuum_analyze_threshold", + "value": 55 + }, + { + "name": "autovacuum_freeze_max_age", + "value": 20000000 + }, + { + "name": "autovacuum_vacuum_cost_delay", + "value": 25 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 10 + }, + { + "name": "autovacuum_vacuum_scale_factor", + "value": 0.3 + }, + { + "name": "autovacuum_vacuum_threshold", + "value": 60 + }, + { + "name": "autovacuum_freeze_min_age", + "value": 500000 + }, + { + "name": "autovacuum_freeze_table_age", + "value": 1300000 + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "autovacuum_custom": true + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_custom_autovacuum.sql", + "expected_msql_file": "create_table_with_custom_autovacuum_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add toast table", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#", + "autovacuum_enabled": "x", + "toast_autovacuum": true, + "toast_autovacuum_enabled": "f", + "vacuum_table": { + "changed": [ + { + "name": "autovacuum_analyze_threshold", + "value": 60 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 100 + } + ] + }, + "vacuum_toast": { + "changed": [ + { + "name": "autovacuum_freeze_max_age", + "value": 2000000 + }, + { + "name": "autovacuum_vacuum_cost_delay", + "value": 50 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 13 + }, + { + "name": "autovacuum_vacuum_threshold", + "value": 70 + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_with_toast_table.sql", + "expected_msql_file": "alter_table_with_toast_table_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with fk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with advanced options", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "relhasoids": true, + "description": "test comment", + "relpersistence": true, + "fillfactor": "50", + "parallel_workers": "", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "double precision", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "numrange", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": true, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "rlspolicy": true + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_advanced_options.sql", + "expected_msql_file": "create_table_with_advanced_options_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table update grants", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#", + "rlspolicy": false, + "forcerlspolicy": false, + "relacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + } + ] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_update_grants.sql", + "expected_msql_file": "alter_table_update_grants_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with advanced options", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table for like table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "like_tbl", + "columns": [ + { + "name": "id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "text" + } + ], + "primary_key": [ + { + "columns": [ + { + "column": "id" + } + ], + "include": [] + } + ], + "unique_constraint": [ + { + "name": "", + "columns": [ + { + "column": "name" + } + ], + "include": [] + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create Table using like table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "test ", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": true, + "like_constraints": true, + "like_indexes": true, + "like_storage": true, + "like_comments": true, + "like_relation": "public.like_tbl" + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "create_table_with_lik_tbl.sql", + "expected_msql_file": "create_table_with_lik_tbl_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table update grants", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#", + "description": "test comment", + "fillfactor": "13", + "replica_identity": "", + "relacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "D", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "x", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "t", + "privilege": true, + "with_grant": false + } + ] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_update_grants2.sql", + "expected_msql_file": "alter_table_update_grants2_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with advanced options", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with list partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_patition_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "partition table", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_active", + "values_in": "'ACTIVE'", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "list", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "status", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "status" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_partition.sql", + "expected_msql_file": "create_table_with_partition_msql.sql" + }, + { + "type": "create", + "name": "Create Table with range partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_range_patition_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_arr_small PARTITION", + "values_from": "20", + "values_to": "25", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "range", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "status", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "arr" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_range_partition.sql", + "expected_msql_file": "create_table_with_range_partition_msql.sql" + }, + { + "type": "create", + "name": "Create Table with hash partition", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_hash_patition_$%{}[]()&*^!@\\\"'`\\\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "hash partition", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [ + { + "is_attach": false, + "partition_name": "cust_part11", + "values_modulus": "2", + "values_remainder": "1", + "is_sub_partitioned": false, + "sub_partition_type": "range", + "sub_partition_keys": [] + } + ], + "partition_type": "hash", + "is_partitioned": true, + "schema": "public", + "columns": [ + { + "name": "id", + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "name", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "arr", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [ + { + "key_type": "column", + "pt_column": "id" + } + ], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "autovacuum_custom": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_hash_partition.sql", + "expected_msql_file": "create_table_with_hash_partition_msql.sql" + } + ] +} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_another_fk.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_another_fk.sql new file mode 100644 index 000000000..9cccc52b5 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_another_fk.sql @@ -0,0 +1,33 @@ +-- Table: public.table_with_fk_constraints$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" +( + col1 integer, + col2 bigint, + col3 text COLLATE pg_catalog."default", + CONSTRAINT fk2 FOREIGN KEY (col2) + REFERENCES public.fk_reference_tbl (name) MATCH SIMPLE + ON UPDATE NO ACTION + ON DELETE NO ACTION + NOT VALID, + CONSTRAINT fk_test FOREIGN KEY (col1) + REFERENCES public.fk_reference_tbl (id) MATCH FULL + ON UPDATE NO ACTION + ON DELETE NO ACTION + DEFERRABLE +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'test comment'; + +COMMENT ON CONSTRAINT fk_test ON public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'fk comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_another_fk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_another_fk_msql.sql new file mode 100644 index 000000000..bdcbfcb62 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_another_fk_msql.sql @@ -0,0 +1,6 @@ +ALTER TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT fk2 FOREIGN KEY (col2) + REFERENCES public.fk_reference_tbl (name) + ON UPDATE NO ACTION + ON DELETE NO ACTION + NOT VALID; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_cols.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_cols.sql new file mode 100644 index 000000000..2903aff8e --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_cols.sql @@ -0,0 +1,22 @@ +-- Table: public.simple_table_with_pk$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" integer NOT NULL, + "col2_$%{}[]()&*^!@\""'`\\/#" json NOT NULL, + "col3_$%{}[]()&*^!@\""'`\\/#" numeric(10,5), + "col4_$%{}[]()&*^!@\""'`\\/#" text COLLATE pg_catalog."default", + CONSTRAINT "simple_table_with_pk$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY ("col1_$%{}[]()&*^!@\""""'`\\/#") +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_cols_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_cols_msql.sql new file mode 100644 index 000000000..776060df2 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_cols_msql.sql @@ -0,0 +1,5 @@ +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + ADD COLUMN "col3_$%{}[]()&*^!@\""'`\\/#" numeric(10, 5); + +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + ADD COLUMN "col4_$%{}[]()&*^!@\""'`\\/#" text; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_exclude_constraint.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_exclude_constraint.sql new file mode 100644 index 000000000..20857a454 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_exclude_constraint.sql @@ -0,0 +1,36 @@ +-- Table: public.table_with_fk_constraints$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" +( + col1 integer, + col2 bigint, + col3 text COLLATE pg_catalog."default", + CONSTRAINT fk2 FOREIGN KEY (col2) + REFERENCES public.fk_reference_tbl (name) MATCH SIMPLE + ON UPDATE NO ACTION + ON DELETE NO ACTION + NOT VALID, + CONSTRAINT fk_test FOREIGN KEY (col1) + REFERENCES public.fk_reference_tbl (id) MATCH FULL + ON UPDATE NO ACTION + ON DELETE NO ACTION + DEFERRABLE, + CONSTRAINT ex_constr EXCLUDE USING gist ( + col1 WITH <>) + +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'test comment'; + +COMMENT ON CONSTRAINT fk_test ON public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'fk comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_exclude_constraint_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_exclude_constraint_msql.sql new file mode 100644 index 000000000..3a027c684 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_exclude_constraint_msql.sql @@ -0,0 +1,3 @@ +ALTER TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT ex_constr EXCLUDE USING gist ( + col1 WITH <>); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_null_constraint_rename_col.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_null_constraint_rename_col.sql new file mode 100644 index 000000000..a002447c6 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_null_constraint_rename_col.sql @@ -0,0 +1,24 @@ +-- Table: public.simple_table_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_$%{}[]()&*^!@""'`\/#" +( + col1_rename bigint NOT NULL, + col2 character varying COLLATE pg_catalog."default", + col3 boolean, + col4 character varying(30) COLLATE pg_catalog."default" NOT NULL, + col5 numeric(20,10), + col6 time(5) without time zone, + CONSTRAINT "simple_table_$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY (col1_rename) +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_null_constraint_rename_col_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_null_constraint_rename_col_msql.sql new file mode 100644 index 000000000..bf6a926cb --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_null_constraint_rename_col_msql.sql @@ -0,0 +1,5 @@ +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + RENAME col1 TO col1_rename; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN col4 SET NOT NULL; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_pk_not_null_constraint.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_pk_not_null_constraint.sql new file mode 100644 index 000000000..04a8662b3 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_pk_not_null_constraint.sql @@ -0,0 +1,24 @@ +-- Table: public.simple_table_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_$%{}[]()&*^!@""'`\/#" +( + col1 bigint NOT NULL, + col2 character varying COLLATE pg_catalog."default", + col3 boolean, + col4 character varying(30) COLLATE pg_catalog."default", + col5 numeric(20,10), + col6 time(5) without time zone, + CONSTRAINT "simple_table_$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY (col1) +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_pk_not_null_constraint_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_pk_not_null_constraint_msql.sql new file mode 100644 index 000000000..628422d72 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_pk_not_null_constraint_msql.sql @@ -0,0 +1,4 @@ +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN col1 SET NOT NULL; +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + ADD PRIMARY KEY (col1); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_unique_const.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_unique_const.sql new file mode 100644 index 000000000..3ac540cf6 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_unique_const.sql @@ -0,0 +1,30 @@ +-- Table: public.table_with_pk_chk_constraints$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" time(5) with time zone NOT NULL, + col2 character(12) COLLATE pg_catalog."default", + CONSTRAINT custom_pk PRIMARY KEY ("col1_$%{}[]()&*^!@\""""'`\\/#") + WITH (FILLFACTOR=11) + DEFERRABLE INITIALLY DEFERRED, + CONSTRAINT "unique" UNIQUE ("col1_$%{}[]()&*^!@\""""'`\\/#") + WITH (FILLFACTOR=13), + CONSTRAINT chk_const CHECK (col2 <> NULL::bpchar) +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'create table comment'; +COMMENT ON CONSTRAINT custom_pk ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'custom pk created'; + +COMMENT ON CONSTRAINT chk_const ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'chk const comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_unique_const_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_unique_const_msql.sql new file mode 100644 index 000000000..d5ade04d6 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_add_unique_const_msql.sql @@ -0,0 +1,3 @@ +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + ADD CONSTRAINT "unique" UNIQUE ("col1_$%{}[]()&*^!@\""'`\\/#") + WITH (FILLFACTOR=13); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_change_col_data_type.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_change_col_data_type.sql new file mode 100644 index 000000000..28c440c79 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_change_col_data_type.sql @@ -0,0 +1,23 @@ +-- Table: public.simple_table_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_$%{}[]()&*^!@""'`\/#" +( + col1 bigint, + col2 character varying COLLATE pg_catalog."default", + col3 boolean, + col4 character varying(30) COLLATE pg_catalog."default", + col5 numeric(20,10), + col6 time(5) without time zone +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_change_col_data_type_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_change_col_data_type_msql.sql new file mode 100644 index 000000000..290f24244 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_change_col_data_type_msql.sql @@ -0,0 +1,8 @@ +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN col1 TYPE bigint; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN col2 TYPE character varying COLLATE pg_catalog."default"; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + ALTER COLUMN col6 TYPE time(5) without time zone ; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_delete_cols.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_delete_cols.sql new file mode 100644 index 000000000..c1ddd58a7 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_delete_cols.sql @@ -0,0 +1,21 @@ +-- Table: public.simple_table_with_pk$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" integer NOT NULL, + "col3_$%{}[]()&*^!@\""'`\\/#" numeric(10,5), + "col4_$%{}[]()&*^!@\""'`\\/#" text COLLATE pg_catalog."default", + CONSTRAINT "simple_table_with_pk$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY ("col1_$%{}[]()&*^!@\""""'`\\/#") +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_delete_cols_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_delete_cols_msql.sql new file mode 100644 index 000000000..673ff675b --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_delete_cols_msql.sql @@ -0,0 +1 @@ +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" DROP COLUMN "col2_$%{}[]()&*^!@\""'`\\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_delete_constraints.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_delete_constraints.sql new file mode 100644 index 000000000..83388cddf --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_delete_constraints.sql @@ -0,0 +1,24 @@ +-- Table: public.table_with_pk_chk_constraints$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" time(5) with time zone NOT NULL, + col2 character(12) COLLATE pg_catalog."default", + CONSTRAINT custom_pk PRIMARY KEY ("col1_$%{}[]()&*^!@\""""'`\\/#") + WITH (FILLFACTOR=11) + DEFERRABLE INITIALLY DEFERRED +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'create table comment'; +COMMENT ON CONSTRAINT custom_pk ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'custom pk created'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_delete_constraints_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_delete_constraints_msql.sql new file mode 100644 index 000000000..47a3cf8db --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_delete_constraints_msql.sql @@ -0,0 +1,2 @@ +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" DROP CONSTRAINT "unique"; +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" DROP CONSTRAINT chk_const; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_update_grants.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_update_grants.sql new file mode 100644 index 000000000..766d1853c --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_update_grants.sql @@ -0,0 +1,24 @@ +-- Table: public.table_with_advanced_options_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#"; + +CREATE UNLOGGED TABLE IF NOT EXISTS public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" +( + col1 double precision, + col2 numrange +) +WITH ( + OIDS = TRUE, + FILLFACTOR = 50 +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +GRANT ALL ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" TO enterprisedb; + +GRANT SELECT ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" TO PUBLIC; + +COMMENT ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_update_grants2.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_update_grants2.sql new file mode 100644 index 000000000..b65167151 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_update_grants2.sql @@ -0,0 +1,26 @@ +-- Table: public.table_like_tbl$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_like_tbl$%{}[]()&*^!@""'`\/#" +( + id integer NOT NULL, + name text COLLATE pg_catalog."default", + CONSTRAINT "table_like_tbl$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY (id), + CONSTRAINT "table_like_tbl$%{}[]()&*^!@""'`\/#_name_key" UNIQUE (name) +) +WITH ( + OIDS = FALSE, + FILLFACTOR = 13 +) +TABLESPACE pg_default; + +ALTER TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +GRANT ALL ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" TO enterprisedb; + +GRANT REFERENCES, TRIGGER, TRUNCATE ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" TO PUBLIC; + +COMMENT ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_update_grants2_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_update_grants2_msql.sql new file mode 100644 index 000000000..0213d64fa --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_update_grants2_msql.sql @@ -0,0 +1,7 @@ +ALTER TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + SET (FILLFACTOR=13); + +COMMENT ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + IS 'test comment'; + +GRANT TRUNCATE, REFERENCES, TRIGGER ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" TO PUBLIC; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_update_grants_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_update_grants_msql.sql new file mode 100644 index 000000000..363195b79 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_update_grants_msql.sql @@ -0,0 +1,7 @@ +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + DISABLE ROW LEVEL SECURITY; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + NO FORCE ROW LEVEL SECURITY; + +GRANT SELECT ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" TO PUBLIC; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_with_toast_table.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_with_toast_table.sql new file mode 100644 index 000000000..94de94678 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_with_toast_table.sql @@ -0,0 +1,33 @@ +-- Table: public.table_with_custom_autovaccum_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" +( + col1 character varying(10)[] COLLATE pg_catalog."default", + col2 timestamp without time zone +) +WITH ( + OIDS = FALSE, + toast.autovacuum_enabled = FALSE, + autovacuum_analyze_scale_factor = 0.2, + autovacuum_analyze_threshold = 60, + autovacuum_freeze_max_age = 20000000, + autovacuum_vacuum_cost_delay = 25, + autovacuum_vacuum_cost_limit = 100, + autovacuum_vacuum_scale_factor = 0.3, + autovacuum_vacuum_threshold = 60, + autovacuum_freeze_min_age = 500000, + autovacuum_freeze_table_age = 1300000, + toast.autovacuum_freeze_max_age = 2000000, + toast.autovacuum_vacuum_cost_delay = 50, + toast.autovacuum_vacuum_cost_limit = 13, + toast.autovacuum_vacuum_threshold = 70 +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + IS 'custom auto vacuum'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_with_toast_table_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_with_toast_table_msql.sql new file mode 100644 index 000000000..a1a588be7 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/alter_table_with_toast_table_msql.sql @@ -0,0 +1,14 @@ +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" SET ( + autovacuum_analyze_threshold = 60, + autovacuum_vacuum_cost_limit = 100 +); +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" RESET ( + autovacuum_enabled +); +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" SET ( + toast.autovacuum_enabled = false, + toast.autovacuum_freeze_max_age = 2000000, + toast.autovacuum_vacuum_cost_delay = 50, + toast.autovacuum_vacuum_cost_limit = 13, + toast.autovacuum_vacuum_threshold = 70 +); diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_advanced_options.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_advanced_options.sql new file mode 100644 index 000000000..c483acc40 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_advanced_options.sql @@ -0,0 +1,26 @@ +-- Table: public.table_with_advanced_options_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#"; + +CREATE UNLOGGED TABLE IF NOT EXISTS public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" +( + col1 double precision, + col2 numrange +) +WITH ( + OIDS = TRUE, + FILLFACTOR = 50 +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + ENABLE ROW LEVEL SECURITY; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + FORCE ROW LEVEL SECURITY; + +COMMENT ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_advanced_options_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_advanced_options_msql.sql new file mode 100644 index 000000000..ca5c42356 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_advanced_options_msql.sql @@ -0,0 +1,21 @@ +CREATE UNLOGGED TABLE IF NOT EXISTS public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" +( + col1 double precision, + col2 numrange +) +WITH ( + OIDS = TRUE, + FILLFACTOR = 50 +); + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + ENABLE ROW LEVEL SECURITY; + +ALTER TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + FORCE ROW LEVEL SECURITY; + +COMMENT ON TABLE public."table_with_advanced_options_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_custom_autovacuum.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_custom_autovacuum.sql new file mode 100644 index 000000000..7a89dbb74 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_custom_autovacuum.sql @@ -0,0 +1,29 @@ +-- Table: public.table_with_custom_autovaccum_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" +( + col1 character varying(10)[] COLLATE pg_catalog."default", + col2 timestamp without time zone +) +WITH ( + OIDS = FALSE, + autovacuum_enabled = TRUE, + autovacuum_analyze_scale_factor = 0.2, + autovacuum_analyze_threshold = 55, + autovacuum_freeze_max_age = 20000000, + autovacuum_vacuum_cost_delay = 25, + autovacuum_vacuum_cost_limit = 10, + autovacuum_vacuum_scale_factor = 0.3, + autovacuum_vacuum_threshold = 60, + autovacuum_freeze_min_age = 500000, + autovacuum_freeze_table_age = 1300000 +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + IS 'custom auto vacuum'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_custom_autovacuum_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_custom_autovacuum_msql.sql new file mode 100644 index 000000000..456eb7c88 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_custom_autovacuum_msql.sql @@ -0,0 +1,24 @@ +CREATE TABLE IF NOT EXISTS public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" +( + col1 character varying(10)[], + col2 date +) +WITH ( + OIDS = FALSE, + autovacuum_enabled = TRUE, + autovacuum_analyze_scale_factor = 0.2, + autovacuum_analyze_threshold = 55, + autovacuum_freeze_max_age = 20000000, + autovacuum_vacuum_cost_delay = 25, + autovacuum_vacuum_cost_limit = 10, + autovacuum_vacuum_scale_factor = 0.3, + autovacuum_vacuum_threshold = 60, + autovacuum_freeze_min_age = 500000, + autovacuum_freeze_table_age = 1300000 +); + +ALTER TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_custom_autovaccum_$%{}[]()&*^!@""'`\/#" + IS 'custom auto vacuum'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_fk.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_fk.sql new file mode 100644 index 000000000..5b8de526e --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_fk.sql @@ -0,0 +1,28 @@ +-- Table: public.table_with_fk_constraints$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" +( + col1 integer, + col2 bigint, + col3 text COLLATE pg_catalog."default", + CONSTRAINT fk_test FOREIGN KEY (col1) + REFERENCES public.fk_reference_tbl (id) MATCH FULL + ON UPDATE NO ACTION + ON DELETE NO ACTION + DEFERRABLE +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'test comment'; + +COMMENT ON CONSTRAINT fk_test ON public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'fk comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_fk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_fk_msql.sql new file mode 100644 index 000000000..426df33a0 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_fk_msql.sql @@ -0,0 +1,24 @@ +CREATE TABLE IF NOT EXISTS public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" +( + col1 integer, + col2 bigint, + col3 text, + CONSTRAINT fk_test FOREIGN KEY (col1) + REFERENCES public.fk_reference_tbl (id) MATCH FULL + ON UPDATE NO ACTION + ON DELETE NO ACTION + DEFERRABLE + NOT VALID +) +WITH ( + OIDS = FALSE +); + +ALTER TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'test comment'; + +COMMENT ON CONSTRAINT fk_test ON public."table_with_fk_constraints$%{}[]()&*^!@""'`\/#" + IS 'fk comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_lik_tbl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_lik_tbl.sql new file mode 100644 index 000000000..abef77855 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_lik_tbl.sql @@ -0,0 +1,21 @@ +-- Table: public.table_like_tbl$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_like_tbl$%{}[]()&*^!@""'`\/#" +( + id integer NOT NULL, + name text COLLATE pg_catalog."default", + CONSTRAINT "table_like_tbl$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY (id), + CONSTRAINT "table_like_tbl$%{}[]()&*^!@""'`\/#_name_key" UNIQUE (name) +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + IS 'test '; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_lik_tbl_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_lik_tbl_msql.sql new file mode 100644 index 000000000..0e3c06591 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_lik_tbl_msql.sql @@ -0,0 +1,19 @@ +CREATE TABLE IF NOT EXISTS public."table_like_tbl$%{}[]()&*^!@""'`\/#" +( + LIKE public.like_tbl + INCLUDING DEFAULTS + INCLUDING CONSTRAINTS + INCLUDING INDEXES + INCLUDING STORAGE + INCLUDING COMMENTS + +) +WITH ( + OIDS = FALSE +); + +ALTER TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_like_tbl$%{}[]()&*^!@""'`\/#" + IS 'test '; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_pk.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_pk.sql new file mode 100644 index 000000000..4cf7aaf19 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_pk.sql @@ -0,0 +1,20 @@ +-- Table: public.simple_table_with_pk$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" integer NOT NULL, + "col2_$%{}[]()&*^!@\""'`\\/#" json NOT NULL, + CONSTRAINT "simple_table_with_pk$%{}[]()&*^!@""'`\/#_pkey" PRIMARY KEY ("col1_$%{}[]()&*^!@\""""'`\\/#") +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_pk_chk.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_pk_chk.sql new file mode 100644 index 000000000..87612dfb4 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_pk_chk.sql @@ -0,0 +1,28 @@ +-- Table: public.table_with_pk_chk_constraints$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" time(5) with time zone NOT NULL, + col2 character(12) COLLATE pg_catalog."default", + CONSTRAINT custom_pk PRIMARY KEY ("col1_$%{}[]()&*^!@\""""'`\\/#") + WITH (FILLFACTOR=11) + DEFERRABLE INITIALLY DEFERRED, + CONSTRAINT chk_const CHECK (col2 <> NULL::bpchar) +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'create table comment'; +COMMENT ON CONSTRAINT custom_pk ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'custom pk created'; + +COMMENT ON CONSTRAINT chk_const ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'chk const comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_pk_chk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_pk_chk_msql.sql new file mode 100644 index 000000000..c56da9e2c --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_pk_chk_msql.sql @@ -0,0 +1,23 @@ +CREATE TABLE IF NOT EXISTS public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" time(5) with time zone, + col2 character(12), + CONSTRAINT custom_pk PRIMARY KEY ("col1_$%{}[]()&*^!@\""'`\\/#") + WITH (FILLFACTOR=11) + DEFERRABLE INITIALLY DEFERRED, + CONSTRAINT chk_const CHECK (col2 != null) +) +WITH ( + OIDS = FALSE +); + +ALTER TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'create table comment'; +COMMENT ON CONSTRAINT custom_pk ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'custom pk created'; + +COMMENT ON CONSTRAINT chk_const ON public."table_with_pk_chk_constraints$%{}[]()&*^!@""'`\/#" + IS 'chk const comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_pk_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_pk_msql.sql new file mode 100644 index 000000000..ca6042f83 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_with_pk_msql.sql @@ -0,0 +1,15 @@ +CREATE TABLE IF NOT EXISTS public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" +( + "col1_$%{}[]()&*^!@\""'`\\/#" integer, + "col2_$%{}[]()&*^!@\""'`\\/#" json NOT NULL, + PRIMARY KEY ("col1_$%{}[]()&*^!@\""'`\\/#") +) +WITH ( + OIDS = FALSE +); + +ALTER TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."simple_table_with_pk$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_without_primary_key.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_without_primary_key.sql new file mode 100644 index 000000000..0e59600df --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_without_primary_key.sql @@ -0,0 +1,23 @@ +-- Table: public.simple_table_$%{}[]()&*^!@"'`\/# + +-- DROP TABLE public."simple_table_$%{}[]()&*^!@""'`\/#"; + +CREATE TABLE IF NOT EXISTS public."simple_table_$%{}[]()&*^!@""'`\/#" +( + col1 integer, + col2 text COLLATE pg_catalog."default", + col3 boolean, + col4 character varying(30) COLLATE pg_catalog."default", + col5 numeric(20,10), + col6 timestamp(5) with time zone +) +WITH ( + OIDS = FALSE +) +TABLESPACE pg_default; + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_without_primary_key_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_without_primary_key_msql.sql new file mode 100644 index 000000000..a19424410 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/create_table_without_primary_key_msql.sql @@ -0,0 +1,18 @@ +CREATE TABLE IF NOT EXISTS public."simple_table_$%{}[]()&*^!@""'`\/#" +( + col1 integer, + col2 text, + col3 boolean, + col4 character varying(30), + col5 numeric(20, 10), + col6 timestamp(5) with time zone +) +WITH ( + OIDS = FALSE +); + +ALTER TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + OWNER to enterprisedb; + +COMMENT ON TABLE public."simple_table_$%{}[]()&*^!@""'`\/#" + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/test.json new file mode 100644 index 000000000..7549bd6c0 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/tests/ppas/default/test.json @@ -0,0 +1,1538 @@ +{ + "scenarios": [ + { + "type": "create", + "name": "Create Table without primary key", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col3", + "cltype": "boolean", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col4", + "cltype": "character varying", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 30, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col5", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": 20, + "attprecision": 10, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col6", + "cltype": "timestamp with time zone", + "attacl": [], + "min_val_attlen": 0, + "max_val_attlen": 6, + "is_primary_key": false, + "attnotnull": false, + "attlen": 5, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_without_primary_key.sql", + "expected_msql_file": "create_table_without_primary_key_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table to change column data types", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "cltype": "bigint" + }, + { + "attnum": 2, + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "cltype": "character varying" + }, + { + "attnum": 6, + "attlen": null, + "cltype": "time without time zone" + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_change_col_data_type.sql", + "expected_msql_file": "alter_table_change_col_data_type_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add pk", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "attnotnull": true, + "is_primary_key": true + } + ] + }, + "primary_key": { + "added": [ + { + "columns": [ + { + "column": "col1" + } + ], + "include": [] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_pk_not_null_constraint.sql", + "expected_msql_file": "alter_table_add_pk_not_null_constraint_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add null constraint, rename column", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#", + "columns": { + "changed": [ + { + "attnum": 1, + "name": "col1_rename", + "is_primary_key": false + }, + { + "attnum": 4, + "attnotnull": true + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_null_constraint_rename_col.sql", + "expected_msql_file": "alter_table_add_null_constraint_rename_col_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table add pk", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "simple_table_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with primary key", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [ + { + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "integer", + "attacl": [], + "is_primary_key": true, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "json", + "attacl": [], + "is_primary_key": false, + "attnotnull": true, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_pk.sql", + "expected_msql_file": "create_table_with_pk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add columns", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "columns": { + "added": [ + { + "name": "col3_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "numeric", + "attacl": [], + "min_val_attlen": 1, + "min_val_attprecision": 0, + "max_val_attlen": 1000, + "max_val_attprecision": 1000, + "is_primary_key": false, + "attnotnull": false, + "attlen": 10, + "attprecision": 5, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col4_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_add_cols.sql", + "expected_msql_file": "alter_table_add_cols_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table delete columns", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "columns": { + "deleted": [ + { + "attoptions": [], + "attacl": [], + "seclabels": [], + "name": "col2_$%{}[]()&*^!@\\\"'`\\\\/#", + "atttypid": 114, + "attnum": 2, + "cltype": "json", + "collspcname": "", + "description": null, + "edit_types": [ + "json", + "jsonb" + ], + "is_primary_key": false, + "attstattarget": -1, + "attnotnull": true, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attndims": 0, + "atttypmod": -1, + "attstorage": "x", + "defval": null, + "typname": "json", + "displaytypname": "json", + "elemoid": 114, + "typnspname": "pg_catalog", + "defaultstorage": "x", + "indkey": "1", + "isdup": false, + "is_fk": false, + "is_sys_column": false, + "relname": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#", + "is_view_only": false, + "is_pk": false, + "old_attidentity": "a" + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_delete_cols.sql", + "expected_msql_file": "alter_table_delete_cols_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table delete columns", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "simple_table_with_pk$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with pk & check constraint", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "create table comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [ + { + "name": "custom_pk", + "comment": "custom pk created", + "fillfactor": "11", + "condeferrable": true, + "condeferred": true, + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1_$%{}[]()&*^!@\\\"'`\\\\/#", + "cltype": "time with time zone", + "attacl": [], + "min_val_attlen": 0, + "max_val_attlen": 6, + "is_primary_key": false, + "attnotnull": false, + "attlen": 5, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "character", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 12, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [ + { + "name": "chk_const", + "consrc": "col2 != null", + "convalidated": false, + "comment": "chk const comment" + } + ], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_pk_chk.sql", + "expected_msql_file": "create_table_with_pk_chk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add unique constraint", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "unique_constraint": { + "added": [ + { + "name": "unique", + "fillfactor": "13", + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"'`\\\\/#" + } + ], + "include": [] + } + ] + } + }, + "expected_sql_file": "alter_table_add_unique_const.sql", + "expected_msql_file": "alter_table_add_unique_const_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table delete constraints", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "check_constraint": { + "deleted": [ + { + "name": "chk_const", + "consrc": "col2 <> NULL::bpchar", + "connoinherit": false, + "convalidated": false, + "relname": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#", + "nspname": "public", + "comment": "chk const comment", + "conislocal": true + } + ] + }, + "unique_constraint": { + "deleted": [ + { + "columns": [ + { + "column": "col1_$%{}[]()&*^!@\\\"\"'`\\\\/#" + } + ], + "name": "unique", + "comment": null, + "spcname": "pg_default", + "fillfactor": "13", + "condeferrable": false, + "condeferred": false, + "include": [], + "col_count": 1, + "conislocal": true + } + ] + } + }, + "expected_sql_file": "alter_table_delete_constraints.sql", + "expected_msql_file": "alter_table_delete_constraints_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with pk & chk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_pk_chk_constraints$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table for FK reference", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "fk_reference_tbl", + "columns": [ + { + "name": "id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "bigint" + } + ], + "primary_key": [ + { + "columns": [ + { + "column": "id" + } + ], + "include": [] + } + ], + "unique_constraint": [ + { + "name": "", + "columns": [ + { + "column": "name" + } + ], + "include": [] + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create Table with fk constraint", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "test comment", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "bigint", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col3", + "cltype": "text", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [ + { + "name": "fk_test", + "comment": "fk comment", + "condeferrable": true, + "confmatchtype": true, + "columns": [ + { + "local_column": "col1", + "references": "", + "referenced": "id" + } + ], + "confupdtype": "a", + "confdeltype": "a", + "autoindex": false, + "coveringindex": null + } + ], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "create_table_with_fk.sql", + "expected_msql_file": "create_table_with_fk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add one more fk", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "foreign_key": { + "added": [ + { + "name": "fk2", + "columns": [ + { + "local_column": "col2", + "references": "", + "referenced": "name" + } + ], + "confupdtype": "a", + "confdeltype": "a", + "autoindex": false, + "coveringindex": null + } + ] + } + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "alter_table_add_another_fk.sql", + "expected_msql_file": "alter_table_add_another_fk_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add exclude constraint", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#", + "exclude_constraint": { + "added": [ + { + "name": "ex_constr", + "amname": "gist", + "columns": [ + { + "column": "col1", + "is_exp": false, + "order": false, + "nulls_order": false, + "operator": "<>", + "is_sort_nulls_applicable": false + } + ], + "include": [] + } + ] + } + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "alter_table_add_exclude_constraint.sql", + "expected_msql_file": "alter_table_add_exclude_constraint_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with fk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_fk_constraints$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with custom auto-vacuum", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "custom auto vacuum", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "t", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "character varying[]", + "attacl": [], + "min_val_attlen": 1, + "max_val_attlen": 2147483647, + "is_primary_key": false, + "attnotnull": false, + "attlen": 10, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "date", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor", + "value": 0.2 + }, + { + "name": "autovacuum_analyze_threshold", + "value": 55 + }, + { + "name": "autovacuum_freeze_max_age", + "value": 20000000 + }, + { + "name": "autovacuum_vacuum_cost_delay", + "value": 25 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 10 + }, + { + "name": "autovacuum_vacuum_scale_factor", + "value": 0.3 + }, + { + "name": "autovacuum_vacuum_threshold", + "value": 60 + }, + { + "name": "autovacuum_freeze_min_age", + "value": 500000 + }, + { + "name": "autovacuum_freeze_table_age", + "value": 1300000 + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "autovacuum_custom": true + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_custom_autovacuum.sql", + "expected_msql_file": "create_table_with_custom_autovacuum_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table add toast table", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#", + "autovacuum_enabled": "x", + "toast_autovacuum": true, + "toast_autovacuum_enabled": "f", + "vacuum_table": { + "changed": [ + { + "name": "autovacuum_analyze_threshold", + "value": 60 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 100 + } + ] + }, + "vacuum_toast": { + "changed": [ + { + "name": "autovacuum_freeze_max_age", + "value": 2000000 + }, + { + "name": "autovacuum_vacuum_cost_delay", + "value": 50 + }, + { + "name": "autovacuum_vacuum_cost_limit", + "value": 13 + }, + { + "name": "autovacuum_vacuum_threshold", + "value": 70 + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_with_toast_table.sql", + "expected_msql_file": "alter_table_with_toast_table_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with fk constraints", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_custom_autovaccum_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table with advanced options", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "relhasoids": true, + "description": "test comment", + "relpersistence": true, + "fillfactor": "50", + "parallel_workers": "", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [ + { + "name": "col1", + "cltype": "double precision", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + }, + { + "name": "col2", + "cltype": "numrange", + "attacl": [], + "is_primary_key": false, + "attnotnull": false, + "attlen": null, + "attprecision": null, + "attidentity": "a", + "colconstype": "n", + "attoptions": [], + "seclabels": [] + } + ], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": true, + "like_default_value": false, + "like_constraints": false, + "like_indexes": false, + "like_storage": false, + "like_comments": false, + "rlspolicy": true + }, + "store_object_id": true, + "expected_sql_file": "create_table_with_advanced_options.sql", + "expected_msql_file": "create_table_with_advanced_options_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table update grants", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#", + "rlspolicy": false, + "forcerlspolicy": false, + "relacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "r", + "privilege": true, + "with_grant": false + } + ] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_update_grants.sql", + "expected_msql_file": "alter_table_update_grants_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with advanced options", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_with_advanced_options_$%{}[]()&*^!@\"'`\\/#" + } + }, + { + "type": "create", + "name": "Create Table for like table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "like_tbl", + "columns": [ + { + "name": "id", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "name", + "cltype": "text" + } + ], + "primary_key": [ + { + "columns": [ + { + "column": "id" + } + ], + "include": [] + } + ], + "unique_constraint": [ + { + "name": "", + "columns": [ + { + "column": "name" + } + ], + "include": [] + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create Table using like table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#", + "relowner": "enterprisedb", + "relacl": [], + "description": "test ", + "coll_inherits": "[]", + "hastoasttable": true, + "toast_autovacuum_enabled": "x", + "autovacuum_enabled": "x", + "primary_key": [], + "partitions": [], + "partition_type": "range", + "is_partitioned": false, + "schema": "public", + "columns": [], + "foreign_key": [], + "check_constraint": [], + "unique_constraint": [], + "exclude_constraint": [], + "partition_keys": [], + "vacuum_table": [ + { + "name": "autovacuum_analyze_scale_factor" + }, + { + "name": "autovacuum_analyze_threshold" + }, + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "vacuum_toast": [ + { + "name": "autovacuum_freeze_max_age" + }, + { + "name": "autovacuum_vacuum_cost_delay" + }, + { + "name": "autovacuum_vacuum_cost_limit" + }, + { + "name": "autovacuum_vacuum_scale_factor" + }, + { + "name": "autovacuum_vacuum_threshold" + }, + { + "name": "autovacuum_freeze_min_age" + }, + { + "name": "autovacuum_freeze_table_age" + } + ], + "seclabels": [], + "forcerlspolicy": false, + "like_default_value": true, + "like_constraints": true, + "like_indexes": true, + "like_storage": true, + "like_comments": true, + "like_relation": "public.like_tbl" + }, + "store_object_id": true, + "preprocess_data": true, + "expected_sql_file": "create_table_with_lik_tbl.sql", + "expected_msql_file": "create_table_with_lik_tbl_msql.sql" + }, + { + "type": "alter", + "name": "Alter Table update grants", + "endpoint": "NODE-table.obj_id", + "sql_endpoint": "NODE-table.sql_id", + "msql_endpoint": "NODE-table.msql_id", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#", + "description": "test comment", + "fillfactor": "13", + "replica_identity": "", + "relacl": { + "added": [ + { + "grantee": "PUBLIC", + "grantor": "postgres", + "privileges": [ + { + "privilege_type": "D", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "x", + "privilege": true, + "with_grant": false + }, + { + "privilege_type": "t", + "privilege": true, + "with_grant": false + } + ] + } + ] + } + }, + "store_object_id": true, + "expected_sql_file": "alter_table_update_grants2.sql", + "expected_msql_file": "alter_table_update_grants2_msql.sql" + }, + { + "type": "delete", + "name": "Delete Table with advanced options", + "endpoint": "NODE-table.obj_id", + "data": { + "name": "table_like_tbl$%{}[]()&*^!@\"'`\\/#" + } + } + ] +} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_after_delete_event_trigger_with_transition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_after_delete_event_trigger_with_transition.sql new file mode 100644 index 000000000..fee4f9164 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_after_delete_event_trigger_with_transition.sql @@ -0,0 +1,16 @@ +-- Trigger: trig_after_delete_events_with_transition_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" + AFTER DELETE + ON public.tablefortrigger + REFERENCING OLD TABLE AS oldtab + FOR EACH ROW + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; + +ALTER TABLE public.tablefortrigger + ENABLE ALWAYS TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_after_delete_event_trigger_with_transition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_after_delete_event_trigger_with_transition_msql.sql new file mode 100644 index 000000000..c0f126609 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_after_delete_event_trigger_with_transition_msql.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.tablefortrigger + ENABLE ALWAYS TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_after_insert_event_trigger_with_transition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_after_insert_event_trigger_with_transition.sql new file mode 100644 index 000000000..c28c43e00 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_after_insert_event_trigger_with_transition.sql @@ -0,0 +1,16 @@ +-- Trigger: trig_after_insert_events_with_transition_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" + AFTER INSERT + ON public.tablefortrigger + REFERENCING NEW TABLE AS inserted + FOR EACH ROW + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; + +ALTER TABLE public.tablefortrigger + DISABLE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_after_insert_event_trigger_with_transition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_after_insert_event_trigger_with_transition_msql.sql new file mode 100644 index 000000000..accfda749 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_after_insert_event_trigger_with_transition_msql.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.tablefortrigger + DISABLE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_after_update_event_trigger_enable_always.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_after_update_event_trigger_enable_always.sql new file mode 100644 index 000000000..81b7420a2 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_after_update_event_trigger_enable_always.sql @@ -0,0 +1,16 @@ +-- Trigger: trig_after_update_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE CONSTRAINT TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" + AFTER UPDATE OF col2 + ON public.tablefortrigger + FOR EACH ROW + WHEN (old.col2 IS DISTINCT FROM new.col2) + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'comment for update event trigger'; + +ALTER TABLE public.tablefortrigger + ENABLE ALWAYS TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_after_update_event_trigger_enable_always_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_after_update_event_trigger_enable_always_msql.sql new file mode 100644 index 000000000..0fd725123 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_after_update_event_trigger_enable_always_msql.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.tablefortrigger + ENABLE ALWAYS TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_before_update_event_trigger_enable_replica.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_before_update_event_trigger_enable_replica.sql new file mode 100644 index 000000000..06f8d896d --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/alter_before_update_event_trigger_enable_replica.sql @@ -0,0 +1,16 @@ +-- Trigger: trig_be4r_update_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" + BEFORE UPDATE OF col1 + ON public.tablefortrigger + FOR EACH ROW + WHEN (old.col2 IS DISTINCT FROM new.col2) + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; + +ALTER TABLE public.tablefortrigger + ENABLE REPLICA TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_delete_event_trigger_with_transition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_delete_event_trigger_with_transition.sql new file mode 100644 index 000000000..8cb8cd2c8 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_delete_event_trigger_with_transition.sql @@ -0,0 +1,13 @@ +-- Trigger: trig_after_delete_events_with_transition_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" + AFTER DELETE + ON public.tablefortrigger + REFERENCING OLD TABLE AS oldtab + FOR EACH ROW + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_delete_event_trigger_with_transition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_delete_event_trigger_with_transition_msql.sql new file mode 100644 index 000000000..3774f9896 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_delete_event_trigger_with_transition_msql.sql @@ -0,0 +1,9 @@ +CREATE TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" + AFTER DELETE + ON public.tablefortrigger + REFERENCING OLD TABLE AS oldtab + FOR EACH ROW + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_insert_event_trigger_with_transition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_insert_event_trigger_with_transition.sql new file mode 100644 index 000000000..a1fa3c397 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_insert_event_trigger_with_transition.sql @@ -0,0 +1,13 @@ +-- Trigger: trig_after_insert_events_with_transition_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" + AFTER INSERT + ON public.tablefortrigger + REFERENCING NEW TABLE AS inserted + FOR EACH ROW + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_insert_event_trigger_with_transition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_insert_event_trigger_with_transition_msql.sql new file mode 100644 index 000000000..b4e4eb8dc --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_insert_event_trigger_with_transition_msql.sql @@ -0,0 +1,9 @@ +CREATE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" + AFTER INSERT + ON public.tablefortrigger + REFERENCING NEW TABLE AS inserted + FOR EACH ROW + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_update_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_update_event_trigger.sql new file mode 100644 index 000000000..7d9550ced --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_update_event_trigger.sql @@ -0,0 +1,13 @@ +-- Trigger: trig_after_update_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE CONSTRAINT TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" + AFTER UPDATE OF col2 + ON public.tablefortrigger + FOR EACH ROW + WHEN (old.col2 IS DISTINCT FROM new.col2) + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'comment for update event trigger'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_update_event_trigger_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_update_event_trigger_msql.sql new file mode 100644 index 000000000..2fcc70af4 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_update_event_trigger_msql.sql @@ -0,0 +1,9 @@ +CREATE CONSTRAINT TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" + AFTER UPDATE OF col2 + ON public.tablefortrigger + FOR EACH ROW + WHEN (OLD.col2 IS DISTINCT FROM NEW.col2) + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'comment for update event trigger'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_update_event_trigger_with_transition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_update_event_trigger_with_transition_msql.sql new file mode 100644 index 000000000..807ee73aa --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_after_update_event_trigger_with_transition_msql.sql @@ -0,0 +1,10 @@ +CREATE TRIGGER "trig_after_update_events_with_transition_$%{}[]()&*^!@\""'`\\/#""" + AFTER INSERT + ON public.tablefortrigger + REFERENCING NEW TABLE AS newtab OLD TABLE AS oldtab + FOR EACH ROW + WHEN (OLD.* IS DISTINCT FROM NEW.*) + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_update_events_with_transition_$%{}[]()&*^!@\""'`\\/#""" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_before_update_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_before_update_event_trigger.sql new file mode 100644 index 000000000..42071e8c2 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/create_before_update_event_trigger.sql @@ -0,0 +1,13 @@ +-- Trigger: trig_be4r_update_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" + BEFORE UPDATE OF col1 + ON public.tablefortrigger + FOR EACH ROW + WHEN (old.col2 IS DISTINCT FROM new.col2) + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/test.json new file mode 100644 index 000000000..f4568aa42 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/10_plus/test.json @@ -0,0 +1,312 @@ +{ + "scenarios": [ + { + "type": "create", + "name": "Create Table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "tablefortrigger", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "col2", + "cltype": "text" + }, + { + "name": "col3", + "cltype": "integer" + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create trigger function", + "endpoint": "NODE-trigger_function.obj", + "sql_endpoint": "NODE-trigger_function.sql_id", + "data": { + "name": "Trig1_$%{}[]()&*^!@\"'`\\/#", + "acl": [], + "args": [], + "funcowner": "postgres", + "lanname": "plpgsql", + "options": [], + "pronamespace": 2200, + "prorettypename": "trigger", + "prosrc": "begin\nselect 1;\nend;", + "seclabels": [], + "variables": [], + "schema": "public" + }, + "expected_sql_file": "create_plain_trigger_function.sql" + }, + { + "type": "create", + "name": "Create before event trigger", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_test_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "BEFORE", + "evnt_truncate": false, + "description": "test comment", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_insert": true + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_before_insert_event_trigger.sql", + "expected_msql_file": "create_before_insert_event_trigger_msql.sql" + }, + { + "type": "alter", + "name": "Alter(disable) before event trigger", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql_id", + "data": { + "name": "trig_test_$%{}[]()&*^!@\"'`\\/#", + "is_enable_trigger": "D" + }, + "schema": "public", + "expected_sql_file": "alter_before_insert_event_trigger.sql", + "expected_msql_file": "alter_before_insert_event_trigger_msql.sql" + }, + { + "type": "create", + "name": "Create before update event trigger", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_be4r_update_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "BEFORE", + "evnt_truncate": false, + "description": "test comment", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_update": true, + "columns": "[\"col1\"]", + "whenclause": "OLD.col2 IS DISTINCT FROM NEW.col2" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_before_update_event_trigger.sql", + "expected_msql_file": "create_before_update_event_trigger_msql.sql" + }, + { + "type": "alter", + "name": "Alter before update event trigger enable replica", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql_id", + "data": { + "name": "trig_be4r_update_$%{}[]()&*^!@\"'`\\/#", + "is_enable_trigger": "R" + }, + "schema": "public", + "expected_sql_file": "alter_before_update_event_trigger_enable_replica.sql", + "expected_msql_file": "alter_before_update_event_trigger_enable_replica_msql.sql" + }, + { + "type": "create", + "name": "Create after update event trigger", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_after_update_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "AFTER", + "evnt_truncate": false, + "description": "comment for update event trigger", + "is_constraint_trigger": true, + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_update": true, + "whenclause": "OLD.col2 IS DISTINCT FROM NEW.col2", + "columns": "[\"col2\"]" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_after_update_event_trigger.sql", + "expected_msql_file": "create_after_update_event_trigger_msql.sql" + }, + { + "type": "alter", + "name": "Alter after update event trigger enable always", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql_id", + "data": { + "name": "trig_after_update_$%{}[]()&*^!@\"'`\\/#", + "is_enable_trigger": "A" + }, + "schema": "public", + "expected_sql_file": "alter_after_update_event_trigger_enable_always.sql", + "expected_msql_file": "alter_after_update_event_trigger_enable_always_msql.sql" + }, + { + "type": "create", + "name": "Create trigger on before for multiple events", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_b4r_update_mul_events_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "BEFORE", + "evnt_truncate": false, + "description": "multiple event trigger", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_insert": true, + "evnt_update": true, + "columns": "[\"col3\"]", + "whenclause": "" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_b4r_update_multiple_event_trigger.sql", + "expected_msql_file": "create_b4r_update_multiple_event_trigger_msql.sql" + }, + { + "type": "create", + "name": "Create trigger on after delete event with arguments", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_after_delete_events_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "AFTER", + "evnt_truncate": false, + "description": "delete event trig", + "is_constraint_trigger": true, + "tgdeferrable": true, + "tginitdeferred": true, + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "tgargs": "12", + "evnt_delete": true + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_after_delete_event_trigger.sql", + "expected_msql_file": "create_after_delete_event_trigger_msql.sql" + }, + { + "type": "delete", + "name": "Delete trigger on after delete event with arguments", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "data": { + "name": "trig_after_delete_events_$%{}[]()&*^!@\"'`\\/#" + }, + "schema": "public" + }, + { + "type": "create", + "name": "Create before event trigger at statement level", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_test_statement_$%{}[]()&*^!@\\\"'`\\\\/#\"", + "is_row_trigger": false, + "fires": "BEFORE", + "evnt_truncate": true, + "description": "test comment", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_insert": true, + "evnt_delete": true, + "evnt_update": true, + "whenclause": "", + "columns": "[\"col1\",\"col2\",\"col3\"]" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_before_insert_event_at_statement.sql", + "expected_msql_file": "create_before_insert_event_at_statement_msql.sql" + }, + { + "type": "create", + "name": "Create trigger on after insert event with transition", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_after_insert_events_with_transition_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "AFTER", + "evnt_truncate": false, + "description": "test comment", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_insert": true, + "tgnewtable": "inserted" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_after_insert_event_trigger_with_transition.sql", + "expected_msql_file": "create_after_insert_event_trigger_with_transition_msql.sql" + }, + { + "type": "alter", + "name": "Alter(disable) trigger on after inset event with transition", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql_id", + "data": { + "name": "trig_after_insert_events_with_transition_$%{}[]()&*^!@\"'`\\/#", + "is_enable_trigger": "D" + }, + "schema": "public", + "expected_sql_file": "alter_after_insert_event_trigger_with_transition.sql", + "expected_msql_file": "alter_after_insert_event_trigger_with_transition_msql.sql" + }, + { + "type": "create", + "name": "Create trigger on after delete event with transition", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_after_delete_events_with_transition_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "AFTER", + "evnt_truncate": false, + "description": "test comment", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "is_constraint_trigger": false, + "evnt_delete": true, + "tgoldtable": "oldtab" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_after_delete_event_trigger_with_transition.sql", + "expected_msql_file": "create_after_delete_event_trigger_with_transition_msql.sql" + }, + { + "type": "alter", + "name": "Alter trigger on after delete event with transition always enable", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql_id", + "data": { + "name": "trig_after_delete_events_with_transition_$%{}[]()&*^!@\"'`\\/#", + "is_enable_trigger": "A" + }, + "schema": "public", + "expected_sql_file": "alter_after_delete_event_trigger_with_transition.sql", + "expected_msql_file": "alter_after_delete_event_trigger_with_transition_msql.sql" + } + ] +} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_after_delete_event_trigger_with_transition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_after_delete_event_trigger_with_transition.sql new file mode 100644 index 000000000..8180195f7 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_after_delete_event_trigger_with_transition.sql @@ -0,0 +1,16 @@ +-- Trigger: trig_after_delete_events_with_transition_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" + AFTER DELETE + ON public.tablefortrigger + REFERENCING OLD TABLE AS oldtab + FOR EACH ROW + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; + +ALTER TABLE public.tablefortrigger + ENABLE ALWAYS TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_after_delete_event_trigger_with_transition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_after_delete_event_trigger_with_transition_msql.sql new file mode 100644 index 000000000..c0f126609 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_after_delete_event_trigger_with_transition_msql.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.tablefortrigger + ENABLE ALWAYS TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_after_insert_event_trigger_with_transition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_after_insert_event_trigger_with_transition.sql new file mode 100644 index 000000000..30d535b62 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_after_insert_event_trigger_with_transition.sql @@ -0,0 +1,16 @@ +-- Trigger: trig_after_insert_events_with_transition_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" + AFTER INSERT + ON public.tablefortrigger + REFERENCING NEW TABLE AS inserted + FOR EACH ROW + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; + +ALTER TABLE public.tablefortrigger + DISABLE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_after_insert_event_trigger_with_transition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_after_insert_event_trigger_with_transition_msql.sql new file mode 100644 index 000000000..accfda749 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_after_insert_event_trigger_with_transition_msql.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.tablefortrigger + DISABLE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_after_update_event_trigger_enable_always.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_after_update_event_trigger_enable_always.sql new file mode 100644 index 000000000..fb4085011 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_after_update_event_trigger_enable_always.sql @@ -0,0 +1,16 @@ +-- Trigger: trig_after_update_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE CONSTRAINT TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" + AFTER UPDATE OF col2 + ON public.tablefortrigger + FOR EACH ROW + WHEN (old.col2 IS DISTINCT FROM new.col2) + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'comment for update event trigger'; + +ALTER TABLE public.tablefortrigger + ENABLE ALWAYS TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_after_update_event_trigger_enable_always_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_after_update_event_trigger_enable_always_msql.sql new file mode 100644 index 000000000..0fd725123 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_after_update_event_trigger_enable_always_msql.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.tablefortrigger + ENABLE ALWAYS TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_before_insert_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_before_insert_event_trigger.sql new file mode 100644 index 000000000..9ffbce483 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_before_insert_event_trigger.sql @@ -0,0 +1,15 @@ +-- Trigger: trig_test_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" + BEFORE INSERT + ON public.tablefortrigger + FOR EACH ROW + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; + +ALTER TABLE public.tablefortrigger + DISABLE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_before_insert_event_trigger_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_before_insert_event_trigger_msql.sql new file mode 100644 index 000000000..6d1351879 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_before_insert_event_trigger_msql.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.tablefortrigger + DISABLE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_before_update_event_trigger_enable_replica.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_before_update_event_trigger_enable_replica.sql new file mode 100644 index 000000000..400df80ed --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_before_update_event_trigger_enable_replica.sql @@ -0,0 +1,16 @@ +-- Trigger: trig_be4r_update_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" + BEFORE UPDATE OF col1 + ON public.tablefortrigger + FOR EACH ROW + WHEN (old.col2 IS DISTINCT FROM new.col2) + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; + +ALTER TABLE public.tablefortrigger + ENABLE REPLICA TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_before_update_event_trigger_enable_replica_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_before_update_event_trigger_enable_replica_msql.sql new file mode 100644 index 000000000..33f8926c8 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/alter_before_update_event_trigger_enable_replica_msql.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.tablefortrigger + ENABLE REPLICA TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_delete_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_delete_event_trigger.sql new file mode 100644 index 000000000..df82706d7 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_delete_event_trigger.sql @@ -0,0 +1,13 @@ +-- Trigger: trig_after_delete_events_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_delete_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE CONSTRAINT TRIGGER "trig_after_delete_events_$%{}[]()&*^!@""'`\/#" + AFTER DELETE + ON public.tablefortrigger + DEFERRABLE INITIALLY DEFERRED + FOR EACH ROW + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"('12'); + +COMMENT ON TRIGGER "trig_after_delete_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'delete event trig'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_delete_event_trigger_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_delete_event_trigger_msql.sql new file mode 100644 index 000000000..eac1f2acd --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_delete_event_trigger_msql.sql @@ -0,0 +1,9 @@ +CREATE CONSTRAINT TRIGGER "trig_after_delete_events_$%{}[]()&*^!@""'`\/#" + AFTER DELETE + ON public.tablefortrigger + DEFERRABLE INITIALLY DEFERRED + FOR EACH ROW + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(12); + +COMMENT ON TRIGGER "trig_after_delete_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'delete event trig'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_delete_event_trigger_with_transition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_delete_event_trigger_with_transition.sql new file mode 100644 index 000000000..08fc20242 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_delete_event_trigger_with_transition.sql @@ -0,0 +1,13 @@ +-- Trigger: trig_after_delete_events_with_transition_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" + AFTER DELETE + ON public.tablefortrigger + REFERENCING OLD TABLE AS oldtab + FOR EACH ROW + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_delete_event_trigger_with_transition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_delete_event_trigger_with_transition_msql.sql new file mode 100644 index 000000000..da0f1bed3 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_delete_event_trigger_with_transition_msql.sql @@ -0,0 +1,9 @@ +CREATE TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" + AFTER DELETE + ON public.tablefortrigger + REFERENCING OLD TABLE AS oldtab + FOR EACH ROW + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_insert_event_trigger_with_transition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_insert_event_trigger_with_transition.sql new file mode 100644 index 000000000..81bf82e5c --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_insert_event_trigger_with_transition.sql @@ -0,0 +1,13 @@ +-- Trigger: trig_after_insert_events_with_transition_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" + AFTER INSERT + ON public.tablefortrigger + REFERENCING NEW TABLE AS inserted + FOR EACH ROW + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_insert_event_trigger_with_transition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_insert_event_trigger_with_transition_msql.sql new file mode 100644 index 000000000..c99b2dbf7 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_insert_event_trigger_with_transition_msql.sql @@ -0,0 +1,9 @@ +CREATE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" + AFTER INSERT + ON public.tablefortrigger + REFERENCING NEW TABLE AS inserted + FOR EACH ROW + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_update_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_update_event_trigger.sql new file mode 100644 index 000000000..3c8beb698 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_update_event_trigger.sql @@ -0,0 +1,13 @@ +-- Trigger: trig_after_update_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE CONSTRAINT TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" + AFTER UPDATE OF col2 + ON public.tablefortrigger + FOR EACH ROW + WHEN (old.col2 IS DISTINCT FROM new.col2) + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'comment for update event trigger'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_update_event_trigger_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_update_event_trigger_msql.sql new file mode 100644 index 000000000..6b45691cc --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_after_update_event_trigger_msql.sql @@ -0,0 +1,9 @@ +CREATE CONSTRAINT TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" + AFTER UPDATE OF col2 + ON public.tablefortrigger + FOR EACH ROW + WHEN (OLD.col2 IS DISTINCT FROM NEW.col2) + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'comment for update event trigger'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_b4r_update_multiple_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_b4r_update_multiple_event_trigger.sql new file mode 100644 index 000000000..18d5aedea --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_b4r_update_multiple_event_trigger.sql @@ -0,0 +1,12 @@ +-- Trigger: trig_b4r_update_mul_events_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#" + BEFORE INSERT OR UPDATE OF col3 + ON public.tablefortrigger + FOR EACH ROW + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'multiple event trigger'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_b4r_update_multiple_event_trigger_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_b4r_update_multiple_event_trigger_msql.sql new file mode 100644 index 000000000..db938f9c1 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_b4r_update_multiple_event_trigger_msql.sql @@ -0,0 +1,8 @@ +CREATE TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#" + BEFORE INSERT OR UPDATE OF col3 + ON public.tablefortrigger + FOR EACH ROW + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'multiple event trigger'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_before_insert_event_at_statement.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_before_insert_event_at_statement.sql new file mode 100644 index 000000000..4b20ac928 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_before_insert_event_at_statement.sql @@ -0,0 +1,12 @@ +-- Trigger: trig_test_statement_$%{}[]()&*^!@\"'`\\/#" + +-- DROP TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#""" ON public.tablefortrigger; + +CREATE TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#""" + BEFORE INSERT OR DELETE OR TRUNCATE OR UPDATE OF col1, col2, col3 + ON public.tablefortrigger + FOR EACH STATEMENT + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#""" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_before_insert_event_at_statement_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_before_insert_event_at_statement_msql.sql new file mode 100644 index 000000000..50c4c59ec --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_before_insert_event_at_statement_msql.sql @@ -0,0 +1,8 @@ +CREATE TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#""" + BEFORE INSERT OR DELETE OR TRUNCATE OR UPDATE OF col1, col2, col3 + ON public.tablefortrigger + FOR EACH STATEMENT + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#""" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_before_insert_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_before_insert_event_trigger.sql new file mode 100644 index 000000000..15bbcd283 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_before_insert_event_trigger.sql @@ -0,0 +1,12 @@ +-- Trigger: trig_test_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" + BEFORE INSERT + ON public.tablefortrigger + FOR EACH ROW + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_before_insert_event_trigger_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_before_insert_event_trigger_msql.sql new file mode 100644 index 000000000..bc237813a --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_before_insert_event_trigger_msql.sql @@ -0,0 +1,8 @@ +CREATE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" + BEFORE INSERT + ON public.tablefortrigger + FOR EACH ROW + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_before_update_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_before_update_event_trigger.sql new file mode 100644 index 000000000..85465cd26 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_before_update_event_trigger.sql @@ -0,0 +1,13 @@ +-- Trigger: trig_be4r_update_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" + BEFORE UPDATE OF col1 + ON public.tablefortrigger + FOR EACH ROW + WHEN (old.col2 IS DISTINCT FROM new.col2) + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_before_update_event_trigger_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_before_update_event_trigger_msql.sql new file mode 100644 index 000000000..cbaf31024 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/create_before_update_event_trigger_msql.sql @@ -0,0 +1,9 @@ +CREATE TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" + BEFORE UPDATE OF col1 + ON public.tablefortrigger + FOR EACH ROW + WHEN (OLD.col2 IS DISTINCT FROM NEW.col2) + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/test.json new file mode 100644 index 000000000..f4568aa42 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/11_plus/test.json @@ -0,0 +1,312 @@ +{ + "scenarios": [ + { + "type": "create", + "name": "Create Table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "tablefortrigger", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "col2", + "cltype": "text" + }, + { + "name": "col3", + "cltype": "integer" + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create trigger function", + "endpoint": "NODE-trigger_function.obj", + "sql_endpoint": "NODE-trigger_function.sql_id", + "data": { + "name": "Trig1_$%{}[]()&*^!@\"'`\\/#", + "acl": [], + "args": [], + "funcowner": "postgres", + "lanname": "plpgsql", + "options": [], + "pronamespace": 2200, + "prorettypename": "trigger", + "prosrc": "begin\nselect 1;\nend;", + "seclabels": [], + "variables": [], + "schema": "public" + }, + "expected_sql_file": "create_plain_trigger_function.sql" + }, + { + "type": "create", + "name": "Create before event trigger", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_test_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "BEFORE", + "evnt_truncate": false, + "description": "test comment", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_insert": true + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_before_insert_event_trigger.sql", + "expected_msql_file": "create_before_insert_event_trigger_msql.sql" + }, + { + "type": "alter", + "name": "Alter(disable) before event trigger", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql_id", + "data": { + "name": "trig_test_$%{}[]()&*^!@\"'`\\/#", + "is_enable_trigger": "D" + }, + "schema": "public", + "expected_sql_file": "alter_before_insert_event_trigger.sql", + "expected_msql_file": "alter_before_insert_event_trigger_msql.sql" + }, + { + "type": "create", + "name": "Create before update event trigger", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_be4r_update_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "BEFORE", + "evnt_truncate": false, + "description": "test comment", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_update": true, + "columns": "[\"col1\"]", + "whenclause": "OLD.col2 IS DISTINCT FROM NEW.col2" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_before_update_event_trigger.sql", + "expected_msql_file": "create_before_update_event_trigger_msql.sql" + }, + { + "type": "alter", + "name": "Alter before update event trigger enable replica", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql_id", + "data": { + "name": "trig_be4r_update_$%{}[]()&*^!@\"'`\\/#", + "is_enable_trigger": "R" + }, + "schema": "public", + "expected_sql_file": "alter_before_update_event_trigger_enable_replica.sql", + "expected_msql_file": "alter_before_update_event_trigger_enable_replica_msql.sql" + }, + { + "type": "create", + "name": "Create after update event trigger", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_after_update_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "AFTER", + "evnt_truncate": false, + "description": "comment for update event trigger", + "is_constraint_trigger": true, + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_update": true, + "whenclause": "OLD.col2 IS DISTINCT FROM NEW.col2", + "columns": "[\"col2\"]" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_after_update_event_trigger.sql", + "expected_msql_file": "create_after_update_event_trigger_msql.sql" + }, + { + "type": "alter", + "name": "Alter after update event trigger enable always", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql_id", + "data": { + "name": "trig_after_update_$%{}[]()&*^!@\"'`\\/#", + "is_enable_trigger": "A" + }, + "schema": "public", + "expected_sql_file": "alter_after_update_event_trigger_enable_always.sql", + "expected_msql_file": "alter_after_update_event_trigger_enable_always_msql.sql" + }, + { + "type": "create", + "name": "Create trigger on before for multiple events", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_b4r_update_mul_events_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "BEFORE", + "evnt_truncate": false, + "description": "multiple event trigger", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_insert": true, + "evnt_update": true, + "columns": "[\"col3\"]", + "whenclause": "" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_b4r_update_multiple_event_trigger.sql", + "expected_msql_file": "create_b4r_update_multiple_event_trigger_msql.sql" + }, + { + "type": "create", + "name": "Create trigger on after delete event with arguments", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_after_delete_events_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "AFTER", + "evnt_truncate": false, + "description": "delete event trig", + "is_constraint_trigger": true, + "tgdeferrable": true, + "tginitdeferred": true, + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "tgargs": "12", + "evnt_delete": true + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_after_delete_event_trigger.sql", + "expected_msql_file": "create_after_delete_event_trigger_msql.sql" + }, + { + "type": "delete", + "name": "Delete trigger on after delete event with arguments", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "data": { + "name": "trig_after_delete_events_$%{}[]()&*^!@\"'`\\/#" + }, + "schema": "public" + }, + { + "type": "create", + "name": "Create before event trigger at statement level", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_test_statement_$%{}[]()&*^!@\\\"'`\\\\/#\"", + "is_row_trigger": false, + "fires": "BEFORE", + "evnt_truncate": true, + "description": "test comment", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_insert": true, + "evnt_delete": true, + "evnt_update": true, + "whenclause": "", + "columns": "[\"col1\",\"col2\",\"col3\"]" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_before_insert_event_at_statement.sql", + "expected_msql_file": "create_before_insert_event_at_statement_msql.sql" + }, + { + "type": "create", + "name": "Create trigger on after insert event with transition", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_after_insert_events_with_transition_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "AFTER", + "evnt_truncate": false, + "description": "test comment", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_insert": true, + "tgnewtable": "inserted" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_after_insert_event_trigger_with_transition.sql", + "expected_msql_file": "create_after_insert_event_trigger_with_transition_msql.sql" + }, + { + "type": "alter", + "name": "Alter(disable) trigger on after inset event with transition", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql_id", + "data": { + "name": "trig_after_insert_events_with_transition_$%{}[]()&*^!@\"'`\\/#", + "is_enable_trigger": "D" + }, + "schema": "public", + "expected_sql_file": "alter_after_insert_event_trigger_with_transition.sql", + "expected_msql_file": "alter_after_insert_event_trigger_with_transition_msql.sql" + }, + { + "type": "create", + "name": "Create trigger on after delete event with transition", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_after_delete_events_with_transition_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "AFTER", + "evnt_truncate": false, + "description": "test comment", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "is_constraint_trigger": false, + "evnt_delete": true, + "tgoldtable": "oldtab" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_after_delete_event_trigger_with_transition.sql", + "expected_msql_file": "create_after_delete_event_trigger_with_transition_msql.sql" + }, + { + "type": "alter", + "name": "Alter trigger on after delete event with transition always enable", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql_id", + "data": { + "name": "trig_after_delete_events_with_transition_$%{}[]()&*^!@\"'`\\/#", + "is_enable_trigger": "A" + }, + "schema": "public", + "expected_sql_file": "alter_after_delete_event_trigger_with_transition.sql", + "expected_msql_file": "alter_after_delete_event_trigger_with_transition_msql.sql" + } + ] +} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/alter_after_update_event_trigger_enable_always.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/alter_after_update_event_trigger_enable_always.sql new file mode 100644 index 000000000..ed35564d7 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/alter_after_update_event_trigger_enable_always.sql @@ -0,0 +1,16 @@ +-- Trigger: trig_after_update_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE CONSTRAINT TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" + AFTER UPDATE OF col2 + ON public.tablefortrigger + FOR EACH ROW + WHEN ((old.col2 IS DISTINCT FROM new.col2)) + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'comment for update event trigger'; + +ALTER TABLE public.tablefortrigger + ENABLE ALWAYS TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/alter_after_update_event_trigger_enable_always_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/alter_after_update_event_trigger_enable_always_msql.sql new file mode 100644 index 000000000..0fd725123 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/alter_after_update_event_trigger_enable_always_msql.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.tablefortrigger + ENABLE ALWAYS TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/alter_before_insert_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/alter_before_insert_event_trigger.sql new file mode 100644 index 000000000..cf8ee7459 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/alter_before_insert_event_trigger.sql @@ -0,0 +1,15 @@ +-- Trigger: trig_test_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" + BEFORE INSERT + ON public.tablefortrigger + FOR EACH ROW + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; + +ALTER TABLE public.tablefortrigger + DISABLE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/alter_before_insert_event_trigger_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/alter_before_insert_event_trigger_msql.sql new file mode 100644 index 000000000..6d1351879 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/alter_before_insert_event_trigger_msql.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.tablefortrigger + DISABLE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/alter_before_update_event_trigger_enable_replica.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/alter_before_update_event_trigger_enable_replica.sql new file mode 100644 index 000000000..1a9eafb08 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/alter_before_update_event_trigger_enable_replica.sql @@ -0,0 +1,16 @@ +-- Trigger: trig_be4r_update_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" + BEFORE UPDATE OF col1 + ON public.tablefortrigger + FOR EACH ROW + WHEN ((old.col2 IS DISTINCT FROM new.col2)) + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; + +ALTER TABLE public.tablefortrigger + ENABLE REPLICA TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/alter_before_update_event_trigger_enable_replica_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/alter_before_update_event_trigger_enable_replica_msql.sql new file mode 100644 index 000000000..33f8926c8 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/alter_before_update_event_trigger_enable_replica_msql.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.tablefortrigger + ENABLE REPLICA TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_after_delete_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_after_delete_event_trigger.sql new file mode 100644 index 000000000..a85a35502 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_after_delete_event_trigger.sql @@ -0,0 +1,13 @@ +-- Trigger: trig_after_delete_events_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_delete_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE CONSTRAINT TRIGGER "trig_after_delete_events_$%{}[]()&*^!@""'`\/#" + AFTER DELETE + ON public.tablefortrigger + DEFERRABLE INITIALLY DEFERRED + FOR EACH ROW + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"('12'); + +COMMENT ON TRIGGER "trig_after_delete_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'delete event trig'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_after_delete_event_trigger_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_after_delete_event_trigger_msql.sql new file mode 100644 index 000000000..9ad3585cc --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_after_delete_event_trigger_msql.sql @@ -0,0 +1,9 @@ +CREATE CONSTRAINT TRIGGER "trig_after_delete_events_$%{}[]()&*^!@""'`\/#" + AFTER DELETE + ON public.tablefortrigger + DEFERRABLE INITIALLY DEFERRED + FOR EACH ROW + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(12); + +COMMENT ON TRIGGER "trig_after_delete_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'delete event trig'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_after_insert_event_trigger_with_transition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_after_insert_event_trigger_with_transition.sql new file mode 100644 index 000000000..81bf82e5c --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_after_insert_event_trigger_with_transition.sql @@ -0,0 +1,13 @@ +-- Trigger: trig_after_insert_events_with_transition_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" + AFTER INSERT + ON public.tablefortrigger + REFERENCING NEW TABLE AS inserted + FOR EACH ROW + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_after_insert_event_trigger_with_transition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_after_insert_event_trigger_with_transition_msql.sql new file mode 100644 index 000000000..b4e4eb8dc --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_after_insert_event_trigger_with_transition_msql.sql @@ -0,0 +1,9 @@ +CREATE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" + AFTER INSERT + ON public.tablefortrigger + REFERENCING NEW TABLE AS inserted + FOR EACH ROW + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_after_update_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_after_update_event_trigger.sql new file mode 100644 index 000000000..e56ec6775 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_after_update_event_trigger.sql @@ -0,0 +1,13 @@ +-- Trigger: trig_after_update_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE CONSTRAINT TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" + AFTER UPDATE OF col2 + ON public.tablefortrigger + FOR EACH ROW + WHEN ((old.col2 IS DISTINCT FROM new.col2)) + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'comment for update event trigger'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_after_update_event_trigger_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_after_update_event_trigger_msql.sql new file mode 100644 index 000000000..2fcc70af4 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_after_update_event_trigger_msql.sql @@ -0,0 +1,9 @@ +CREATE CONSTRAINT TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" + AFTER UPDATE OF col2 + ON public.tablefortrigger + FOR EACH ROW + WHEN (OLD.col2 IS DISTINCT FROM NEW.col2) + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'comment for update event trigger'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_b4r_update_multiple_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_b4r_update_multiple_event_trigger.sql new file mode 100644 index 000000000..a0f3f8b4e --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_b4r_update_multiple_event_trigger.sql @@ -0,0 +1,12 @@ +-- Trigger: trig_b4r_update_mul_events_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#" + BEFORE INSERT OR UPDATE OF col3 + ON public.tablefortrigger + FOR EACH ROW + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'multiple event trigger'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_b4r_update_multiple_event_trigger_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_b4r_update_multiple_event_trigger_msql.sql new file mode 100644 index 000000000..5d4e7c265 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_b4r_update_multiple_event_trigger_msql.sql @@ -0,0 +1,8 @@ +CREATE TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#" + BEFORE INSERT OR UPDATE OF col3 + ON public.tablefortrigger + FOR EACH ROW + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'multiple event trigger'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_before_insert_event_at_statement.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_before_insert_event_at_statement.sql new file mode 100644 index 000000000..c0cf9c6ac --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_before_insert_event_at_statement.sql @@ -0,0 +1,12 @@ +-- Trigger: trig_test_statement_$%{}[]()&*^!@\"'`\\/#" + +-- DROP TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#""" ON public.tablefortrigger; + +CREATE TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#""" + BEFORE INSERT OR DELETE OR TRUNCATE OR UPDATE OF col1, col2, col3 + ON public.tablefortrigger + FOR EACH STATEMENT + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#""" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_before_insert_event_at_statement_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_before_insert_event_at_statement_msql.sql new file mode 100644 index 000000000..74317a513 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_before_insert_event_at_statement_msql.sql @@ -0,0 +1,8 @@ +CREATE TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#""" + BEFORE INSERT OR DELETE OR TRUNCATE OR UPDATE OF col1, col2, col3 + ON public.tablefortrigger + FOR EACH STATEMENT + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#""" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_before_insert_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_before_insert_event_trigger.sql new file mode 100644 index 000000000..260649499 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_before_insert_event_trigger.sql @@ -0,0 +1,12 @@ +-- Trigger: trig_test_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" + BEFORE INSERT + ON public.tablefortrigger + FOR EACH ROW + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_before_insert_event_trigger_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_before_insert_event_trigger_msql.sql new file mode 100644 index 000000000..7388f1bc6 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_before_insert_event_trigger_msql.sql @@ -0,0 +1,8 @@ +CREATE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" + BEFORE INSERT + ON public.tablefortrigger + FOR EACH ROW + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_before_update_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_before_update_event_trigger.sql new file mode 100644 index 000000000..cd0779ea5 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_before_update_event_trigger.sql @@ -0,0 +1,13 @@ +-- Trigger: trig_be4r_update_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" + BEFORE UPDATE OF col1 + ON public.tablefortrigger + FOR EACH ROW + WHEN ((old.col2 IS DISTINCT FROM new.col2)) + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_before_update_event_trigger_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_before_update_event_trigger_msql.sql new file mode 100644 index 000000000..89a211c9f --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_before_update_event_trigger_msql.sql @@ -0,0 +1,9 @@ +CREATE TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" + BEFORE UPDATE OF col1 + ON public.tablefortrigger + FOR EACH ROW + WHEN (OLD.col2 IS DISTINCT FROM NEW.col2) + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_plain_trigger_function.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_plain_trigger_function.sql new file mode 100644 index 000000000..191e59c8e --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/create_plain_trigger_function.sql @@ -0,0 +1,17 @@ +-- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#() + +-- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +CREATE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"() + RETURNS trigger + LANGUAGE 'plpgsql' + COST 100 + VOLATILE NOT LEAKPROOF +AS $BODY$ +begin +select 1; +end; +$BODY$; + +ALTER FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"() + OWNER TO postgres; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/test.json new file mode 100644 index 000000000..b9ad144b9 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/pg/default/test.json @@ -0,0 +1,241 @@ +{ + "scenarios": [ + { + "type": "create", + "name": "Create Table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "tablefortrigger", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "col2", + "cltype": "text" + }, + { + "name": "col3", + "cltype": "integer" + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create trigger function", + "endpoint": "NODE-trigger_function.obj", + "sql_endpoint": "NODE-trigger_function.sql_id", + "data": { + "name": "Trig1_$%{}[]()&*^!@\"'`\\/#", + "acl": [], + "args": [], + "funcowner": "postgres", + "lanname": "plpgsql", + "options": [], + "pronamespace": 2200, + "prorettypename": "trigger", + "prosrc": "begin\nselect 1;\nend;", + "seclabels": [], + "variables": [], + "schema": "public" + }, + "expected_sql_file": "create_plain_trigger_function.sql" + }, + { + "type": "create", + "name": "Create before event trigger", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_test_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "BEFORE", + "evnt_truncate": false, + "description": "test comment", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_insert": true + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_before_insert_event_trigger.sql", + "expected_msql_file": "create_before_insert_event_trigger_msql.sql" + }, + { + "type": "alter", + "name": "Alter(disable) before event trigger", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql_id", + "data": { + "name": "trig_test_$%{}[]()&*^!@\"'`\\/#", + "is_enable_trigger": "D" + }, + "schema": "public", + "expected_sql_file": "alter_before_insert_event_trigger.sql", + "expected_msql_file": "alter_before_insert_event_trigger_msql.sql" + }, + { + "type": "create", + "name": "Create before update event trigger", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_be4r_update_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "BEFORE", + "evnt_truncate": false, + "description": "test comment", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_update": true, + "columns": "[\"col1\"]", + "whenclause": "OLD.col2 IS DISTINCT FROM NEW.col2" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_before_update_event_trigger.sql", + "expected_msql_file": "create_before_update_event_trigger_msql.sql" + }, + { + "type": "alter", + "name": "Alter before update event trigger enable replica", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql_id", + "data": { + "name": "trig_be4r_update_$%{}[]()&*^!@\"'`\\/#", + "is_enable_trigger": "R" + }, + "schema": "public", + "expected_sql_file": "alter_before_update_event_trigger_enable_replica.sql", + "expected_msql_file": "alter_before_update_event_trigger_enable_replica_msql.sql" + }, + { + "type": "create", + "name": "Create after update event trigger", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_after_update_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "AFTER", + "evnt_truncate": false, + "description": "comment for update event trigger", + "is_constraint_trigger": true, + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_update": true, + "whenclause": "OLD.col2 IS DISTINCT FROM NEW.col2", + "columns": "[\"col2\"]" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_after_update_event_trigger.sql", + "expected_msql_file": "create_after_update_event_trigger_msql.sql" + }, + { + "type": "alter", + "name": "Alter after update event trigger enable always", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql_id", + "data": { + "name": "trig_after_update_$%{}[]()&*^!@\"'`\\/#", + "is_enable_trigger": "A" + }, + "schema": "public", + "expected_sql_file": "alter_after_update_event_trigger_enable_always.sql", + "expected_msql_file": "alter_after_update_event_trigger_enable_always_msql.sql" + }, + { + "type": "create", + "name": "Create trigger on before for multiple events", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_b4r_update_mul_events_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "BEFORE", + "evnt_truncate": false, + "description": "multiple event trigger", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_insert": true, + "evnt_update": true, + "columns": "[\"col3\"]", + "whenclause": "" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_b4r_update_multiple_event_trigger.sql", + "expected_msql_file": "create_b4r_update_multiple_event_trigger_msql.sql" + }, + { + "type": "create", + "name": "Create trigger on after delete event with arguments", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_after_delete_events_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "AFTER", + "evnt_truncate": false, + "description": "delete event trig", + "is_constraint_trigger": true, + "tgdeferrable": true, + "tginitdeferred": true, + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "tgargs": "12", + "evnt_delete": true + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_after_delete_event_trigger.sql", + "expected_msql_file": "create_after_delete_event_trigger_msql.sql" + }, + { + "type": "delete", + "name": "Delete trigger on after delete event with arguments", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "data": { + "name": "trig_after_delete_events_$%{}[]()&*^!@\"'`\\/#" + }, + "schema": "public" + }, + { + "type": "create", + "name": "Create before event trigger at statement level", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_test_statement_$%{}[]()&*^!@\\\"'`\\\\/#\"", + "is_row_trigger": false, + "fires": "BEFORE", + "evnt_truncate": true, + "description": "test comment", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_insert": true, + "evnt_delete": true, + "evnt_update": true, + "whenclause": "", + "columns": "[\"col1\",\"col2\",\"col3\"]" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_before_insert_event_at_statement.sql", + "expected_msql_file": "create_before_insert_event_at_statement_msql.sql" + } + ] +} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_after_delete_event_trigger_with_transition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_after_delete_event_trigger_with_transition.sql new file mode 100644 index 000000000..fee4f9164 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_after_delete_event_trigger_with_transition.sql @@ -0,0 +1,16 @@ +-- Trigger: trig_after_delete_events_with_transition_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" + AFTER DELETE + ON public.tablefortrigger + REFERENCING OLD TABLE AS oldtab + FOR EACH ROW + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; + +ALTER TABLE public.tablefortrigger + ENABLE ALWAYS TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_after_delete_event_trigger_with_transition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_after_delete_event_trigger_with_transition_msql.sql new file mode 100644 index 000000000..c0f126609 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_after_delete_event_trigger_with_transition_msql.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.tablefortrigger + ENABLE ALWAYS TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_after_insert_event_trigger_with_transition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_after_insert_event_trigger_with_transition.sql new file mode 100644 index 000000000..c28c43e00 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_after_insert_event_trigger_with_transition.sql @@ -0,0 +1,16 @@ +-- Trigger: trig_after_insert_events_with_transition_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" + AFTER INSERT + ON public.tablefortrigger + REFERENCING NEW TABLE AS inserted + FOR EACH ROW + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; + +ALTER TABLE public.tablefortrigger + DISABLE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_after_insert_event_trigger_with_transition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_after_insert_event_trigger_with_transition_msql.sql new file mode 100644 index 000000000..accfda749 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_after_insert_event_trigger_with_transition_msql.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.tablefortrigger + DISABLE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_after_update_event_trigger_enable_always.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_after_update_event_trigger_enable_always.sql new file mode 100644 index 000000000..81b7420a2 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_after_update_event_trigger_enable_always.sql @@ -0,0 +1,16 @@ +-- Trigger: trig_after_update_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE CONSTRAINT TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" + AFTER UPDATE OF col2 + ON public.tablefortrigger + FOR EACH ROW + WHEN (old.col2 IS DISTINCT FROM new.col2) + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'comment for update event trigger'; + +ALTER TABLE public.tablefortrigger + ENABLE ALWAYS TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_after_update_event_trigger_enable_always_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_after_update_event_trigger_enable_always_msql.sql new file mode 100644 index 000000000..0fd725123 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_after_update_event_trigger_enable_always_msql.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.tablefortrigger + ENABLE ALWAYS TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_before_update_event_trigger_enable_replica.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_before_update_event_trigger_enable_replica.sql new file mode 100644 index 000000000..06f8d896d --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/alter_before_update_event_trigger_enable_replica.sql @@ -0,0 +1,16 @@ +-- Trigger: trig_be4r_update_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" + BEFORE UPDATE OF col1 + ON public.tablefortrigger + FOR EACH ROW + WHEN (old.col2 IS DISTINCT FROM new.col2) + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; + +ALTER TABLE public.tablefortrigger + ENABLE REPLICA TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_delete_event_trigger_with_transition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_delete_event_trigger_with_transition.sql new file mode 100644 index 000000000..8cb8cd2c8 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_delete_event_trigger_with_transition.sql @@ -0,0 +1,13 @@ +-- Trigger: trig_after_delete_events_with_transition_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" + AFTER DELETE + ON public.tablefortrigger + REFERENCING OLD TABLE AS oldtab + FOR EACH ROW + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_delete_event_trigger_with_transition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_delete_event_trigger_with_transition_msql.sql new file mode 100644 index 000000000..3774f9896 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_delete_event_trigger_with_transition_msql.sql @@ -0,0 +1,9 @@ +CREATE TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" + AFTER DELETE + ON public.tablefortrigger + REFERENCING OLD TABLE AS oldtab + FOR EACH ROW + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_insert_event_trigger_with_transition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_insert_event_trigger_with_transition.sql new file mode 100644 index 000000000..a1fa3c397 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_insert_event_trigger_with_transition.sql @@ -0,0 +1,13 @@ +-- Trigger: trig_after_insert_events_with_transition_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" + AFTER INSERT + ON public.tablefortrigger + REFERENCING NEW TABLE AS inserted + FOR EACH ROW + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_insert_event_trigger_with_transition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_insert_event_trigger_with_transition_msql.sql new file mode 100644 index 000000000..b4e4eb8dc --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_insert_event_trigger_with_transition_msql.sql @@ -0,0 +1,9 @@ +CREATE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" + AFTER INSERT + ON public.tablefortrigger + REFERENCING NEW TABLE AS inserted + FOR EACH ROW + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_update_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_update_event_trigger.sql new file mode 100644 index 000000000..7d9550ced --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_update_event_trigger.sql @@ -0,0 +1,13 @@ +-- Trigger: trig_after_update_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE CONSTRAINT TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" + AFTER UPDATE OF col2 + ON public.tablefortrigger + FOR EACH ROW + WHEN (old.col2 IS DISTINCT FROM new.col2) + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'comment for update event trigger'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_update_event_trigger_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_update_event_trigger_msql.sql new file mode 100644 index 000000000..2fcc70af4 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_update_event_trigger_msql.sql @@ -0,0 +1,9 @@ +CREATE CONSTRAINT TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" + AFTER UPDATE OF col2 + ON public.tablefortrigger + FOR EACH ROW + WHEN (OLD.col2 IS DISTINCT FROM NEW.col2) + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'comment for update event trigger'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_update_event_trigger_with_transition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_update_event_trigger_with_transition_msql.sql new file mode 100644 index 000000000..807ee73aa --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_after_update_event_trigger_with_transition_msql.sql @@ -0,0 +1,10 @@ +CREATE TRIGGER "trig_after_update_events_with_transition_$%{}[]()&*^!@\""'`\\/#""" + AFTER INSERT + ON public.tablefortrigger + REFERENCING NEW TABLE AS newtab OLD TABLE AS oldtab + FOR EACH ROW + WHEN (OLD.* IS DISTINCT FROM NEW.*) + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_update_events_with_transition_$%{}[]()&*^!@\""'`\\/#""" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_before_update_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_before_update_event_trigger.sql new file mode 100644 index 000000000..42071e8c2 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/create_before_update_event_trigger.sql @@ -0,0 +1,13 @@ +-- Trigger: trig_be4r_update_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" + BEFORE UPDATE OF col1 + ON public.tablefortrigger + FOR EACH ROW + WHEN (old.col2 IS DISTINCT FROM new.col2) + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/test.json new file mode 100644 index 000000000..a79df68bf --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/10_plus/test.json @@ -0,0 +1,312 @@ +{ + "scenarios": [ + { + "type": "create", + "name": "Create Table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "tablefortrigger", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "col2", + "cltype": "text" + }, + { + "name": "col3", + "cltype": "integer" + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create trigger function", + "endpoint": "NODE-trigger_function.obj", + "sql_endpoint": "NODE-trigger_function.sql_id", + "data": { + "name": "Trig1_$%{}[]()&*^!@\"'`\\/#", + "acl": [], + "args": [], + "funcowner": "enterprisedb", + "lanname": "plpgsql", + "options": [], + "pronamespace": 2200, + "prorettypename": "trigger", + "prosrc": "begin\nselect 1;\nend;", + "seclabels": [], + "variables": [], + "schema": "public" + }, + "expected_sql_file": "create_plain_trigger_function.sql" + }, + { + "type": "create", + "name": "Create before event trigger", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_test_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "BEFORE", + "evnt_truncate": false, + "description": "test comment", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_insert": true + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_before_insert_event_trigger.sql", + "expected_msql_file": "create_before_insert_event_trigger_msql.sql" + }, + { + "type": "alter", + "name": "Alter(disable) before event trigger", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql_id", + "data": { + "name": "trig_test_$%{}[]()&*^!@\"'`\\/#", + "is_enable_trigger": "D" + }, + "schema": "public", + "expected_sql_file": "alter_before_insert_event_trigger.sql", + "expected_msql_file": "alter_before_insert_event_trigger_msql.sql" + }, + { + "type": "create", + "name": "Create before update event trigger", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_be4r_update_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "BEFORE", + "evnt_truncate": false, + "description": "test comment", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_update": true, + "columns": "[\"col1\"]", + "whenclause": "OLD.col2 IS DISTINCT FROM NEW.col2" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_before_update_event_trigger.sql", + "expected_msql_file": "create_before_update_event_trigger_msql.sql" + }, + { + "type": "alter", + "name": "Alter before update event trigger enable replica", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql_id", + "data": { + "name": "trig_be4r_update_$%{}[]()&*^!@\"'`\\/#", + "is_enable_trigger": "R" + }, + "schema": "public", + "expected_sql_file": "alter_before_update_event_trigger_enable_replica.sql", + "expected_msql_file": "alter_before_update_event_trigger_enable_replica_msql.sql" + }, + { + "type": "create", + "name": "Create after update event trigger", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_after_update_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "AFTER", + "evnt_truncate": false, + "description": "comment for update event trigger", + "is_constraint_trigger": true, + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_update": true, + "whenclause": "OLD.col2 IS DISTINCT FROM NEW.col2", + "columns": "[\"col2\"]" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_after_update_event_trigger.sql", + "expected_msql_file": "create_after_update_event_trigger_msql.sql" + }, + { + "type": "alter", + "name": "Alter after update event trigger enable always", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql_id", + "data": { + "name": "trig_after_update_$%{}[]()&*^!@\"'`\\/#", + "is_enable_trigger": "A" + }, + "schema": "public", + "expected_sql_file": "alter_after_update_event_trigger_enable_always.sql", + "expected_msql_file": "alter_after_update_event_trigger_enable_always_msql.sql" + }, + { + "type": "create", + "name": "Create trigger on before for multiple events", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_b4r_update_mul_events_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "BEFORE", + "evnt_truncate": false, + "description": "multiple event trigger", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_insert": true, + "evnt_update": true, + "columns": "[\"col3\"]", + "whenclause": "" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_b4r_update_multiple_event_trigger.sql", + "expected_msql_file": "create_b4r_update_multiple_event_trigger_msql.sql" + }, + { + "type": "create", + "name": "Create trigger on after delete event with arguments", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_after_delete_events_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "AFTER", + "evnt_truncate": false, + "description": "delete event trig", + "is_constraint_trigger": true, + "tgdeferrable": true, + "tginitdeferred": true, + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "tgargs": "12", + "evnt_delete": true + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_after_delete_event_trigger.sql", + "expected_msql_file": "create_after_delete_event_trigger_msql.sql" + }, + { + "type": "delete", + "name": "Delete trigger on after delete event with arguments", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "data": { + "name": "trig_after_delete_events_$%{}[]()&*^!@\"'`\\/#" + }, + "schema": "public" + }, + { + "type": "create", + "name": "Create before event trigger at statement level", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_test_statement_$%{}[]()&*^!@\\\"'`\\\\/#\"", + "is_row_trigger": false, + "fires": "BEFORE", + "evnt_truncate": true, + "description": "test comment", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_insert": true, + "evnt_delete": true, + "evnt_update": true, + "whenclause": "", + "columns": "[\"col1\",\"col2\",\"col3\"]" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_before_insert_event_at_statement.sql", + "expected_msql_file": "create_before_insert_event_at_statement_msql.sql" + }, + { + "type": "create", + "name": "Create trigger on after insert event with transition", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_after_insert_events_with_transition_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "AFTER", + "evnt_truncate": false, + "description": "test comment", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_insert": true, + "tgnewtable": "inserted" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_after_insert_event_trigger_with_transition.sql", + "expected_msql_file": "create_after_insert_event_trigger_with_transition_msql.sql" + }, + { + "type": "alter", + "name": "Alter(disable) trigger on after inset event with transition", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql_id", + "data": { + "name": "trig_after_insert_events_with_transition_$%{}[]()&*^!@\"'`\\/#", + "is_enable_trigger": "D" + }, + "schema": "public", + "expected_sql_file": "alter_after_insert_event_trigger_with_transition.sql", + "expected_msql_file": "alter_after_insert_event_trigger_with_transition_msql.sql" + }, + { + "type": "create", + "name": "Create trigger on after delete event with transition", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_after_delete_events_with_transition_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "AFTER", + "evnt_truncate": false, + "description": "test comment", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "is_constraint_trigger": false, + "evnt_delete": true, + "tgoldtable": "oldtab" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_after_delete_event_trigger_with_transition.sql", + "expected_msql_file": "create_after_delete_event_trigger_with_transition_msql.sql" + }, + { + "type": "alter", + "name": "Alter trigger on after delete event with transition always enable", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql_id", + "data": { + "name": "trig_after_delete_events_with_transition_$%{}[]()&*^!@\"'`\\/#", + "is_enable_trigger": "A" + }, + "schema": "public", + "expected_sql_file": "alter_after_delete_event_trigger_with_transition.sql", + "expected_msql_file": "alter_after_delete_event_trigger_with_transition_msql.sql" + } + ] +} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_after_delete_event_trigger_with_transition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_after_delete_event_trigger_with_transition.sql new file mode 100644 index 000000000..8180195f7 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_after_delete_event_trigger_with_transition.sql @@ -0,0 +1,16 @@ +-- Trigger: trig_after_delete_events_with_transition_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" + AFTER DELETE + ON public.tablefortrigger + REFERENCING OLD TABLE AS oldtab + FOR EACH ROW + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; + +ALTER TABLE public.tablefortrigger + ENABLE ALWAYS TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_after_delete_event_trigger_with_transition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_after_delete_event_trigger_with_transition_msql.sql new file mode 100644 index 000000000..c0f126609 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_after_delete_event_trigger_with_transition_msql.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.tablefortrigger + ENABLE ALWAYS TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_after_insert_event_trigger_with_transition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_after_insert_event_trigger_with_transition.sql new file mode 100644 index 000000000..30d535b62 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_after_insert_event_trigger_with_transition.sql @@ -0,0 +1,16 @@ +-- Trigger: trig_after_insert_events_with_transition_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" + AFTER INSERT + ON public.tablefortrigger + REFERENCING NEW TABLE AS inserted + FOR EACH ROW + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; + +ALTER TABLE public.tablefortrigger + DISABLE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_after_insert_event_trigger_with_transition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_after_insert_event_trigger_with_transition_msql.sql new file mode 100644 index 000000000..accfda749 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_after_insert_event_trigger_with_transition_msql.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.tablefortrigger + DISABLE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_after_update_event_trigger_enable_always.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_after_update_event_trigger_enable_always.sql new file mode 100644 index 000000000..fb4085011 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_after_update_event_trigger_enable_always.sql @@ -0,0 +1,16 @@ +-- Trigger: trig_after_update_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE CONSTRAINT TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" + AFTER UPDATE OF col2 + ON public.tablefortrigger + FOR EACH ROW + WHEN (old.col2 IS DISTINCT FROM new.col2) + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'comment for update event trigger'; + +ALTER TABLE public.tablefortrigger + ENABLE ALWAYS TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_after_update_event_trigger_enable_always_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_after_update_event_trigger_enable_always_msql.sql new file mode 100644 index 000000000..0fd725123 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_after_update_event_trigger_enable_always_msql.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.tablefortrigger + ENABLE ALWAYS TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_before_insert_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_before_insert_event_trigger.sql new file mode 100644 index 000000000..9ffbce483 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_before_insert_event_trigger.sql @@ -0,0 +1,15 @@ +-- Trigger: trig_test_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" + BEFORE INSERT + ON public.tablefortrigger + FOR EACH ROW + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; + +ALTER TABLE public.tablefortrigger + DISABLE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_before_insert_event_trigger_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_before_insert_event_trigger_msql.sql new file mode 100644 index 000000000..6d1351879 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_before_insert_event_trigger_msql.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.tablefortrigger + DISABLE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_before_update_event_trigger_enable_replica.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_before_update_event_trigger_enable_replica.sql new file mode 100644 index 000000000..400df80ed --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_before_update_event_trigger_enable_replica.sql @@ -0,0 +1,16 @@ +-- Trigger: trig_be4r_update_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" + BEFORE UPDATE OF col1 + ON public.tablefortrigger + FOR EACH ROW + WHEN (old.col2 IS DISTINCT FROM new.col2) + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; + +ALTER TABLE public.tablefortrigger + ENABLE REPLICA TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_before_update_event_trigger_enable_replica_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_before_update_event_trigger_enable_replica_msql.sql new file mode 100644 index 000000000..33f8926c8 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/alter_before_update_event_trigger_enable_replica_msql.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.tablefortrigger + ENABLE REPLICA TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_delete_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_delete_event_trigger.sql new file mode 100644 index 000000000..df82706d7 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_delete_event_trigger.sql @@ -0,0 +1,13 @@ +-- Trigger: trig_after_delete_events_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_delete_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE CONSTRAINT TRIGGER "trig_after_delete_events_$%{}[]()&*^!@""'`\/#" + AFTER DELETE + ON public.tablefortrigger + DEFERRABLE INITIALLY DEFERRED + FOR EACH ROW + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"('12'); + +COMMENT ON TRIGGER "trig_after_delete_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'delete event trig'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_delete_event_trigger_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_delete_event_trigger_msql.sql new file mode 100644 index 000000000..eac1f2acd --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_delete_event_trigger_msql.sql @@ -0,0 +1,9 @@ +CREATE CONSTRAINT TRIGGER "trig_after_delete_events_$%{}[]()&*^!@""'`\/#" + AFTER DELETE + ON public.tablefortrigger + DEFERRABLE INITIALLY DEFERRED + FOR EACH ROW + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(12); + +COMMENT ON TRIGGER "trig_after_delete_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'delete event trig'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_delete_event_trigger_with_transition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_delete_event_trigger_with_transition.sql new file mode 100644 index 000000000..08fc20242 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_delete_event_trigger_with_transition.sql @@ -0,0 +1,13 @@ +-- Trigger: trig_after_delete_events_with_transition_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" + AFTER DELETE + ON public.tablefortrigger + REFERENCING OLD TABLE AS oldtab + FOR EACH ROW + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_delete_event_trigger_with_transition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_delete_event_trigger_with_transition_msql.sql new file mode 100644 index 000000000..da0f1bed3 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_delete_event_trigger_with_transition_msql.sql @@ -0,0 +1,9 @@ +CREATE TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" + AFTER DELETE + ON public.tablefortrigger + REFERENCING OLD TABLE AS oldtab + FOR EACH ROW + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_delete_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_insert_event_trigger_with_transition.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_insert_event_trigger_with_transition.sql new file mode 100644 index 000000000..81bf82e5c --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_insert_event_trigger_with_transition.sql @@ -0,0 +1,13 @@ +-- Trigger: trig_after_insert_events_with_transition_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" + AFTER INSERT + ON public.tablefortrigger + REFERENCING NEW TABLE AS inserted + FOR EACH ROW + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_insert_event_trigger_with_transition_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_insert_event_trigger_with_transition_msql.sql new file mode 100644 index 000000000..c99b2dbf7 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_insert_event_trigger_with_transition_msql.sql @@ -0,0 +1,9 @@ +CREATE TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" + AFTER INSERT + ON public.tablefortrigger + REFERENCING NEW TABLE AS inserted + FOR EACH ROW + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_insert_events_with_transition_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_update_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_update_event_trigger.sql new file mode 100644 index 000000000..3c8beb698 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_update_event_trigger.sql @@ -0,0 +1,13 @@ +-- Trigger: trig_after_update_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE CONSTRAINT TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" + AFTER UPDATE OF col2 + ON public.tablefortrigger + FOR EACH ROW + WHEN (old.col2 IS DISTINCT FROM new.col2) + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'comment for update event trigger'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_update_event_trigger_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_update_event_trigger_msql.sql new file mode 100644 index 000000000..6b45691cc --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_after_update_event_trigger_msql.sql @@ -0,0 +1,9 @@ +CREATE CONSTRAINT TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" + AFTER UPDATE OF col2 + ON public.tablefortrigger + FOR EACH ROW + WHEN (OLD.col2 IS DISTINCT FROM NEW.col2) + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'comment for update event trigger'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_b4r_update_multiple_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_b4r_update_multiple_event_trigger.sql new file mode 100644 index 000000000..18d5aedea --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_b4r_update_multiple_event_trigger.sql @@ -0,0 +1,12 @@ +-- Trigger: trig_b4r_update_mul_events_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#" + BEFORE INSERT OR UPDATE OF col3 + ON public.tablefortrigger + FOR EACH ROW + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'multiple event trigger'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_b4r_update_multiple_event_trigger_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_b4r_update_multiple_event_trigger_msql.sql new file mode 100644 index 000000000..db938f9c1 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_b4r_update_multiple_event_trigger_msql.sql @@ -0,0 +1,8 @@ +CREATE TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#" + BEFORE INSERT OR UPDATE OF col3 + ON public.tablefortrigger + FOR EACH ROW + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'multiple event trigger'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_before_insert_event_at_statement.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_before_insert_event_at_statement.sql new file mode 100644 index 000000000..4b20ac928 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_before_insert_event_at_statement.sql @@ -0,0 +1,12 @@ +-- Trigger: trig_test_statement_$%{}[]()&*^!@\"'`\\/#" + +-- DROP TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#""" ON public.tablefortrigger; + +CREATE TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#""" + BEFORE INSERT OR DELETE OR TRUNCATE OR UPDATE OF col1, col2, col3 + ON public.tablefortrigger + FOR EACH STATEMENT + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#""" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_before_insert_event_at_statement_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_before_insert_event_at_statement_msql.sql new file mode 100644 index 000000000..50c4c59ec --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_before_insert_event_at_statement_msql.sql @@ -0,0 +1,8 @@ +CREATE TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#""" + BEFORE INSERT OR DELETE OR TRUNCATE OR UPDATE OF col1, col2, col3 + ON public.tablefortrigger + FOR EACH STATEMENT + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#""" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_before_insert_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_before_insert_event_trigger.sql new file mode 100644 index 000000000..15bbcd283 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_before_insert_event_trigger.sql @@ -0,0 +1,12 @@ +-- Trigger: trig_test_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" + BEFORE INSERT + ON public.tablefortrigger + FOR EACH ROW + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_before_insert_event_trigger_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_before_insert_event_trigger_msql.sql new file mode 100644 index 000000000..bc237813a --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_before_insert_event_trigger_msql.sql @@ -0,0 +1,8 @@ +CREATE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" + BEFORE INSERT + ON public.tablefortrigger + FOR EACH ROW + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_before_update_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_before_update_event_trigger.sql new file mode 100644 index 000000000..85465cd26 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_before_update_event_trigger.sql @@ -0,0 +1,13 @@ +-- Trigger: trig_be4r_update_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" + BEFORE UPDATE OF col1 + ON public.tablefortrigger + FOR EACH ROW + WHEN (old.col2 IS DISTINCT FROM new.col2) + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_before_update_event_trigger_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_before_update_event_trigger_msql.sql new file mode 100644 index 000000000..cbaf31024 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/create_before_update_event_trigger_msql.sql @@ -0,0 +1,9 @@ +CREATE TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" + BEFORE UPDATE OF col1 + ON public.tablefortrigger + FOR EACH ROW + WHEN (OLD.col2 IS DISTINCT FROM NEW.col2) + EXECUTE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/test.json new file mode 100644 index 000000000..a79df68bf --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/11_plus/test.json @@ -0,0 +1,312 @@ +{ + "scenarios": [ + { + "type": "create", + "name": "Create Table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "tablefortrigger", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "col2", + "cltype": "text" + }, + { + "name": "col3", + "cltype": "integer" + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create trigger function", + "endpoint": "NODE-trigger_function.obj", + "sql_endpoint": "NODE-trigger_function.sql_id", + "data": { + "name": "Trig1_$%{}[]()&*^!@\"'`\\/#", + "acl": [], + "args": [], + "funcowner": "enterprisedb", + "lanname": "plpgsql", + "options": [], + "pronamespace": 2200, + "prorettypename": "trigger", + "prosrc": "begin\nselect 1;\nend;", + "seclabels": [], + "variables": [], + "schema": "public" + }, + "expected_sql_file": "create_plain_trigger_function.sql" + }, + { + "type": "create", + "name": "Create before event trigger", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_test_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "BEFORE", + "evnt_truncate": false, + "description": "test comment", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_insert": true + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_before_insert_event_trigger.sql", + "expected_msql_file": "create_before_insert_event_trigger_msql.sql" + }, + { + "type": "alter", + "name": "Alter(disable) before event trigger", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql_id", + "data": { + "name": "trig_test_$%{}[]()&*^!@\"'`\\/#", + "is_enable_trigger": "D" + }, + "schema": "public", + "expected_sql_file": "alter_before_insert_event_trigger.sql", + "expected_msql_file": "alter_before_insert_event_trigger_msql.sql" + }, + { + "type": "create", + "name": "Create before update event trigger", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_be4r_update_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "BEFORE", + "evnt_truncate": false, + "description": "test comment", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_update": true, + "columns": "[\"col1\"]", + "whenclause": "OLD.col2 IS DISTINCT FROM NEW.col2" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_before_update_event_trigger.sql", + "expected_msql_file": "create_before_update_event_trigger_msql.sql" + }, + { + "type": "alter", + "name": "Alter before update event trigger enable replica", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql_id", + "data": { + "name": "trig_be4r_update_$%{}[]()&*^!@\"'`\\/#", + "is_enable_trigger": "R" + }, + "schema": "public", + "expected_sql_file": "alter_before_update_event_trigger_enable_replica.sql", + "expected_msql_file": "alter_before_update_event_trigger_enable_replica_msql.sql" + }, + { + "type": "create", + "name": "Create after update event trigger", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_after_update_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "AFTER", + "evnt_truncate": false, + "description": "comment for update event trigger", + "is_constraint_trigger": true, + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_update": true, + "whenclause": "OLD.col2 IS DISTINCT FROM NEW.col2", + "columns": "[\"col2\"]" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_after_update_event_trigger.sql", + "expected_msql_file": "create_after_update_event_trigger_msql.sql" + }, + { + "type": "alter", + "name": "Alter after update event trigger enable always", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql_id", + "data": { + "name": "trig_after_update_$%{}[]()&*^!@\"'`\\/#", + "is_enable_trigger": "A" + }, + "schema": "public", + "expected_sql_file": "alter_after_update_event_trigger_enable_always.sql", + "expected_msql_file": "alter_after_update_event_trigger_enable_always_msql.sql" + }, + { + "type": "create", + "name": "Create trigger on before for multiple events", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_b4r_update_mul_events_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "BEFORE", + "evnt_truncate": false, + "description": "multiple event trigger", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_insert": true, + "evnt_update": true, + "columns": "[\"col3\"]", + "whenclause": "" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_b4r_update_multiple_event_trigger.sql", + "expected_msql_file": "create_b4r_update_multiple_event_trigger_msql.sql" + }, + { + "type": "create", + "name": "Create trigger on after delete event with arguments", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_after_delete_events_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "AFTER", + "evnt_truncate": false, + "description": "delete event trig", + "is_constraint_trigger": true, + "tgdeferrable": true, + "tginitdeferred": true, + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "tgargs": "12", + "evnt_delete": true + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_after_delete_event_trigger.sql", + "expected_msql_file": "create_after_delete_event_trigger_msql.sql" + }, + { + "type": "delete", + "name": "Delete trigger on after delete event with arguments", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "data": { + "name": "trig_after_delete_events_$%{}[]()&*^!@\"'`\\/#" + }, + "schema": "public" + }, + { + "type": "create", + "name": "Create before event trigger at statement level", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_test_statement_$%{}[]()&*^!@\\\"'`\\\\/#\"", + "is_row_trigger": false, + "fires": "BEFORE", + "evnt_truncate": true, + "description": "test comment", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_insert": true, + "evnt_delete": true, + "evnt_update": true, + "whenclause": "", + "columns": "[\"col1\",\"col2\",\"col3\"]" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_before_insert_event_at_statement.sql", + "expected_msql_file": "create_before_insert_event_at_statement_msql.sql" + }, + { + "type": "create", + "name": "Create trigger on after insert event with transition", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_after_insert_events_with_transition_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "AFTER", + "evnt_truncate": false, + "description": "test comment", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_insert": true, + "tgnewtable": "inserted" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_after_insert_event_trigger_with_transition.sql", + "expected_msql_file": "create_after_insert_event_trigger_with_transition_msql.sql" + }, + { + "type": "alter", + "name": "Alter(disable) trigger on after inset event with transition", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql_id", + "data": { + "name": "trig_after_insert_events_with_transition_$%{}[]()&*^!@\"'`\\/#", + "is_enable_trigger": "D" + }, + "schema": "public", + "expected_sql_file": "alter_after_insert_event_trigger_with_transition.sql", + "expected_msql_file": "alter_after_insert_event_trigger_with_transition_msql.sql" + }, + { + "type": "create", + "name": "Create trigger on after delete event with transition", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_after_delete_events_with_transition_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "AFTER", + "evnt_truncate": false, + "description": "test comment", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "is_constraint_trigger": false, + "evnt_delete": true, + "tgoldtable": "oldtab" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_after_delete_event_trigger_with_transition.sql", + "expected_msql_file": "create_after_delete_event_trigger_with_transition_msql.sql" + }, + { + "type": "alter", + "name": "Alter trigger on after delete event with transition always enable", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql_id", + "data": { + "name": "trig_after_delete_events_with_transition_$%{}[]()&*^!@\"'`\\/#", + "is_enable_trigger": "A" + }, + "schema": "public", + "expected_sql_file": "alter_after_delete_event_trigger_with_transition.sql", + "expected_msql_file": "alter_after_delete_event_trigger_with_transition_msql.sql" + } + ] +} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/alter_after_update_event_trigger_enable_always.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/alter_after_update_event_trigger_enable_always.sql new file mode 100644 index 000000000..ed35564d7 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/alter_after_update_event_trigger_enable_always.sql @@ -0,0 +1,16 @@ +-- Trigger: trig_after_update_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE CONSTRAINT TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" + AFTER UPDATE OF col2 + ON public.tablefortrigger + FOR EACH ROW + WHEN ((old.col2 IS DISTINCT FROM new.col2)) + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'comment for update event trigger'; + +ALTER TABLE public.tablefortrigger + ENABLE ALWAYS TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/alter_after_update_event_trigger_enable_always_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/alter_after_update_event_trigger_enable_always_msql.sql new file mode 100644 index 000000000..0fd725123 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/alter_after_update_event_trigger_enable_always_msql.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.tablefortrigger + ENABLE ALWAYS TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/alter_before_insert_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/alter_before_insert_event_trigger.sql new file mode 100644 index 000000000..cf8ee7459 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/alter_before_insert_event_trigger.sql @@ -0,0 +1,15 @@ +-- Trigger: trig_test_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" + BEFORE INSERT + ON public.tablefortrigger + FOR EACH ROW + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; + +ALTER TABLE public.tablefortrigger + DISABLE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/alter_before_insert_event_trigger_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/alter_before_insert_event_trigger_msql.sql new file mode 100644 index 000000000..6d1351879 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/alter_before_insert_event_trigger_msql.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.tablefortrigger + DISABLE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/alter_before_update_event_trigger_enable_replica.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/alter_before_update_event_trigger_enable_replica.sql new file mode 100644 index 000000000..1a9eafb08 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/alter_before_update_event_trigger_enable_replica.sql @@ -0,0 +1,16 @@ +-- Trigger: trig_be4r_update_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" + BEFORE UPDATE OF col1 + ON public.tablefortrigger + FOR EACH ROW + WHEN ((old.col2 IS DISTINCT FROM new.col2)) + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; + +ALTER TABLE public.tablefortrigger + ENABLE REPLICA TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/alter_before_update_event_trigger_enable_replica_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/alter_before_update_event_trigger_enable_replica_msql.sql new file mode 100644 index 000000000..33f8926c8 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/alter_before_update_event_trigger_enable_replica_msql.sql @@ -0,0 +1,2 @@ +ALTER TABLE public.tablefortrigger + ENABLE REPLICA TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#"; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_after_delete_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_after_delete_event_trigger.sql new file mode 100644 index 000000000..a85a35502 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_after_delete_event_trigger.sql @@ -0,0 +1,13 @@ +-- Trigger: trig_after_delete_events_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_delete_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE CONSTRAINT TRIGGER "trig_after_delete_events_$%{}[]()&*^!@""'`\/#" + AFTER DELETE + ON public.tablefortrigger + DEFERRABLE INITIALLY DEFERRED + FOR EACH ROW + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"('12'); + +COMMENT ON TRIGGER "trig_after_delete_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'delete event trig'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_after_delete_event_trigger_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_after_delete_event_trigger_msql.sql new file mode 100644 index 000000000..9ad3585cc --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_after_delete_event_trigger_msql.sql @@ -0,0 +1,9 @@ +CREATE CONSTRAINT TRIGGER "trig_after_delete_events_$%{}[]()&*^!@""'`\/#" + AFTER DELETE + ON public.tablefortrigger + DEFERRABLE INITIALLY DEFERRED + FOR EACH ROW + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(12); + +COMMENT ON TRIGGER "trig_after_delete_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'delete event trig'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_after_update_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_after_update_event_trigger.sql new file mode 100644 index 000000000..e56ec6775 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_after_update_event_trigger.sql @@ -0,0 +1,13 @@ +-- Trigger: trig_after_update_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE CONSTRAINT TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" + AFTER UPDATE OF col2 + ON public.tablefortrigger + FOR EACH ROW + WHEN ((old.col2 IS DISTINCT FROM new.col2)) + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'comment for update event trigger'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_after_update_event_trigger_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_after_update_event_trigger_msql.sql new file mode 100644 index 000000000..2fcc70af4 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_after_update_event_trigger_msql.sql @@ -0,0 +1,9 @@ +CREATE CONSTRAINT TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" + AFTER UPDATE OF col2 + ON public.tablefortrigger + FOR EACH ROW + WHEN (OLD.col2 IS DISTINCT FROM NEW.col2) + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_after_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'comment for update event trigger'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_b4r_update_multiple_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_b4r_update_multiple_event_trigger.sql new file mode 100644 index 000000000..a0f3f8b4e --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_b4r_update_multiple_event_trigger.sql @@ -0,0 +1,12 @@ +-- Trigger: trig_b4r_update_mul_events_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#" + BEFORE INSERT OR UPDATE OF col3 + ON public.tablefortrigger + FOR EACH ROW + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'multiple event trigger'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_b4r_update_multiple_event_trigger_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_b4r_update_multiple_event_trigger_msql.sql new file mode 100644 index 000000000..5d4e7c265 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_b4r_update_multiple_event_trigger_msql.sql @@ -0,0 +1,8 @@ +CREATE TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#" + BEFORE INSERT OR UPDATE OF col3 + ON public.tablefortrigger + FOR EACH ROW + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_b4r_update_mul_events_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'multiple event trigger'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_before_insert_event_at_statement.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_before_insert_event_at_statement.sql new file mode 100644 index 000000000..c0cf9c6ac --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_before_insert_event_at_statement.sql @@ -0,0 +1,12 @@ +-- Trigger: trig_test_statement_$%{}[]()&*^!@\"'`\\/#" + +-- DROP TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#""" ON public.tablefortrigger; + +CREATE TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#""" + BEFORE INSERT OR DELETE OR TRUNCATE OR UPDATE OF col1, col2, col3 + ON public.tablefortrigger + FOR EACH STATEMENT + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#""" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_before_insert_event_at_statement_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_before_insert_event_at_statement_msql.sql new file mode 100644 index 000000000..74317a513 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_before_insert_event_at_statement_msql.sql @@ -0,0 +1,8 @@ +CREATE TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#""" + BEFORE INSERT OR DELETE OR TRUNCATE OR UPDATE OF col1, col2, col3 + ON public.tablefortrigger + FOR EACH STATEMENT + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_test_statement_$%{}[]()&*^!@\""'`\\/#""" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_before_insert_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_before_insert_event_trigger.sql new file mode 100644 index 000000000..260649499 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_before_insert_event_trigger.sql @@ -0,0 +1,12 @@ +-- Trigger: trig_test_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" + BEFORE INSERT + ON public.tablefortrigger + FOR EACH ROW + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_before_insert_event_trigger_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_before_insert_event_trigger_msql.sql new file mode 100644 index 000000000..7388f1bc6 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_before_insert_event_trigger_msql.sql @@ -0,0 +1,8 @@ +CREATE TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" + BEFORE INSERT + ON public.tablefortrigger + FOR EACH ROW + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_test_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_before_update_event_trigger.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_before_update_event_trigger.sql new file mode 100644 index 000000000..cd0779ea5 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_before_update_event_trigger.sql @@ -0,0 +1,13 @@ +-- Trigger: trig_be4r_update_$%{}[]()&*^!@"'`\/# + +-- DROP TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger; + +CREATE TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" + BEFORE UPDATE OF col1 + ON public.tablefortrigger + FOR EACH ROW + WHEN ((old.col2 IS DISTINCT FROM new.col2)) + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_before_update_event_trigger_msql.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_before_update_event_trigger_msql.sql new file mode 100644 index 000000000..89a211c9f --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_before_update_event_trigger_msql.sql @@ -0,0 +1,9 @@ +CREATE TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" + BEFORE UPDATE OF col1 + ON public.tablefortrigger + FOR EACH ROW + WHEN (OLD.col2 IS DISTINCT FROM NEW.col2) + EXECUTE PROCEDURE public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +COMMENT ON TRIGGER "trig_be4r_update_$%{}[]()&*^!@""'`\/#" ON public.tablefortrigger + IS 'test comment'; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_plain_trigger_function.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_plain_trigger_function.sql new file mode 100644 index 000000000..99e66f526 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/create_plain_trigger_function.sql @@ -0,0 +1,17 @@ +-- FUNCTION: public.Trig1_$%{}[]()&*^!@"'`\/#() + +-- DROP FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"(); + +CREATE FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"() + RETURNS trigger + LANGUAGE 'plpgsql' + COST 100 + VOLATILE NOT LEAKPROOF +AS $BODY$ +begin +select 1; +end; +$BODY$; + +ALTER FUNCTION public."Trig1_$%{}[]()&*^!@""'`\/#"() + OWNER TO enterprisedb; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/test.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/test.json new file mode 100644 index 000000000..62e47d423 --- /dev/null +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/triggers/tests/ppas/default/test.json @@ -0,0 +1,241 @@ +{ + "scenarios": [ + { + "type": "create", + "name": "Create Table", + "endpoint": "NODE-table.obj", + "sql_endpoint": "NODE-table.sql_id", + "data": { + "name": "tablefortrigger", + "columns": [ + { + "name": "col1", + "cltype": "integer", + "is_primary_key": true + }, + { + "name": "col2", + "cltype": "text" + }, + { + "name": "col3", + "cltype": "integer" + } + ], + "is_partitioned": false, + "schema": "public", + "spcname": "pg_default" + }, + "store_object_id": true + }, + { + "type": "create", + "name": "Create trigger function", + "endpoint": "NODE-trigger_function.obj", + "sql_endpoint": "NODE-trigger_function.sql_id", + "data": { + "name": "Trig1_$%{}[]()&*^!@\"'`\\/#", + "acl": [], + "args": [], + "funcowner": "enterprisedb", + "lanname": "plpgsql", + "options": [], + "pronamespace": 2200, + "prorettypename": "trigger", + "prosrc": "begin\nselect 1;\nend;", + "seclabels": [], + "variables": [], + "schema": "public" + }, + "expected_sql_file": "create_plain_trigger_function.sql" + }, + { + "type": "create", + "name": "Create before event trigger", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_test_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "BEFORE", + "evnt_truncate": false, + "description": "test comment", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_insert": true + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_before_insert_event_trigger.sql", + "expected_msql_file": "create_before_insert_event_trigger_msql.sql" + }, + { + "type": "alter", + "name": "Alter(disable) before event trigger", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql_id", + "data": { + "name": "trig_test_$%{}[]()&*^!@\"'`\\/#", + "is_enable_trigger": "D" + }, + "schema": "public", + "expected_sql_file": "alter_before_insert_event_trigger.sql", + "expected_msql_file": "alter_before_insert_event_trigger_msql.sql" + }, + { + "type": "create", + "name": "Create before update event trigger", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_be4r_update_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "BEFORE", + "evnt_truncate": false, + "description": "test comment", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_update": true, + "columns": "[\"col1\"]", + "whenclause": "OLD.col2 IS DISTINCT FROM NEW.col2" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_before_update_event_trigger.sql", + "expected_msql_file": "create_before_update_event_trigger_msql.sql" + }, + { + "type": "alter", + "name": "Alter before update event trigger enable replica", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql_id", + "data": { + "name": "trig_be4r_update_$%{}[]()&*^!@\"'`\\/#", + "is_enable_trigger": "R" + }, + "schema": "public", + "expected_sql_file": "alter_before_update_event_trigger_enable_replica.sql", + "expected_msql_file": "alter_before_update_event_trigger_enable_replica_msql.sql" + }, + { + "type": "create", + "name": "Create after update event trigger", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_after_update_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "AFTER", + "evnt_truncate": false, + "description": "comment for update event trigger", + "is_constraint_trigger": true, + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_update": true, + "whenclause": "OLD.col2 IS DISTINCT FROM NEW.col2", + "columns": "[\"col2\"]" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_after_update_event_trigger.sql", + "expected_msql_file": "create_after_update_event_trigger_msql.sql" + }, + { + "type": "alter", + "name": "Alter after update event trigger enable always", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql_id", + "data": { + "name": "trig_after_update_$%{}[]()&*^!@\"'`\\/#", + "is_enable_trigger": "A" + }, + "schema": "public", + "expected_sql_file": "alter_after_update_event_trigger_enable_always.sql", + "expected_msql_file": "alter_after_update_event_trigger_enable_always_msql.sql" + }, + { + "type": "create", + "name": "Create trigger on before for multiple events", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_b4r_update_mul_events_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "BEFORE", + "evnt_truncate": false, + "description": "multiple event trigger", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_insert": true, + "evnt_update": true, + "columns": "[\"col3\"]", + "whenclause": "" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_b4r_update_multiple_event_trigger.sql", + "expected_msql_file": "create_b4r_update_multiple_event_trigger_msql.sql" + }, + { + "type": "create", + "name": "Create trigger on after delete event with arguments", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_after_delete_events_$%{}[]()&*^!@\"'`\\/#", + "is_row_trigger": true, + "fires": "AFTER", + "evnt_truncate": false, + "description": "delete event trig", + "is_constraint_trigger": true, + "tgdeferrable": true, + "tginitdeferred": true, + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "tgargs": "12", + "evnt_delete": true + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_after_delete_event_trigger.sql", + "expected_msql_file": "create_after_delete_event_trigger_msql.sql" + }, + { + "type": "delete", + "name": "Delete trigger on after delete event with arguments", + "endpoint": "NODE-trigger.obj_id", + "sql_endpoint": "NODE-trigger.sql_id", + "data": { + "name": "trig_after_delete_events_$%{}[]()&*^!@\"'`\\/#" + }, + "schema": "public" + }, + { + "type": "create", + "name": "Create before event trigger at statement level", + "endpoint": "NODE-trigger.obj", + "sql_endpoint": "NODE-trigger.sql_id", + "msql_endpoint": "NODE-trigger.msql", + "data": { + "name": "trig_test_statement_$%{}[]()&*^!@\\\"'`\\\\/#\"", + "is_row_trigger": false, + "fires": "BEFORE", + "evnt_truncate": true, + "description": "test comment", + "tfunction": "public.\"Trig1_$%{}[]()&*^!@\"\"'`\\/#\"", + "evnt_insert": true, + "evnt_delete": true, + "evnt_update": true, + "whenclause": "", + "columns": "[\"col1\",\"col2\",\"col3\"]" + }, + "schema": "public", + "store_object_id": true, + "expected_sql_file": "create_before_insert_event_at_statement.sql", + "expected_msql_file": "create_before_insert_event_at_statement_msql.sql" + } + ] +} diff --git a/web/regression/python_test_utils/test_utils.py b/web/regression/python_test_utils/test_utils.py index 7d0581f3b..acce39371 100644 --- a/web/regression/python_test_utils/test_utils.py +++ b/web/regression/python_test_utils/test_utils.py @@ -1417,6 +1417,7 @@ def get_parallel_sequential_module_list(module_list): sequential_tests_file = [ 'pgadmin.feature_tests.pg_utilities_backup_restore_test', 'pgadmin.feature_tests.pg_utilities_maintenance_test', + 'pgadmin.feature_tests.keyboard_shortcut_test' ] # list of tests can be executed in parallel diff --git a/web/regression/re_sql/tests/test_resql.py b/web/regression/re_sql/tests/test_resql.py index 541fbcd16..f5c3a8bd7 100644 --- a/web/regression/re_sql/tests/test_resql.py +++ b/web/regression/re_sql/tests/test_resql.py @@ -115,6 +115,7 @@ class ReverseEngineeredSQLTestCases(BaseTestGenerator): module_path = resql_module_list[module] # Get the folder name based on server version number and # their existence. + self.module_path = module_path status, self.test_folder = self.get_test_folder(module_path) if not status: continue @@ -370,6 +371,39 @@ class ReverseEngineeredSQLTestCases(BaseTestGenerator): return False, None + def get_test_file(self, file_name): + """ + This function will get the appropriate test file based on + server version and their existence. + + :param file_name: File containing expected output . + :return: + """ + # Join the application path, module path and tests folder + tests_folder_path = \ + os.path.join(self.apppath, self.module_path, 'tests') + + # A folder name matching the Server Type (pg, ppas) takes priority so + # check whether that exists or not. If so, than check the version + # folder in it, else look directly in the 'tests' folder. + absolute_path = os.path.join(tests_folder_path, self.server['type']) + if not os.path.exists(absolute_path): + absolute_path = tests_folder_path + + # Iterate the version mapping directories. + for version_mapping in get_version_mapping_directories( + self.server['type']): + if version_mapping['number'] > \ + self.server_information['server_version']: + continue + complete_path = os.path.join(absolute_path, + version_mapping['name'], file_name) + + if os.path.exists(complete_path): + return True, complete_path + + return False, None + def check_msql(self, scenario, object_id): """ This function is used to check the modified SQL. @@ -422,10 +456,10 @@ class ReverseEngineeredSQLTestCases(BaseTestGenerator): # Check if expected sql is given in JSON file or path of the output # file is given if 'expected_msql_file' in scenario: - output_file = os.path.join(self.test_folder, - scenario['expected_msql_file']) + file_found, output_file = \ + self.get_test_file(scenario['expected_msql_file']) - if os.path.exists(output_file): + if file_found: fp = open(output_file, "r") # Used rstrip to remove trailing \n sql = fp.read().rstrip() @@ -477,8 +511,8 @@ class ReverseEngineeredSQLTestCases(BaseTestGenerator): # Check if expected sql is given in JSON file or path of the output # file is given if 'expected_sql_file' in scenario: - output_file = os.path.join(self.test_folder, - scenario['expected_sql_file']) + file_found, output_file = \ + self.get_test_file(scenario['expected_sql_file']) if os.path.exists(output_file): fp = open(output_file, "r") diff --git a/web/regression/runtests.py b/web/regression/runtests.py index f59dacacb..cea20e3cc 100644 --- a/web/regression/runtests.py +++ b/web/regression/runtests.py @@ -559,6 +559,9 @@ def execute_test(test_module_list_passed, server_passed, driver_passed, print("Exception in {0} {1}".format( threading.current_thread().ident, threading.currentThread().getName())) + # Mark failure as true + global failure + failure = True finally: # Delete web-driver instance thread_name = "parallel_tests" + server_passed['name']