$ cat test-filtered.sql | /usr/pgsql-9.6/bin/ecpg -o - -
/* Processed by ecpg (4.12.0) */
/* These include files are added by the preprocessor */
#include <ecpglib.h>
#include <ecpgerrno.h>
#include <sqlca.h>
/* End of automatic include section */

#line 1 "stdin"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into x ( y ) values ( '' )", ECPGt_EOIT, ECPGt_EORT);}
#line 1 "stdin"


{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop function if exists a ( ) cascade", ECPGt_EOIT, ECPGt_EORT);}
#line 3 "stdin"

{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create or replace function a ( ) returns uuid as $$\
DECLARE\
   b uuid;\
EXEC SQL BEGIN\
      WITH\
          a AS (SELECT uuid_generate_v1() AS id),\
      xxxxxxxx_xxxxxx_xxxxx_xxxxxxx AS \
      (\
         INSERT INTO xxxxxxxx_xxxxxx_xxxxx(\
                                           xxxxxx_xx, \
                                           xxxx_xxxxxxxxxxxxx_xx, \
                                           xxxxxx_xxxxxxxxxxx_xxx_xx,\
                                           xxxxxxxxxxx_xx, \
                                           xxxxxxxx_xxxxxxxx_xxxxxx_xxxxx_xx)\
             VALUES ( \
                      ( SELECT x_xx FROM xxxxxxx_xxxxxx LIMIT 1 ), \
                      ( SELECT xxxx_xxxxxxxxxxxxx_xx FROM xxxxxx LIMIT 1 ),\
                      ( SELECT xxxxxx_xxxxxxxxxxx_xxx_xx FROM xxxxxxx_xxxxxx_xxxxxxxxxxx LIMIT 1 ),\
                      ( SELECT id FROM xxxxxxx_xxxxxxxxxxx LIMIT 1 ),\
                      ( SELECT id FROM x )  )\
             RETURNING xxxxx_xxxx\
      )\
      SELECT id INTO b FROM a;\
\
EXEC SQL    RETURN b;\
EXEC SQL END;\
EXEC SQL $$ language plpgsql", ECPGt_EOIT, ECPGt_EORT);}
#line 31 "stdin"
;

*** Error in `/usr/pgsql-9.6/bin/ecpg': double free or corruption (fasttop): 0x0000000000a8b970 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x7c503)[0x7fca2c539503]
/usr/pgsql-9.6/bin/ecpg[0x401b84]
/usr/pgsql-9.6/bin/ecpg[0x401c16]
/usr/pgsql-9.6/bin/ecpg[0x4048ba]
/usr/pgsql-9.6/bin/ecpg[0x403112]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7fca2c4deb35]
/usr/pgsql-9.6/bin/ecpg[0x403885]
======= Memory map: ========
00400000-004d3000 r-xp 00000000 fd:00 73095339                           /usr/pgsql-9.6/bin/ecpg
006d2000-006d3000 r--p 000d2000 fd:00 73095339                           /usr/pgsql-9.6/bin/ecpg
006d3000-006d4000 rw-p 000d3000 fd:00 73095339                           /usr/pgsql-9.6/bin/ecpg
006d4000-006d6000 rw-p 00000000 00:00 0 
00a86000-00aa7000 rw-p 00000000 00:00 0                                  [heap]
7fca20000000-7fca20021000 rw-p 00000000 00:00 0 
7fca20021000-7fca24000000 ---p 00000000 00:00 0 
7fca25d7e000-7fca25d93000 r-xp 00000000 fd:00 101072955                  /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7fca25d93000-7fca25f92000 ---p 00015000 fd:00 101072955                  /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7fca25f92000-7fca25f93000 r--p 00014000 fd:00 101072955                  /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7fca25f93000-7fca25f94000 rw-p 00015000 fd:00 101072955                  /usr/lib64/libgcc_s-4.8.5-20150702.so.1
7fca25f94000-7fca2c4bd000 r--p 00000000 fd:00 100762636                  /usr/lib/locale/locale-archive
7fca2c4bd000-7fca2c673000 r-xp 00000000 fd:00 100711660                  /usr/lib64/libc-2.17.so
7fca2c673000-7fca2c873000 ---p 001b6000 fd:00 100711660                  /usr/lib64/libc-2.17.so
7fca2c873000-7fca2c877000 r--p 001b6000 fd:00 100711660                  /usr/lib64/libc-2.17.so
7fca2c877000-7fca2c879000 rw-p 001ba000 fd:00 100711660                  /usr/lib64/libc-2.17.so
7fca2c879000-7fca2c87e000 rw-p 00000000 00:00 0 
7fca2c87e000-7fca2c895000 r-xp 00000000 fd:00 101379652                  /usr/lib64/libpthread-2.17.so
7fca2c895000-7fca2ca94000 ---p 00017000 fd:00 101379652                  /usr/lib64/libpthread-2.17.so
7fca2ca94000-7fca2ca95000 r--p 00016000 fd:00 101379652                  /usr/lib64/libpthread-2.17.so
7fca2ca95000-7fca2ca96000 rw-p 00017000 fd:00 101379652                  /usr/lib64/libpthread-2.17.so
7fca2ca96000-7fca2ca9a000 rw-p 00000000 00:00 0 
7fca2ca9a000-7fca2caba000 r-xp 00000000 fd:00 100762635                  /usr/lib64/ld-2.17.so
7fca2cc9e000-7fca2cca1000 rw-p 00000000 00:00 0 
7fca2ccb5000-7fca2ccb9000 rw-p 00000000 00:00 0 
7fca2ccb9000-7fca2ccba000 r--p 0001f000 fd:00 100762635                  /usr/lib64/ld-2.17.so
7fca2ccba000-7fca2ccbb000 rw-p 00020000 fd:00 100762635                  /usr/lib64/ld-2.17.so
7fca2ccbb000-7fca2ccbc000 rw-p 00000000 00:00 0 
7ffe47eb2000-7ffe47ed3000 rw-p 00000000 00:00 0                          [stack]
7ffe47f52000-7ffe47f54000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Aborted (core dumped)
