Hay un error: ERROR: column "instauran" does not exist LINE 25: WHERE n.idnota =instauran ^