Error codes for LIMIT and OFFSET

Started by Peter Eisentrautabout 17 years ago2 messageshackers
Jump to latest
#1Peter Eisentraut
peter_e@gmx.net

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)?

Attachments:

limit-offset-errcodes.patchtext/x-diff; name=limit-offset-errcodes.patchDownload+4-2
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#1)
Re: Error codes for LIMIT and OFFSET

Peter Eisentraut <peter_e@gmx.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