RE: BUG #15080: ecpg on windows doesn't define HAVE_LONG_LONG_INT

From: Huong Dangminh <huo-dangminh(at)ys(dot)jp(dot)nec(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jonathan Allen <jallen(at)americansavingslife(dot)com>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>, Akio Iwaasa <aki-iwaasa(at)vt(dot)jp(dot)nec(dot)com>
Subject: RE: BUG #15080: ecpg on windows doesn't define HAVE_LONG_LONG_INT
Date: 2018-05-17 11:35:00
Message-ID: 75DB81BEEA95B445AE6D576A0A5C9E936A76DA29@BPXM05GP.gisp.nec.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
> Sent: Friday, May 11, 2018 12:36 PM
> To: Jonathan Allen <jallen(at)americansavingslife(dot)com>
> Cc: Michael Meskes <meskes(at)postgresql(dot)org>; Andrew Gierth
> <andrew(at)tao11(dot)riddles(dot)org(dot)uk>; pgsql-bugs(at)lists(dot)postgresql(dot)org
> Subject: Re: BUG #15080: ecpg on windows doesn't define HAVE_LONG_LONG_INT
>
> Jonathan Allen <jallen(at)americansavingslife(dot)com> writes:
> > I saw the release of v10.4 today and was very excited to try using the
> official version of ecpg, but unfortunately I'm getting the same
> "unsupported type "long long" on line x" error. SQL State: YE000, SQL Code:
> -200.
> > ...did this fix not make it into the May release?
>
> Well, we committed *something* about that:
>
> https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=fda
> 3e65786763bd43abc576a23035a4cd24ed138
>
> Does that not match the fix you were using?

I confirmed that the above commit fix the case of not define HAVE_LONG_LONG_INT.

But We found another case that causes "unsupported type "long long"" error in
Windows environment.
In our case, We got the same error "unsupported type ...", because of the flag
HAVE_STRTOLL and HAVE_STRTOULL are not defined (*1).

I created a patch which defines the above two flags in Visual Studio 2013 or greater.
# The two functions strtoll and strtoull are support from Visual Studio 2013
Please confirm the attached.

(*1)
In our case, we got the error because the below code was ignored.

src/interfaces/ecpg/ecpglib/data.c
--------------
...
#ifdef HAVE_LONG_LONG_INT
#ifdef HAVE_STRTOLL
case ECPGt_long_long:
*((long long int *) (var + offset * act_tuple)) = strtoll(pval, &scan_length, 10);
if (garbage_left(isarray, &scan_length, compat))
{
ecpg_raise(lineno, ECPG_INT_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
return (false);
}
pval = scan_length;

break;
#endif /* HAVE_STRTOLL */
#ifdef HAVE_STRTOULL
case ECPGt_unsigned_long_long:
*((unsigned long long int *) (var + offset * act_tuple)) = strtoull(pval, &scan_length, 10);
if (garbage_left(isarray, &scan_length, compat))
{
ecpg_raise(lineno, ECPG_UINT_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval);
return (false);
}
pval = scan_length;

break;
#endif /* HAVE_STRTOULL */
#endif /* HAVE_LONG_LONG_INT */
...
--------------

Thanks and best regards,
---
Dang Minh Huong
NEC Solution Innovators, Ltd.
http://www.nec-solutioninnovators.co.jp/en/

Attachment Content-Type Size
ecpg_with_bigint.patch application/octet-stream 676 bytes

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2018-05-17 12:25:54 Re: BUG #15198: nextval() accepts tables/indexes when adding a default to a column
Previous Message Kyotaro HORIGUCHI 2018-05-17 08:00:21 Re: pg_ctl -D PGDATA stop -m fast gets the following message 57P03 FATAL: the database system is shutting down