Home > OS >  Postgres - Why is it giving the error 'Schema does not exist'
Postgres - Why is it giving the error 'Schema does not exist'

Time:03-30

Why am I getting the error 'schema "tp" does not exist'? - I think it is the 'NOT EXISTS' section that is throwing up the error, it doesnt see that I have aliased the table oimport.ead_incident_status AS tp - or I am writing it incorrectly

Any help appreciated

I am trying to run the following:

 SELECT
    split_part(inc_number,'INC',2)::integer incident,
    st.status,
    mi_start,
    mi_end

FROM
     odwh_import.ead_incident_status tp
     INNER JOIN odwh_data.ead_incident_status st ON tp.mi_value = st.status_description
WHERE
    NOT EXISTS
        (
        SELECT
            true
        FROM
            odwh_work.ead_incident_status_audit_s ead
        WHERE
            ead.incident = tp.split_part(inc_number,'INC',2)::integer
        AND ead.status = tp.status
        AND ead.start_datetime = tp.mi_start
        )
AND NOT EXISTS
        (
        SELECT
            true
        FROM
            odwh_work.ead_incident_s
        WHERE
            odwh_data.ead_incident.incident = tp.incident
        AND odwh_data.ead_incident.locked = 't'
        );

CodePudding user response:

Why am I getting the error 'schema "tp" does not exist'?

Because tp.split_part(...) references a function in that schema. You probably meant split_part(...).

  • Related