Skip site navigation (1) Skip section navigation (2)

ECPG fails to handle hex constants

From: Thad Humphries <thad(at)mindwrap(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: ECPG fails to handle hex constants
Date: 2002-10-15 16:44:14
Message-ID: 1034700254.31092.24.camel@opus (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
I stumbled across this bug yesterday.  My compiler (gcc 2.95.3 on RedHat
6.2) was telling me 

	query.pgc:1383: character constant too long

so I compiled to query.c vs. query.o.  I found that

	if ( field->flags & 0x80000000 )
	if ( field->flags & '0x80000000' )

after passing thru ecpg, although it does not appear inside any EXEC SQL
clauses. (field->flags is an 's32' which is typedef'd from int.)

I worked around this problem by thus

/* Do this else ECPG makes 0x80000000 a char */
#define MASK_HI_BIT 0x80000000
	if ( field->flags & MASK_HI_BIT )

which leaves it all to the C preprocessor.  But why should I have to? 
Is this really a bug in ecpg?
Thad Humphries              " religious test shall ever be required
Web Development Manager      as a qualification to any office or public
Phone: 540/675-3015, x225    trust under the United States." -Article VI

pgsql-novice by date

Next:From: Frank BaxDate: 2002-10-15 19:28:39
Subject: help deleting obsolete records
Previous:From: Josh BerkusDate: 2002-10-15 16:38:47
Subject: Re: db design question

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group