Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YnZAj-00066H-0v for pgsql-committers@arkaria.postgresql.org; Wed, 29 Apr 2015 21:05:33 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YnZAi-0003Kb-Hj for pgsql-committers@arkaria.postgresql.org; Wed, 29 Apr 2015 21:05:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YnZAh-0003KU-Uv for pgsql-committers@postgresql.org; Wed, 29 Apr 2015 21:05:32 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1YnZAd-00036X-8k for pgsql-committers@postgresql.org; Wed, 29 Apr 2015 21:05:30 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1YnZAa-00018R-F9; Wed, 29 Apr 2015 17:05:24 -0400 Date: Wed, 29 Apr 2015 17:05:24 -0400 From: Bruce Momjian To: Stephen Frost Cc: Robert Haas , pgsql-committers Subject: Re: Re: pgsql: to_char(): have format 'OF' only show the leading negative sign Message-ID: <20150429210524.GP31727@momjian.us> References: <20150429141102.GX30322@tamriel.snowman.net> <20150429182222.GB30322@tamriel.snowman.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20150429182222.GB30322@tamriel.snowman.net> User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-committers Precedence: bulk Sender: pgsql-committers-owner@postgresql.org On Wed, Apr 29, 2015 at 02:22:22PM -0400, Stephen Frost wrote: > * Robert Haas (robertmhaas@gmail.com) wrote: > > On Wed, Apr 29, 2015 at 10:11 AM, Stephen Frost wrote: > > > * Bruce Momjian (bruce@momjian.us) wrote: > > >> to_char(): have format 'OF' only show the leading negative sign > > >> > > >> Previously both hours and minutes displayed as negative. > > >> > > >> Report by David Pozsar > > > > > > This is causing the following error for me: > > > > > > /home/sfrost/git/pg/dev/postgresql/src/backend/utils/adt/formatting.c: In function ‘DCH_to_char’: > > > /home/sfrost/git/pg/dev/postgresql/src/backend/utils/adt/formatting.c:2510:6: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘int’ [-Wformat=] > > > sprintf(s, ":%02ld", abs(tm->tm_gmtoff % SECS_PER_HOUR) / SECS_PER_MINUTE); > > > ^ > > > > > > Since abs() is declared to return just an int. I don't see it anywhere > > > in our tree and I'm not sure how portable it actually is, but labs() is > > > supposedly in C89, so perhaps that should be used here instead? > > > > I just removed the "l" for now, since %02d is used to print the result > > of abs() elsewhere. If that isn't right, someone can re-fix my fix. > > Works for me. I'm no longer seeing the warning. Oh, I see now that my commit generated a conflict and didn't apply. Should we try labs() or just ignore it? -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers