NASA-AMMOS / anms-camp

C code generator for AMP
https://anms-camp.readthedocs.io/en/latest/
Apache License 2.0
1 stars 2 forks source link

error in camp-generated sql file for `ion_bpsec_admin.json` #10

Open karenhaining opened 3 months ago

karenhaining commented 3 months ago

The camp-generated sql file for the ion_bpsec_admin.json ADM throws an error when executed in the ANMS database.

Example error messages:

From an integration test in the JHUAPL-DTNMA repo CI/CD:

        with open(sql_file, "r") as f:
>           cursor.execute(f.read())
E           psycopg2.errors.UndefinedTable: relation "public.vw_ari_union" does not exist
E           LINE 1: amp_agent_op_plusuint_aid = (select obj_id FROM public.vw_ar...
E                                                                   ^
E           QUERY:  amp_agent_op_plusuint_aid = (select obj_id FROM public.vw_ari_union WHERE obj_name = 'plusUINT' and adm_name = (select adm_name from public.vw_namespace where name_string = 'Amp/Agent')  and actual = true)
E           CONTEXT:  PL/pgSQL function inline_code_block line 622 at assignment

Same test when ran locally:

        with open(sql_file, "r") as f:
>           cursor.execute(f.read())
E           psycopg2.errors.NotNullViolation: null value in column "obj_actual_definition_id" of relation "ari_collection_actual_entry" violates not-null constraint
E           DETAIL:  Failing row contains (68, null).
E           CONTEXT:  SQL statement "INSERT INTO ari_collection_actual_entry(ac_entry_id, obj_actual_definition_id) VALUES(r_ac_entry_id, p_definition_id)"
E           PL/pgSQL function sp__insert_ac_actual_entry(integer,integer,integer,integer) line 5 at SQL statement
E           SQL statement "CALL SP__insert_ac_actual_entry(var_ac_id, amp_agent_op_plusuint_aid, 3, r_ac_entry_id_3 )"
E           PL/pgSQL function inline_code_block line 623 at CALL

where cursor is the cursor of a connection to the ANMS library (using psycopg2), and sql_file is the camp-generated sql file.