Re: Compiling CVS HEAD with clang under OSX

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Neil Conway <neil(dot)conway(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Compiling CVS HEAD with clang under OSX
Date: 2010-08-02 00:56:50
Message-ID: 3816.1280710610@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Neil Conway <neil(dot)conway(at)gmail(dot)com> writes:
> *** src/backend/utils/adt/datetime.c 9 May 2010 02:15:59 -0000 1.212
> --- src/backend/utils/adt/datetime.c 1 Aug 2010 23:09:30 -0000
> ***************
> *** 3098,3104 ****
> break;

> case RESERV:
> ! tmask = (DTK_DATE_M || DTK_TIME_M);
> *dtype = val;
> break;

> --- 3098,3104 ----
> break;

> case RESERV:
> ! tmask = (DTK_DATE_M | DTK_TIME_M);
> *dtype = val;
> break;

BTW, some digging in the code shows that this line is reached only for
interval input "invalid", which hasn't been accepted for a long time
anyhow:

regression=# select 'invalid'::interval;
ERROR: date/time value "invalid" is no longer supported

However, the mistaken value given to tmask interferes with detecting
other errors, in particular the DTERR_BAD_FORMAT that you ought to get
for specifying conflicting fields. The DTK_DATE_M | DTK_TIME_M value
is intended to say that "invalid" conflicts with any date or time field.
But since the wrong value is assigned, you can do this:

regression=# select '3 day invalid'::interval;
ERROR: date/time value "3 day invalid" is no longer supported

and the syntax error fails to trigger, so that control gets as far as
complaining about the DTK_INVALID type instead. With the fix, you
get the intended behavior:

regression=# select '3 day invalid'::interval;
ERROR: invalid input syntax for type interval: "3 day invalid"

So this is a real bug, though surely one that's awfully far down the
severity scale, to the point that the compiler warning might be judged
more annoying than the actual bug. I'm inclined to fix it in HEAD and
9.0, which are the only branches that anyone's likely to be excited
about building with clang.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2010-08-02 01:20:34 Re: multibyte charater set in levenshtein function
Previous Message Tom Lane 2010-08-02 00:25:41 Re: Compiling CVS HEAD with clang under OSX