pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Julien Rouhaud <julien.rouhaud@dalibo.com>
Cc: Fabien COELHO <coelho@cri.ensmp.fr>
Cc: Guillaume Lelarge <guillaume@lelarge.info>
Cc: mail@bwe.im, Oleksandr Shulgin <oleksandr.shulgin@zalando.de>
Cc: PostgreSQL Bugs List <pgsql-bugs@postgresql.org>
Subject: Re: BUG #12379: pgbench should hint to pgbench -i
Date: Sat, 18 Jul 2015 12:32:31 -0400
Message-ID: <11036.1437237151@sss.pgh.pa.us> (raw)
In-Reply-To: <55AA7BC9.6090307@dalibo.com>
References: <20141231105955.8014.38426@wrigleys.postgresql.org>
	<alpine.DEB.2.10.1503080851220.4406@sto>
	<alpine.DEB.2.10.1504260845160.6827@sto>
	<87oales6zm.fsf@ashulgin01.corp.ad.zalando.net>
	<alpine.DEB.2.10.1505221131480.30229@sto>
	<55984046.60901@dalibo.com>
	<CAECtzeWOm0JmJpDwM=woq8mfqfjPHOxLvSAaPrs=qOHvbWzxkw@mail.gmail.com>
	<559908D4.7020901@dalibo.com>
	<alpine.DEB.2.10.1507051821230.27775@sto>
	<23314.1436142811@sss.pgh.pa.us>
	<alpine.DEB.2.10.1507060709030.7427@sto>
	<55AA32E0.7070006@dalibo.com>
	<alpine.DEB.2.10.1507181347020.6263@sto>
	<55AA7BC9.6090307@dalibo.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Julien Rouhaud <julien.rouhaud@dalibo.com> 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



view thread (23+ messages)  latest in thread

Message-ID: <11036.1437237151@sss.pgh.pa.us>
Permalink:  ../11036.1437237151@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/11036.1437237151@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, julien.rouhaud@dalibo.com, coelho@cri.ensmp.fr, guillaume@lelarge.info, oleksandr.shulgin@zalando.de
  Subject: Re: BUG #12379: pgbench should hint to pgbench -i
  In-Reply-To: <11036.1437237151@sss.pgh.pa.us>
  References: <20141231105955.8014.38426@wrigleys.postgresql.org> <alpine.DEB.2.10.1503080851220.4406@sto> <alpine.DEB.2.10.1504260845160.6827@sto> <87oales6zm.fsf@ashulgin01.corp.ad.zalando.net> <alpine.DEB.2.10.1505221131480.30229@sto> <55984046.60901@dalibo.com> <CAECtzeWOm0JmJpDwM=woq8mfqfjPHOxLvSAaPrs=qOHvbWzxkw@mail.gmail.com> <559908D4.7020901@dalibo.com> <alpine.DEB.2.10.1507051821230.27775@sto> <23314.1436142811@sss.pgh.pa.us> <alpine.DEB.2.10.1507060709030.7427@sto> <55AA32E0.7070006@dalibo.com> <alpine.DEB.2.10.1507181347020.6263@sto> <55AA7BC9.6090307@dalibo.com> <11036.1437237151@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox