[BUG] Storage declaration in ECPG
Andrey Sokolov <a.sokolov@arenadata.io>
From: Andrey Sokolov <a.sokolov@arenadata.io>
To: "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2022-09-04T10:49:53Z
Lists: pgsql-hackers
Attachments
- (unnamed) (text/html)
- 0001-Fix-storage-declaration-in-ECPG.patch (text/x-diff) patch 0001
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.
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
--
Andrey Sokolov
Arenadata https://arenadata.tech/
Commits
-
Fix possible omission of variable storage markers in ECPG.
- fe4e151d4a7c 11.18 landed
- fbb54d742ac8 15.0 landed
- be0b0528cb64 14.6 landed
- b7050e258480 16.0 landed
- a6618842fac3 13.9 landed
- 9fbc6d5483b0 12.13 landed
- 8fe26bca1c97 10.23 landed