pgsql: Fix possible omission of variable storage markers in ECPG.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix possible omission of variable storage markers in ECPG.
Date: 2022-09-09 19:34:21
Message-ID: E1oWjld-002Bph-0M@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix possible omission of variable storage markers in ECPG.

The ECPG preprocessor converted code such as

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 ;

thus losing the storage attribute for the later variables.
Repeat the declaration for each such variable.

(Note that this occurred only for variables declared "varchar"
or "bytea", which may help explain how it escaped detection
for so long.)

Andrey Sokolov

Discussion: https://postgr.es/m/942241662288242@mail.yandex.ru

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/fe4e151d4a7c4da728a71167148afdb4bcb4d4dd

Modified Files
--------------
src/interfaces/ecpg/preproc/ecpg.trailer | 8 +-
src/interfaces/ecpg/preproc/type.h | 1 +
.../ecpg/test/expected/preproc-variable.c | 93 +++++++-----
.../ecpg/test/expected/preproc-variable.stderr | 162 ++++++++++-----------
.../ecpg/test/expected/preproc-variable.stdout | 1 +
src/interfaces/ecpg/test/preproc/variable.pgc | 9 ++
6 files changed, 151 insertions(+), 123 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2022-09-10 02:12:49 pgsql: aix: No need to use mkldexport when we want to export all symbol
Previous Message Tom Lane 2022-09-09 17:50:52 pgsql: Doc: improve documentation about where the psqlrc files are.