Re: ECPG support for struct in INTO list

From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Hans-Juergen Schoenig <hs(at)cybertec(dot)at>
Subject: Re: ECPG support for struct in INTO list
Date: 2009-08-05 09:52:57
Message-ID: 4A795679.1020008@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Petr Jelinek 2009-08-05 10:31:52 Re: [PATCH] DefaultACLs
Previous Message Zeugswetter Andreas OSB sIT 2009-08-05 09:40:47 Re: the case for machine-readable error fields