Project

General

Profile

« Previous | Next » 

Revision 3262

schemas/vegbien.sql: taxondetermination: taxondetermination_taxonoccurrence_id_fkey manual fkey constraint: Fixed bug where needed to raise foreign_key_violation instead of unique_violation

View differences:

schemas/vegbien.sql
306 306
        FROM taxonoccurrence
307 307
        WHERE taxonoccurrence_id = new.taxonoccurrence_id
308 308
    ) THEN
309
        RAISE EXCEPTION 'duplicate key value violates unique constraint '
310
            '"taxondetermination_taxonoccurrence_id_fkey()"'
311
            USING ERRCODE = 'unique_violation';
309
        RAISE EXCEPTION 'insert or update on table "taxondetermination" '
310
'violates foreign key constraint "taxondetermination_taxonoccurrence_id_fkey"\n'
311
'DETAIL: Key (taxondetermination_taxonoccurrence_id_fkey)=(%) is not present in'
312
' table "taxonoccurrence".', new.taxonoccurrence_id
313
            USING ERRCODE = 'foreign_key_violation';
312 314
    END IF;
313 315
    
314 316
    RETURN new;

Also available in: Unified diff