Skip site navigation (1) Skip section navigation (2)

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

From: Leon Starr <leon_starr(at)modelint(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: How to trap error: nextval: reached maximum value of sequence
Date: 2011-06-22 04:13:03
Message-ID: 5D773988-CB96-414B-878D-59F5EAA49535@modelint.com (view raw or flat)
Thread:
Lists: pgsql-novice
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!!!

- Leon Starr

Responses

pgsql-novice by date

Next:From: Jean-Yves F. BarbierDate: 2011-06-22 13:49:07
Subject: to escape or not to
Previous:From: Josh KupershmidtDate: 2011-06-21 21:51:31
Subject: Re: test CHECK on command line

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group