Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRJqa-0007Xv-Ej for pgsql-sql@arkaria.postgresql.org; Tue, 19 Dec 2017 15:30:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eRJqZ-0003pX-Ur for pgsql-sql@arkaria.postgresql.org; Tue, 19 Dec 2017 15:30:23 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eRJqZ-0003pI-Lt for pgsql-sql@lists.postgresql.org; Tue, 19 Dec 2017 15:30:23 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eRJqS-0006gv-Vr for pgsql-sql@lists.postgresql.org; Tue, 19 Dec 2017 15:30:22 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id vBJFUEbE032000; Tue, 19 Dec 2017 10:30:15 -0500 From: Tom Lane To: =?UTF-8?Q?J=c3=bcrgen_Purtz?= cc: pgsql-sql@lists.postgresql.org Subject: Re: SQL conformity regarding SQLSTATE In-reply-to: References: Comments: In-reply-to =?UTF-8?Q?J=c3=bcrgen_Purtz?= message dated "Tue, 19 Dec 2017 15:14:50 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <31998.1513697414.1@sss.pgh.pa.us> Date: Tue, 19 Dec 2017 10:30:14 -0500 Message-ID: <31999.1513697414@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk =?UTF-8?Q?J=c3=bcrgen_Purtz?= writes: > SQLSTATE is defined by the SQL standard. Our usage of the value seems to > contain some defects in respect to it: There are various SQLSTATE codes that we borrowed from DB2 and other RDBMSes; to the extent that those violate the spec, we're in good company. > Here is a list of values, which violate the above rule as the values are > in the range which is reserved for the standard but (actually) are not > defined by the standard. I compared our list in the version 10 > documentation with the SQL:2011 standard. (Unfortunately I have no > access to SQL:2016. Maybe, some values of my list are defined there.) > 01008, 03000, 0B000, 23502 - 23514, 39001, 42501 - 42939, F0000, F0001. Actually, I'm pretty sure we were looking at SQL99 when we made our original list. I see 01008, 03000, 0B000, and 39001 there; are they really not in later specs? The 23xxx and 42xxx codes are there because SQL99 provides ridiculously few subclasses for those classes. I think many of those might've been borrowed from DB2, but in any case they're in the legal range for extension subclasses, so I don't follow your complaint. Class F0 seems like a mistake ... maybe we could get away with changing those two assignments, since it seems unlikely that any client code is looking for those values. > b) Shall we add a comment into 'errcodes.txt' to remind everybody to the > mentioned rule? You mean the one at lines 64ff? > c) Is it possible to rearrange the rows of 'errcode.txt' in a way that > reflects the natural sort order of SQLSTATE? I'd have said it was already. regards, tom lane