Thread

  1. VIP: enhanced errors

    Pavel Stehule <pavel.stehule@gmail.com> — 2011-06-05T18:14:04Z

    Hello all
    
    I am working on new diagnostics fields in errors - CONSTRAINT_NAME,
    SCHEMA_NAME, TABLE_NAME and COLUMN_NAME.
    
    These fields is shown when verbosity mode is active. Actually this
    works for table constraints, not null constraint and for RI
    constraints.
    
    postgres=# delete  from xxx;
    ERROR:  23503: update or delete on table "xxx" violates foreign key
    constraint "yyy_b_fkey" on table "yyy"
    DETAIL:  Key (a)=(10) is still referenced from table "yyy".
    LOCATION:  ri_ReportViolation, ri_triggers.c:3593
    CONSTRAINT:  yyy_b_fkey
    SCHEMA:  public
    TABLE:  xxx
    COLUMN:  a
    
    These fields should be available from GET DIAGNOSTICS statement too -
    It could be next step after support for stacked diagnostics.
    
    I looked on column name identification for column constraints - and
    there is not any possible identification - so I need a new column to
    pg_constraint table - "attrid", that should to identify column for
    column's constraint.
    
    This patch is just concept. Final patch will be significantly longer -
    we need to check any "ereport" call, as this most important
    constraints are table and ri constraints.
    
    Regards
    
    Pavel Stehule