Re: How to trap error: nextval: reached maximum value of sequence

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Leon Starr <leon_starr(at)modelint(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: How to trap error: nextval: reached maximum value of sequence
Date: 2011-06-22 20:13:46
Message-ID: BANLkTikmyRK836jbaiLJKw5j=HMn94i1nw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Tue, Jun 21, 2011 at 11:13 PM, Leon Starr <leon_starr(at)modelint(dot)com> wrote:
> I want to trap this exception...
>
> ERROR:  nextval: reached maximum value of sequence
>
> ...and print a user friendly message.  But I can't figure out what exception code to test
> for.  Example:
>
> exception
>        when ??? then
>                raise exception 'Range too small.';
>
> I looked through the postgres exception codes in the appendix, but couldn't find
> the appropriate exception.  WHY don't they match up the error message names???  Is there some
> trick to making the connection from a psql error message to the related exception?
> (So far I just go with past experience, but it would be nice if there was a system).
>
> Help appreciated!!!

it's object_not_in_prerequisite_state.

A pretty effective way to figure this out is to actually just grep the
code for the error message fragment and see what's being passed to
ereport.

merlin

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Jean-Yves F. Barbier 2011-06-22 20:45:26 Re: seeking advices for function
Previous Message Merlin Moncure 2011-06-22 20:07:16 Re: seeking advices for function