Re: ECPG support for struct in INTO list - Mailing list pgsql-hackers

From Boszormenyi Zoltan
Subject Re: ECPG support for struct in INTO list
Date
Msg-id 4A795679.1020008@cybertec.at
Whole thread Raw
In response to Re: ECPG support for struct in INTO list  (Michael Meskes <meskes@postgresql.org>)
Responses Re: ECPG support for struct in INTO list  (Michael Meskes <meskes@postgresql.org>)
List pgsql-hackers
Michael Meskes írta:
> On Wed, Aug 05, 2009 at 11:08:26AM +0200, Boszormenyi Zoltan wrote:
>   
>> I have looked at it. The code seems to be invalid.
>>     
>
> Yes, it is, I was too lazy to make it valid. If you just allocate the memory
> for the variable in get_var() it becomes valid.
>   

With allocated memory, yes, the code would be valid.

This means that what I did in my first patch for this
problem in "add_struct_to_head()" (unrolling members
of the struct) has to be done in adjust_informix(),
turning it into a recursive function.
I think this would be a good solution. What do you think?

>   
>> I tried to compile your code (with my previous "fix"
>> in place, so at least :myvar is processed and C code is output):
>>     
>
> Yes, but incorrect one.
>
>   
>> Some systems (stack-protector extensions to GCC, etc)
>> make the code segfault immediately as soon as the first
>> FETCH statement tries to touch the lost memory area.
>> Just because ECPG does some tricks with ECPG_informix_set_var()
>> and ECPG_informix_get_var() converting variable reference
>> to runtime pointer values, the code wouldn't get magically valid.
>>     
>
> Again, this doesn't matter in this case as we try to get the preprocessor to
> work with a test case as small as possible.
>
>   
>> I did and I don't understand. I think it's just a bug
>> in ESQL/C to accept such constructs.
>>     
>
> I do not like this "feature" either, but it's there and therefore should work
> in our compatibility mode. And it does with non-struct variables. Just look at
> test/compat_informix/test_informix.pgc for a real and working example.
>
> Michael
>   

-- 
Bible has answers for everything. Proof:
"But let your communication be, Yea, yea; Nay, nay: for whatsoever is more
than these cometh of evil." (Matthew 5:37) - basics of digital technology.
"May your kingdom come" - superficial description of plate tectonics

----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
http://www.postgresql.at/



pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: 8.4 win32 shared memory patch
Next
From: Zeugswetter Andreas OSB sIT
Date:
Subject: Re: the case for machine-readable error fields