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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Huong Dangminh <huo-dangminh(at)ys(dot)jp(dot)nec(dot)com>
Cc: Jonathan Allen <jallen(at)americansavingslife(dot)com>, 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 15:43:39
Message-ID: 26460.1526571819@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Huong Dangminh <huo-dangminh(at)ys(dot)jp(dot)nec(dot)com> writes:
> From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
>> Well, we committed *something* about that:
>> https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=fda3e65786763bd43abc576a23035a4cd24ed138
>> 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).

Ah! I looked through the uses of ECPG_UNSUPPORTED, and that seems to be
the only other thing that needs to be covered.

> 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.

It seems fairly unfortunate that this patch does not fix the problem
for as far back as MSVC has "long long" support. From what I can tell,
we could use _strtoi64 and _strtoui64 on older Windows versions. So
I'm imagining something like

#if (_MSC_VER > 1200)
#define HAVE_LONG_LONG_INT_64 1
#endif

...

#ifdef HAVE_LONG_LONG_INT_64
#define HAVE_STRTOLL 1
/* Before VS2013, use Microsoft's nonstandard equivalent function */
#if (_MSC_VER < 1800)
#define strtoll _strtoi64
#endif
#endif

and similarly for strtoull.

Please check that and see if it works.

BTW, is it possible to set up an ecpg test case to verify that this
stuff works? It'd have to handle platforms without long long though,
so I'm not sure how to deal with that.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message reader 1001 2018-05-17 16:17:59 Re: Abnormal JSON query performance
Previous Message David G. Johnston 2018-05-17 13:56:29 Re: BUG #15204: Export to CSV doesn't work in Query tools