BUG #5172: ecpg - cursor with regexp containing '.*/' fails to compile with gcc - Mailing list pgsql-bugs

From Viisard
Subject BUG #5172: ecpg - cursor with regexp containing '.*/' fails to compile with gcc
Date
Msg-id 200911071856.nA7IuavI066952@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #5172: ecpg - cursor with regexp containing '.*/' fails to compile with gcc  (Michael Meskes <meskes@postgresql.org>)
List pgsql-bugs
The following bug has been logged online:

Bug reference:      5172
Logged by:          Viisard
Email address:      viisard@hotmail.com
PostgreSQL version: 8.4.1
Operating system:   Fedora 11 (Linux 2.6.30.9-96.fc11.i686.PAE)
Description:        ecpg - cursor with regexp containing '.*/' fails to
compile with gcc
Details:

I'm using ecpg (PostgreSQL 8.4.1) 4.5.0. It fails to generate valid c file,
when a cursor with a regular expression (in probably could be any string)
containing '*/'.

The line in foo.cpg:
...
EXEC SQL DECLARE foo CURSOR FOR SELECT SUBSTRING('/foo/bar','.*/');
...

is translated into:
foo.c:

    /* declare foo cursor for select substring ( '/foo/bar' , '.*/' ) */
#line 9 "foo.cpg"

    { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare foo cursor for
select substring ( '/foo/bar' , '.*/' )", ECPGt_EOIT, ECPGt_EORT);}

There is a simple workaround for this by using '.*[/]' as the regexp.

pgsql-bugs by date:

Previous
From: "digital.death@gmx.it"
Date:
Subject: odd deadlock on CREATE TABLE AS SELECT
Next
From: Tom Lane
Date:
Subject: Re: odd deadlock on CREATE TABLE AS SELECT