Unix Technical Forum

BUG #3181: ecpg generating wrong code

This is a discussion on BUG #3181: ecpg generating wrong code within the pgsql Bugs forums, part of the PostgreSQL category; --> The following bug has been logged online: Bug reference: 3181 Logged by: Steve Gieseking Email address: steve.gieseking@camotion.com PostgreSQL version: ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Bugs

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 10:41 AM
Steve Gieseking
 
Posts: n/a
Default BUG #3181: ecpg generating wrong code


The following bug has been logged online:

Bug reference: 3181
Logged by: Steve Gieseking
Email address: steve.gieseking@camotion.com
PostgreSQL version: 8.2.3
Operating system: Linux Fedora Core 6
Description: ecpg generating wrong code
Details:

I am maintaining code that uses ecpg. The following query was working with
the previous version of ecpg:

exec sql SELECT count(PortNum) INTO :cnt FROM Serial
WHERE ProjectId = rjId and Enable = true;

After upgrading, the code is produced incorrectly. It now generates code as
follows:

{ ECPGdo(__LINE__, 0, 1, NULL, "select count ( PortNum ) from Serial
where ProjectId = ? and ensable = true ",
ECPGt_int,&(prjId),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT,
ECPGt_int,&(cnt),(long)1,(long)1,sizeof(int),
ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT);

The problem is the translation to ensable. This appears to be caused by the
file 'preproc.y' at the line:

| ENABLE_P { $$ = make_str("ensable"); }

Changing this to 'enable', fixes the problem.

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 10:41 AM
Tom Lane
 
Posts: n/a
Default Re: BUG #3181: ecpg generating wrong code

"Steve Gieseking" <steve.gieseking@camotion.com> writes:
> I am maintaining code that uses ecpg. The following query was working with
> the previous version of ecpg:
> ...
> The problem is the translation to ensable. This appears to be caused by the
> file 'preproc.y' at the line:
> | ENABLE_P { $$ = make_str("ensable"); }


Good catch, but AFAICS this was broken in 8.1 as well. What "previous
version" are you comparing to?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:42 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com