Re: [BUG] Storage declaration in ECPG

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: a(dot)sokolov(at)arenadata(dot)io
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [BUG] Storage declaration in ECPG
Date: 2022-09-05 08:12:10
Message-ID: 20220905.171210.1866682352957653815.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Sun, 04 Sep 2022 13:49:53 +0300, Andrey Sokolov <a(dot)sokolov(at)arenadata(dot)io> wrote in
> Hi,
>
> The ECPG preprocessor converts the code
> "static VARCHAR str1[10], str2[20], str3[30];"
> into
> "static struct varchar_1 { int len; char arr[ 10 ]; } str1 ;
> struct varchar_2 { int len; char arr[ 20 ]; } str2 ;
> struct varchar_3 { int len; char arr[ 30 ]; } str3 ;".
> Storage declaration applies only to the first structure.

Good catch!

> The patch in the attachment fixes the bug. Storage declaration will be
> repeated before each structure.
> The patch is on github too:
> https://github.com/andr-sokolov/postgresql/commit/c8f8fc7a211938569e7d46c91a428d8cb25b6f9c

And the code looks good to me.

About the test, don't we need the test for non-varchar/bytea static
variables like "static int inta, intb, intc;"?

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2022-09-05 08:24:25 Re: Fix typo function circle_same (src/backend/utils/adt/geo_ops.c)
Previous Message Richard Guo 2022-09-05 07:22:36 Re: [POC] Allow flattening of subquery with a link to upper query