Error codes for LIMIT and OFFSET

Lists: pgsql-hackers
From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Error codes for LIMIT and OFFSET
Date: 2009-02-27 11:32:34
Message-ID: 49A7CF52.9040302@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

I was looking into adding new specific SQL:2008 error codes for invalid
LIMIT and OFFSET values (see attached patch), when I came across an
existing error code definition:

#define ERRCODE_INVALID_LIMIT_VALUE MAKE_SQLSTATE('2','2', '0','2','0')

This definition has been in our sources since error codes were first
added, but I don't find this code in the standard (it uses a
standard-space SQLSTATE code), and as far as I can tell, it hasn't been
actually used anywhere. Except that PL/pgSQL defines it in plerrcodes.h
(and Google shows that various other interfaces list it as well), but it
can never happen, I think.

What should we do here, if anything? Redefine
ERRCODE_INVALID_LIMIT_VALUE to the new SQL:2008 code? Or remove the
whole thing (assuming that no PL/pgSQL code actually referes to it)?

Attachment Content-Type Size
limit-offset-errcodes.patch text/x-diff 2.0 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Error codes for LIMIT and OFFSET
Date: 2009-02-27 15:25:48
Message-ID: 18875.1235748348@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> What should we do here, if anything? Redefine
> ERRCODE_INVALID_LIMIT_VALUE to the new SQL:2008 code?

If you're going to spell the errcode macros as suggested in the
patch, just remove ERRCODE_INVALID_LIMIT_VALUE.

Note that this patch misses at least two places where new errcodes
need to be listed (plerrcodes.h and the documentation appendix)

regards, tom lane