RE: ECPG: inconsistent behavior with the document in “GET/SET DESCRIPTOR.”
Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>
From: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
To: "Masashi Kamura (Fujitsu)" <kamura.masashi@fujitsu.com>
Cc: "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2026-04-16T05:48:15Z
Lists: pgsql-hackers
Dear Kamura-san,
> Embedded SQL:
> ```
> EXEC SQL GET DESCRIPTOR d :desc_count1 = count, :desc_count2 = count;
> ```
>
> Precompiled result:
> ```
> { ECPGget_desc_header(__LINE__, "d", &(desc_count2desc_count1));
> ```
>
> Reported error by the compiler:
> ```
> bytea.pgc: In function 'main':
>
> bytea.pgc:123:48: error: 'desc_count2desc_count1' undeclared (first use in this
> function)
Good catch, agreed that current result should be fixed.
> According to my analysis, the parser can accept multiple headers,
> but the output function cannot.
> See ECPGGetDescHeaderItems and output_get_descr_header().
> Therefore, it is thought that the variables were incorrectly concatenated,
> resulting in an error.
>
> I feel even if multiple header items cannot be specified,
> invalid syntax should be detected by the precompiler, not the compiler.
> Attached patch fixes both parser and the documentation.
> After applying the patch, the above example can detect the invalid syntax
> by the precompiler anymore.
IIUC, there is another approach, allowing to specify multiple COUNT clause
in the SET/GET DESCRIPTOR. E.g.,
```
EXEC SQL GET DESCRIPTOR d :desc_count1 = count, :desc_count2 = count;
-> set COUNT value to desc_count1 and desc_count2.
```
Do you have theory which one is better?
Best regards,
Hayato Kuroda
FUJITSU LIMITED
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
ecpg: Reject multiple header items in GET/SET DESCRIPTOR
- 9e8fd9f7ab56 14 (unreleased) landed
- bfeddcf09b68 15 (unreleased) landed
- 4d4b73cfd27d 16 (unreleased) landed
- fe8c0a762b30 17 (unreleased) landed
- 081434b0f582 18 (unreleased) landed
- 4484165b0712 19 (unreleased) landed