Re: [HACKERS] ECPG, two varchars with same name on same line

2010-03-09 Thread Michael Meskes
On Fri, May 01, 2009 at 03:49:47PM +0300, Heikki Linnakangas wrote:
> ECPG constructs internal struct names for VARCHAR fields using the
> field name and line number it's defined on. In a contrived example,
> though, that's not unique. Consider the following example:
> ...

This should now be fixed.

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
ICQ 179140304, AIM/Yahoo/Skype michaelmeskes, Jabber mes...@jabber.org
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] ECPG, two varchars with same name on same line

2010-02-27 Thread Michael Meskes
On Fri, Feb 26, 2010 at 10:23:19PM -0500, Bruce Momjian wrote:
> Was this fixed?

No, need to get along to fixing it.

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
ICQ 179140304, AIM/Yahoo/Skype michaelmeskes, Jabber mes...@jabber.org
VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] ECPG, two varchars with same name on same line

2010-02-26 Thread Bruce Momjian
Michael Meskes wrote:
> On Fri, May 01, 2009 at 03:49:47PM +0300, Heikki Linnakangas wrote:
> > ECPG constructs internal struct names for VARCHAR fields using the field  
> > name and line number it's defined on. In a contrived example, though,  
> > that's not unique. Consider the following example:
> > ...
> > That hardly happens in practice, of course, but it's trivial to fix by  
> > just adding some more salt to the struct name, like a simple counter, so  
> > it seems we should.
> 
> In principle you're right. However, the change needs to be added in several
> places like the internal variable structure that keeps the lineno anyway but
> needs to add the counter too. BTW we can remove the lineno then I think.
> Anyway, given that we are close to a release and the bug apparently never got
> up in a real life usage for years I'd prefer to not change it now but wait
> until the release has been done.

Was this fixed?

-- 
  Bruce Momjian  http://momjian.us
  EnterpriseDB http://enterprisedb.com
  PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do
  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] ECPG, two varchars with same name on same line

2009-05-07 Thread Heikki Linnakangas

Michael Meskes wrote:

On Fri, May 01, 2009 at 03:49:47PM +0300, Heikki Linnakangas wrote:
ECPG constructs internal struct names for VARCHAR fields using the field  
name and line number it's defined on. In a contrived example, though,  
that's not unique. Consider the following example:

...
That hardly happens in practice, of course, but it's trivial to fix by  
just adding some more salt to the struct name, like a simple counter, so  
it seems we should.


In principle you're right. However, the change needs to be added in several
places like the internal variable structure that keeps the lineno anyway but
needs to add the counter too. BTW we can remove the lineno then I think.
Anyway, given that we are close to a release and the bug apparently never got
up in a real life usage for years I'd prefer to not change it now but wait
until the release has been done.


Yeah, if the fix isn't trivial, it's not worth it.

--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] ECPG, two varchars with same name on same line

2009-05-07 Thread Michael Meskes
On Fri, May 01, 2009 at 03:49:47PM +0300, Heikki Linnakangas wrote:
> ECPG constructs internal struct names for VARCHAR fields using the field  
> name and line number it's defined on. In a contrived example, though,  
> that's not unique. Consider the following example:
> ...
> That hardly happens in practice, of course, but it's trivial to fix by  
> just adding some more salt to the struct name, like a simple counter, so  
> it seems we should.

In principle you're right. However, the change needs to be added in several
places like the internal variable structure that keeps the lineno anyway but
needs to add the counter too. BTW we can remove the lineno then I think.
Anyway, given that we are close to a release and the bug apparently never got
up in a real life usage for years I'd prefer to not change it now but wait
until the release has been done.

Comments anyone?

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
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: mes...@jabber.org
Go VfL Borussia! Go SF 49ers! Use Debian GNU/Linux! Use PostgreSQL!

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] ECPG, two varchars with same name on same line

2009-05-01 Thread Heikki Linnakangas
ECPG constructs internal struct names for VARCHAR fields using the field 
name and line number it's defined on. In a contrived example, though, 
that's not unique. Consider the following example:


...
EXEC SQL BEGIN DECLARE SECTION;
struct teststruct1 {
VARCHAR a[20];
VARCHAR b[20];
};
struct teststruct2 {
VARCHAR a[20];
VARCHAR b[20];
};

EXEC SQL END DECLARE SECTION;
...

This works, but if you remove all the newlines, it fails:
varcharstructs2.pgc:8: error: redefinition of ‘struct varchar_a_8’
varcharstructs2.pgc:8: error: redefinition of ‘struct varchar_b_8’

Attached is a full test case.

That hardly happens in practice, of course, but it's trivial to fix by 
just adding some more salt to the struct name, like a simple counter, so 
it seems we should.


--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com
#include 
#include 
#include 

EXEC SQL INCLUDE ../regression;

EXEC SQL BEGIN DECLARE SECTION;
struct teststruct1 {
VARCHAR a[20];
VARCHAR b[20];
};
struct teststruct2 {
VARCHAR a[20];
VARCHAR b[20];
};

EXEC SQL END DECLARE SECTION;

int main(int argc, char* argv[]) {
EXEC SQL BEGIN DECLARE SECTION; 
struct teststruct1 ts1;
struct teststruct2 ts2;

EXEC SQL END DECLARE SECTION;

  ECPGdebug(1, stderr);
  EXEC SQL CONNECT TO REGRESSDB1;

  EXEC SQL SELECT 'foo', 'bar' into :ts1;
  EXEC SQL SELECT 'foz', 'baz' into :ts2;

  printf("test\na b\n%s %s\n%s %s\n", ts1.a.arr, ts1.b.arr, ts2.a.arr, 
ts2.b.arr);

  EXEC SQL DISCONNECT ALL;

  return 0;
}

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers