dbTalk Databases Forums  

[BUGS] BUG #1962: ECPG and VARCHAR

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #1962: ECPG and VARCHAR in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Charles Wegrzyn
 
Posts: n/a

Default [BUGS] BUG #1962: ECPG and VARCHAR - 10-13-2005 , 09:34 AM







The following bug has been logged online:

Bug reference: 1962
Logged by: Charles Wegrzyn
Email address: lists (AT) garbagedump (DOT) com
PostgreSQL version: 8.0.4
Operating system: Linux : 2.6.13-r4
Description: ECPG and VARCHAR
Details:

I have code that under 8.0.3 works:

VARCHAR t[MAX_TENANT_SIZE+1];
VARCHAR o[MAX_OID_SIZE+1];

In 8.0.4 I found this throws an error during the ecpg step:

tenant.ec:375: ERROR: pointer to varchar are not implemented
tenant.ec:376: ERROR: pointer to varchar are not implemented

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Reply With Quote
  #2  
Old   
Michael Fuhr
 
Posts: n/a

Default Re: [BUGS] BUG #1962: ECPG and VARCHAR - 10-13-2005 , 10:55 AM






On Thu, Oct 13, 2005 at 02:24:27PM +0100, Charles Wegrzyn wrote:
Quote:
I have code that under 8.0.3 works:

VARCHAR t[MAX_TENANT_SIZE+1];
VARCHAR o[MAX_OID_SIZE+1];

In 8.0.4 I found this throws an error during the ecpg step:

tenant.ec:375: ERROR: pointer to varchar are not implemented
tenant.ec:376: ERROR: pointer to varchar are not implemented
ecpg in 8.0.4 seems not to like the macros. I get the same error,
but not if I do this:

VARCHAR t[256];
VARCHAR o[256];

ecpg in 8.1beta3 works either way.

--
Michael Fuhr

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


Reply With Quote
  #3  
Old   
Michael Fuhr
 
Posts: n/a

Default Re: [BUGS] BUG #1962: ECPG and VARCHAR - 10-13-2005 , 01:53 PM



On Thu, Oct 13, 2005 at 09:49:20AM -0600, Michael Fuhr wrote:
Quote:
ecpg in 8.0.4 seems not to like the macros. I get the same error,
but not if I do this:

VARCHAR t[256];
VARCHAR o[256];

ecpg in 8.1beta3 works either way.
This appears to be the guilty commit, which was made to 7.4, 8.0,
and HEAD (8.1):

http://archives.postgresql.org/pgsql...8/msg00266.php

It was recently fixed in HEAD only:

http://archives.postgresql.org/pgsql...0/msg00043.php

--
Michael Fuhr

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq


Reply With Quote
  #4  
Old   
Bruce Momjian
 
Posts: n/a

Default Re: [BUGS] BUG #1962: ECPG and VARCHAR - 10-13-2005 , 08:58 PM



--ELM1129254794-4259-0_
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII

Michael Fuhr wrote:
Quote:
On Thu, Oct 13, 2005 at 09:49:20AM -0600, Michael Fuhr wrote:
ecpg in 8.0.4 seems not to like the macros. I get the same error,
but not if I do this:

VARCHAR t[256];
VARCHAR o[256];

ecpg in 8.1beta3 works either way.

This appears to be the guilty commit, which was made to 7.4, 8.0,
and HEAD (8.1):

http://archives.postgresql.org/pgsql...8/msg00266.php

It was recently fixed in HEAD only:

http://archives.postgresql.org/pgsql...0/msg00043.php
Good catch! I have backpatched these fixes to the 8.0 and 7.4 branches
as you suggested, (identical) patches attached.

The big problem is that we might not make releases on these branches for
months, so anyone needing the fix should download CVS for those
branches.

--
Bruce Momjian | http://candle.pha.pa.us
pgman (AT) candle (DOT) pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

--ELM1129254794-4259-0_
Content-Transfer-Encoding: 7bit
Content-Type: text/plain
Content-Disposition: inline; filename="/rtmp/diff"

Index: src/interfaces/ecpg/preproc/preproc.y
================================================== =================
RCS file: /cvsroot/pgsql/src/interfaces/ecpg/preproc/preproc.y,v
retrieving revision 1.303.4.4
diff -c -c -r1.303.4.4 preproc.y
*** src/interfaces/ecpg/preproc/preproc.y 24 Aug 2005 10:35:12 -0000 1.303.4.4
--- src/interfaces/ecpg/preproc/preproc.y 14 Oct 2005 01:47:05 -0000
***************
*** 5142,5149 ****
*dim = '\0';
else
sprintf(dim, "[%s]", dimension);
! /* if (strcmp(length, "0") == 0)*/
! if (atoi(length) <= 0)
mmerror(PARSE_ERROR, ET_ERROR, "pointer to varchar are not implemented");

if (strcmp(dimension, "0") == 0)
--- 5142,5149 ----
*dim = '\0';
else
sprintf(dim, "[%s]", dimension);
! /* cannot check for atoi <= 0 because a defined constant will yield 0 here as well */
! if (atoi(length) < 0 || strcmp(length, "0") == 0)
mmerror(PARSE_ERROR, ET_ERROR, "pointer to varchar are not implemented");

if (strcmp(dimension, "0") == 0)

--ELM1129254794-4259-0_
Content-Transfer-Encoding: 7bit
Content-Type: text/plain
Content-Disposition: inline; filename="/rtmp/diff2"

