RE: BUG #15080: ecpg on windows doesn't define HAVE_LONG_LONG_INT - Mailing list pgsql-bugs

From Huong Dangminh
Subject RE: BUG #15080: ecpg on windows doesn't define HAVE_LONG_LONG_INT
Date
Msg-id 75DB81BEEA95B445AE6D576A0A5C9E936A76DA29@BPXM05GP.gisp.nec.co.jp
Whole thread Raw
In response to Re: BUG #15080: ecpg on windows doesn't define HAVE_LONG_LONG_INT  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #15080: ecpg on windows doesn't define HAVE_LONG_LONG_INT  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Sent: Friday, May 11, 2018 12:36 PM
> To: Jonathan Allen <jallen@americansavingslife.com>
> Cc: Michael Meskes <meskes@postgresql.org>; Andrew Gierth
> <andrew@tao11.riddles.org.uk>; pgsql-bugs@lists.postgresql.org
> Subject: Re: BUG #15080: ecpg on windows doesn't define HAVE_LONG_LONG_INT
>
> Jonathan Allen <jallen@americansavingslife.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

pgsql-bugs by date:

Previous
From: Kyotaro HORIGUCHI
Date:
Subject: Re: pg_ctl -D PGDATA stop -m fast gets the following message 57P03FATAL: the database system is shutting down
Next
From: "David G. Johnston"
Date:
Subject: Re: BUG #15198: nextval() accepts tables/indexes when adding adefault to a column