humlab-sead / sead_clearinghouse

SEAD ClearingHouse
0 stars 1 forks source link

Import of ceramics data fails on new server #9

Closed roger-mahler closed 5 years ago

roger-mahler commented 5 years ago

Logged error:

ABORTED CRITICAL ERROR ceramics_data_latest
Traceback (most recent call last):
  File "process.py", line 63, in process
    self.repository.extract_submission(submission_id)
  File "C:\Users\roma0050\Documents\Projects\SEAD\sead_clearing_house\import\repository.py", line 62, in extract_submission
    cursor.callproc('clearing_house.fn_extract_and_store_submission_tables', (submission_id,))
psycopg2.errors.NotNullViolation: null value in column "record_count" violates not-null constraint
DETAIL:  Failing row contains (1, 1, 38, null).
CONTEXT:  SQL statement "Insert Into clearing_house.tbl_clearinghouse_submission_xml_content_tables (submission_id, table_id, record_count)
        Select t.submission_id, x.table_id, t.row_count
        From  clearing_house.fn_select_xml_content_tables(p_submission_id) t
        Join clearing_house.tbl_clearinghouse_submission_tables x
          On x.table_name = t.table_name"
PL/pgSQL function clearing_house.fn_extract_and_store_submission_tables(integer) line 26 at SQL statement
roger-mahler commented 5 years ago

Seems to be caused by upgrade to PostgreSQL 11. This fails to return correct row_count: (xpath('./@length[1]', d.xml))[1]::text::int as row_count This returnr correct row_count: (xpath('//@length', d.xml))[1]::text::int as row_count