Index: src/interfaces/ecpg/preproc/preproc.y
================================================== =================
RCS file: /cvsroot/pgsql/src/interfaces/ecpg/preproc/preproc.y,v
retrieving revision 1.263.2.20
diff -c -c -r1.263.2.20 preproc.y
*** src/interfaces/ecpg/preproc/preproc.y 24 Aug 2005 10:35:54 -0000 1.263.2.20
--- src/interfaces/ecpg/preproc/preproc.y 14 Oct 2005 01:47:43 -0000
***************
*** 5121,5128 ****
*dim = '\0';
else
sprintf(dim, "[%s]", dimension);
! /* if (strcmp(length, "0") == 0)*/
! if (atoi(length) <= 0)
mmerror(PARSE_ERROR, ET_ERROR, "pointer to varchar are not implemented");

if (strcmp(dimension, "0") == 0)
--- 5121,5128 ----
*dim = '\0';
else
sprintf(dim, "[%s]", dimension);
! /* cannot check for atoi <= 0 because a defined constant will yield 0 here as well */
! if (atoi(length) < 0 || strcmp(length, "0") == 0)
mmerror(PARSE_ERROR, ET_ERROR, "pointer to varchar are not implemented");

if (strcmp(dimension, "0") == 0)

--ELM1129254794-4259-0_
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

--ELM1129254794-4259-0_--


Reply With Quote
  #5  
Old   
C Wegrzyn
 
Posts: n/a

Default Re: [BUGS] BUG #1962: ECPG and VARCHAR - 10-14-2005 , 07:43 AM



Michael Fuhr wrote:

Quote:
On Thu, Oct 13, 2005 at 02:24:27PM +0100, Charles Wegrzyn wrote:


I have code that under 8.0.3 works:

VARCHAR t[MAX_TENANT_SIZE+1];
VARCHAR o[MAX_OID_SIZE+1];

In 8.0.4 I found this throws an error during the ecpg step:

tenant.ec:375: ERROR: pointer to varchar are not implemented
tenant.ec:376: ERROR: pointer to varchar are not implemented



ecpg in 8.0.4 seems not to like the macros. I get the same error,
but not if I do this:

VARCHAR t[256];
VARCHAR o[256];

ecpg in 8.1beta3 works either way.



Michael,

Yes I found out the same thing. Unfortunately it isn't quite that
simple for me. It isn't a very good idea to hard-code fixed sizes in
executables. I have a file with all sorts of #defines in it. If the bug
doesn't get fixed it means that I will need to run CPP over the code
before I run ecpg, which is just ugly.

Chuck Wegrzyn


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster


Reply With Quote
  #6  
Old   
Michael Meskes
 
Posts: n/a

Default Re: [BUGS] BUG #1962: ECPG and VARCHAR - 10-14-2005 , 08:48 AM



On Thu, Oct 13, 2005 at 09:53:14PM -0400, Bruce Momjian wrote:
Quote:
Good catch! I have backpatched these fixes to the 8.0 and 7.4 branches
as you suggested, (identical) patches attached.
Thanks Bruce. This was an oversight on my part. I should have committed
to 8.0 branch too. I'm sorry about that.

On the other hand I agree with Tom. Fortunately it's not a data corruption problem.
:-)

Michael

--
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes (AT) jabber (DOT) org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings


Reply With Quote
  #7  
Old   
Michael Meskes
 
Posts: n/a

Default Re: [BUGS] BUG #1962: ECPG and VARCHAR - 10-14-2005 , 08:48 AM



On Thu, Oct 13, 2005 at 11:18:13AM -0500, C Wegrzyn wrote:
Quote:
Yes I found out the same thing. Unfortunately it isn't quite that
simple for me. It isn't a very good idea to hard-code fixed sizes in
executables. I have a file with all sorts of #defines in it. If the bug
doesn't get fixed it means that I will need to run CPP over the code
before I run ecpg, which is just ugly.
Can't you just compile a new version of ecpg with the patch Bruce
committed? Depending on the system you're using I could even send you a
binary.

Michael
--
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes (AT) jabber (DOT) org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster


Reply With Quote
  #8  
Old   
C Wegrzyn
 
Posts: n/a

Default Re: [BUGS] BUG #1962: ECPG and VARCHAR - 10-15-2005 , 07:20 PM



The customer I am writing this for will only accept it based on released
code. That means I run either 8.0.3 or 8.0.4.

Chuck

Michael Meskes wrote:

Quote:
On Thu, Oct 13, 2005 at 11:18:13AM -0500, C Wegrzyn wrote:


Yes I found out the same thing. Unfortunately it isn't quite that
simple for me. It isn't a very good idea to hard-code fixed sizes in
executables. I have a file with all sorts of #defines in it. If the bug
doesn't get fixed it means that I will need to run CPP over the code
before I run ecpg, which is just ugly.



Can't you just compile a new version of ecpg with the patch Bruce
committed? Depending on the system you're using I could even send you a
binary.

Michael



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


Reply With Quote
  #9  
Old   
Michael Meskes
 
Posts: n/a

Default Re: [BUGS] BUG #1962: ECPG and VARCHAR - 10-20-2005 , 09:14 AM



Am Freitag, 14. Oktober 2005 21:15 schrieb C Wegrzyn:
Quote:
The customer I am writing this for will only accept it based on released
code. That means I run either 8.0.3 or 8.0.4.
Would it help you if I do a special ecpg release just for you? Or does it have
to be part of the postgres release?

Michael
--
Michael Meskes
Email: Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes (AT) jabber (DOT) org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!

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


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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.