Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZGV2j-0001dz-FP for pgsql-bugs@arkaria.postgresql.org; Sat, 18 Jul 2015 16:32:53 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZGV2i-0005Da-JM for pgsql-bugs@arkaria.postgresql.org; Sat, 18 Jul 2015 16:32:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZGV2g-0005Cw-Ld for pgsql-bugs@postgresql.org; Sat, 18 Jul 2015 16:32:50 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZGV2c-0006Jw-Tw for pgsql-bugs@postgresql.org; Sat, 18 Jul 2015 16:32:50 +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 t6IGWVCh011037; Sat, 18 Jul 2015 12:32:31 -0400 From: Tom Lane To: Julien Rouhaud cc: Fabien COELHO , Guillaume Lelarge , mail@bwe.im, Oleksandr Shulgin , PostgreSQL Bugs List Subject: Re: BUG #12379: pgbench should hint to pgbench -i In-reply-to: <55AA7BC9.6090307@dalibo.com> References: <20141231105955.8014.38426@wrigleys.postgresql.org> <87oales6zm.fsf@ashulgin01.corp.ad.zalando.net> <55984046.60901@dalibo.com> <559908D4.7020901@dalibo.com> <23314.1436142811@sss.pgh.pa.us> <55AA32E0.7070006@dalibo.com> <55AA7BC9.6090307@dalibo.com> Comments: In-reply-to Julien Rouhaud message dated "Sat, 18 Jul 2015 18:16:09 +0200" Date: Sat, 18 Jul 2015 12:32:31 -0400 Message-ID: <11036.1437237151@sss.pgh.pa.us> X-Pg-Spam-Score: -3.1 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Julien Rouhaud writes: > On 18/07/2015 13:49, Fabien COELHO wrote: >> I'm wondering why you added the define. Isn't-there some convenient >> include to get errcode definitions? > IIRC correctly, you have to include postgres.h for that. I supposed it > was better to define it than adding such an include, since it shouldn't > change and it's already done like this in vacuumdb.c. Frontend code *mustn't* include postgres.h. You could imagine including errcodes.h by itself after supplying a suitable definition for MAKE_SQLSTATE(); but I think you'd want it to reconstitute the five characters into a string literal, and I'm not sure that there's any easy way to do that in C. If we wanted to go in this direction, it might be easier to create another Perl script that puts out an errcodes-fe.h with the errcode symbols #defined as string literals. The larger reason we've not done this is that, once a given errcode is wired into some client-side code, it effectively becomes part of the protocol and can't be reassigned. See the comments around the places in libpq where specific errcodes are referenced. So it's not very clear that we want to encourage frontend code to use this technique a lot. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs