BUG #6238: ECPG converts "long long" to long on Windows

Started by Jim Grayover 14 years ago9 messagesbugs
Jump to latest
#1Jim Gray
jim.gray@bull.com

The following bug has been logged online:

Bug reference: 6238
Logged by: Jim Gray
Email address: jim.gray@bull.com
PostgreSQL version: 9.1.1
Operating system: Windows XP
Description: ECPG converts "long long" to long on Windows
Details:

Postgres 9.1.1 installed on a Windows XP PC.
Running ECPG with "long long" data type specified in the SQL DECLARE SECTION
results in "long" being used instead. The same input file works OK on Linux
with Postgres 9.0.3 Manually changing the data type to "long long" in the
ECPG output file on Windows:
ECPGt_long_long,&(_cpp_i_pkd1),(long)1,(long)1,sizeof(long long) -- results
in run time error "unsupported data type". I am using MS Visual C++ Express
2010 on Windows, which accepts "long long" to mean the same thing as
__int64, but ECPG doesn't recognize the later.
May be related to BUG #5464: ecpg on 64bit system converts "long long" to
"long"
By the way, why is Postgres still using MSVS 2008 instead of the free MSVC
2010 Express for Windows builds?

#2Michael Meskes
meskes@postgresql.org
In reply to: Jim Gray (#1)
Re: BUG #6238: ECPG converts "long long" to long on Windows

Hi Jim,

Postgres 9.1.1 installed on a Windows XP PC.
Running ECPG with "long long" data type specified in the SQL DECLARE SECTION
results in "long" being used instead. The same input file works OK on Linux

This suggests that HAVE_LONG_LONG_INT was not defined during ecpg build. Or in
other words ecpg thinks long long is not supported.

with Postgres 9.0.3 Manually changing the data type to "long long" in the
ECPG output file on Windows:
ECPGt_long_long,&(_cpp_i_pkd1),(long)1,(long)1,sizeof(long long) -- results
in run time error "unsupported data type". I am using MS Visual C++ Express

Did you also change the variable definition to long long?

2010 on Windows, which accepts "long long" to mean the same thing as
__int64, but ECPG doesn't recognize the later.
May be related to BUG #5464: ecpg on 64bit system converts "long long" to
"long"

Well, this bug is (at least I don't know otherwise) fixed for more than a year.
Maybe the configure test doesn't work on Windows? I don't know.

Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
Jabber: michael.meskes at googlemail dot com
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL

#3Robert Haas
robertmhaas@gmail.com
In reply to: Michael Meskes (#2)
Re: BUG #6238: ECPG converts "long long" to long on Windows

On Tue, Oct 4, 2011 at 8:15 AM, Michael Meskes <meskes@postgresql.org> wrote:

Hi Jim,

Postgres 9.1.1 installed on a Windows XP PC.
Running ECPG with "long long" data type specified in the SQL DECLARE SECTION
results in "long" being used instead.  The same input file works OK on Linux

This suggests that HAVE_LONG_LONG_INT was not defined during ecpg build. Or in
other words ecpg thinks long long is not supported.

with Postgres 9.0.3   Manually changing the data type to "long long" in the
ECPG output file on Windows:
ECPGt_long_long,&(_cpp_i_pkd1),(long)1,(long)1,sizeof(long long) -- results
in run time error "unsupported data type".  I am using MS Visual C++ Express

Did you also change the variable definition to long long?

2010 on Windows, which accepts "long long" to mean the same thing as
__int64, but ECPG doesn't recognize the later.
May be related to BUG #5464: ecpg on 64bit system converts "long long" to
"long"

Well, this bug is (at least I don't know otherwise) fixed for more than a year.
Maybe the configure test doesn't work on Windows? I don't know.

On at least some Windows builds, configure isn't used at all... so
whatever values is being used would come from the MSVC build system.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

#4Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Robert Haas (#3)
Re: BUG #6238: ECPG converts "long long" to long on Windows

Excerpts from Robert Haas's message of mar oct 04 10:39:27 -0300 2011:

On Tue, Oct 4, 2011 at 8:15 AM, Michael Meskes <meskes@postgresql.org> wrote:

2010 on Windows, which accepts "long long" to mean the same thing as
__int64, but ECPG doesn't recognize the later.
May be related to BUG #5464: ecpg on 64bit system converts "long long" to
"long"

Well, this bug is (at least I don't know otherwise) fixed for more than a year.
Maybe the configure test doesn't work on Windows? I don't know.

On at least some Windows builds, configure isn't used at all... so
whatever values is being used would come from the MSVC build system.

In fact, pg_config.h.win32 does not have the HAVE_LONG_LONG_INT symbol
at all -- only HAVE_LONG_LONG_INT_64 is in there.

--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

#5Jim Gray
jim.gray@bull.com
In reply to: Michael Meskes (#2)
Re: BUG #6238: ECPG converts "long long" to long on Windows

Did you also change the variable definition to long long?

Yes

Michael Meskes <meskes@postgresql.org>
10/04/2011 05:15 AM

To
Jim Gray <jim.gray@bull.com>
cc
pgsql-bugs@postgresql.org
Subject
Re: [BUGS] BUG #6238: ECPG converts "long long" to long on Windows

Hi Jim,

Postgres 9.1.1 installed on a Windows XP PC.
Running ECPG with "long long" data type specified in the SQL DECLARE

SECTION

results in "long" being used instead. The same input file works OK on

Linux

This suggests that HAVE_LONG_LONG_INT was not defined during ecpg build.
Or in
other words ecpg thinks long long is not supported.

with Postgres 9.0.3 Manually changing the data type to "long long" in

the

ECPG output file on Windows:
ECPGt_long_long,&(_cpp_i_pkd1),(long)1,(long)1,sizeof(long long) --

results

in run time error "unsupported data type". I am using MS Visual C++

Express

Did you also change the variable definition to long long?

2010 on Windows, which accepts "long long" to mean the same thing as
__int64, but ECPG doesn't recognize the later.
May be related to BUG #5464: ecpg on 64bit system converts "long long"

to

"long"

Well, this bug is (at least I don't know otherwise) fixed for more than a
year.
Maybe the configure test doesn't work on Windows? I don't know.

Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
Jabber: michael.meskes at googlemail dot com
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL

#6Bruce Momjian
bruce@momjian.us
In reply to: Alvaro Herrera (#4)
Re: BUG #6238: ECPG converts "long long" to long on Windows

Alvaro Herrera wrote:

Excerpts from Robert Haas's message of mar oct 04 10:39:27 -0300 2011:

On Tue, Oct 4, 2011 at 8:15 AM, Michael Meskes <meskes@postgresql.org> wrote:

2010 on Windows, which accepts "long long" to mean the same thing as
__int64, but ECPG doesn't recognize the later.
May be related to BUG #5464: ecpg on 64bit system converts "long long" to
"long"

Well, this bug is (at least I don't know otherwise) fixed for more than a year.
Maybe the configure test doesn't work on Windows? I don't know.

On at least some Windows builds, configure isn't used at all... so
whatever values is being used would come from the MSVC build system.

In fact, pg_config.h.win32 does not have the HAVE_LONG_LONG_INT symbol
at all -- only HAVE_LONG_LONG_INT_64 is in there.

Is this wrong?

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

#7Magnus Hagander
magnus@hagander.net
In reply to: Bruce Momjian (#6)
Re: BUG #6238: ECPG converts "long long" to long on Windows

On Wednesday, October 5, 2011, Bruce Momjian wrote:

Alvaro Herrera wrote:

Excerpts from Robert Haas's message of mar oct 04 10:39:27 -0300 2011:

On Tue, Oct 4, 2011 at 8:15 AM, Michael Meskes <meskes@postgresql.org<javascript:;>>

wrote:

2010 on Windows, which accepts "long long" to mean the same thing as
__int64, but ECPG doesn't recognize the later.
May be related to BUG #5464: ecpg on 64bit system converts "long

long" to

"long"

Well, this bug is (at least I don't know otherwise) fixed for more

than a year.

Maybe the configure test doesn't work on Windows? I don't know.

On at least some Windows builds, configure isn't used at all... so
whatever values is being used would come from the MSVC build system.

In fact, pg_config.h.win32 does not have the HAVE_LONG_LONG_INT symbol
at all -- only HAVE_LONG_LONG_INT_64 is in there.

Is this wrong?

Not sure, but it seems ecpg is the only place in our entire source that

this is used - that's probably why it was missed.

Does ecpg have a different requirement from everything else, or are we just
doing it differently in different places for no special reason?

It was applied as commit 29259531, which apparently changed it from our own
implementation to the autoconf standard. And changed a whole bunch of places
from HAVE_LONG_LONG to HAVE_LONG_LONG_INT. Perhaps it just missed to update
the win32 file?

Just to be completely cetain, what behaviour is it we're looking for, that
is not the same as HAVE_LONG_LONG_INT_64?

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

#8Tom Lane
tgl@sss.pgh.pa.us
In reply to: Magnus Hagander (#7)
Re: BUG #6238: ECPG converts "long long" to long on Windows

Magnus Hagander <magnus@hagander.net> writes:

Does ecpg have a different requirement from everything else, or are we just
doing it differently in different places for no special reason?

I believe that in ecpg, the requirement is "support the data types
defined by the C compiler", that is we should support long long with
whatever width it actually has on the platform. Just about everyplace
else in PG, we want an integer of a known number of bits, and whether
that's long or long long is incidental. So it's not surprising to me
that this case got overlooked in the win64 patches.

regards, tom lane

#9Michael Meskes
meskes@postgresql.org
In reply to: Tom Lane (#8)
Re: BUG #6238: ECPG converts "long long" to long on Windows

On Sun, Oct 16, 2011 at 04:15:01PM -0400, Tom Lane wrote:

I believe that in ecpg, the requirement is "support the data types
defined by the C compiler", that is we should support long long with
whatever width it actually has on the platform. Just about everyplace

Right.

We added that to make sure we support the same embedded sql sourcecode on all systems no matter if they have long long or not.

Michael

--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
Jabber: michael.meskes at googlemail dot com
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL