Thread: Problem with ecpg

Problem with ecpg

From
Carmen Gloria Sepulveda Dedes
Date:
Hello.

I have a problem with ecpg precompiler.

In a code like:

****
main()
{
 .... some calls to EXEC SQL
 .... printf(" ... % ... \n, var_x);
 ....
}
****

... we omited a " at the printf statement (syntax error).

To compile, we do"ecpg code.pgc" and the standart output prints:
....
prueba.pgc:19: ERROR: Unterminated quoted identifier
prueba.pgc:19: ERROR: Unterminated quoted identifier
prueba.pgc:19: ERROR: Unterminated quoted identifier
prueba.pgc:19: ERROR: Unterminated quoted identifier
prueba.pgc:19: ERROR: Unterminated quoted identifier
....
in a loop (stop with ctrl-d).

When we compile with Workshop, this output go to a file in the /tmp
directory (a very big file).

The questions are:
It's a bug of ecpg o it's normal?
How can I resolve this?

Thanks.

CG


Re: Problem with ecpg

From
Michael Meskes
Date:
On Fri, Oct 31, 2003 at 10:26:28AM -0300, Carmen Gloria Sepulveda Dedes wrote:
> To compile, we do"ecpg code.pgc" and the standart output prints:
> ....
> prueba.pgc:19: ERROR: Unterminated quoted identifier
> prueba.pgc:19: ERROR: Unterminated quoted identifier
> prueba.pgc:19: ERROR: Unterminated quoted identifier
> prueba.pgc:19: ERROR: Unterminated quoted identifier
> prueba.pgc:19: ERROR: Unterminated quoted identifier
> ....

Yes, it doesn't make sense to try to keep on parsing when finding an EOF
inside a string. :-)

I just fixed this in CVS, Version 3.0.0 coming with pgsql 7.4 will no
longer run this endless loop.

Thanks for reporting this bug.

Michael
--
Michael Meskes
Email: Michael at Fam-Meskes dot De
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!

Re: Problem with ecpg

From
Carmen Gloria Sepulveda Dedes
Date:
> Yes, it doesn't make sense to try to keep on parsing when finding an EOF
> inside a string. :-)
>
> I just fixed this in CVS, Version 3.0.0 coming with pgsql 7.4 will no
> longer run this endless loop.

I have pgsql 7.3.4 and ecpg 2.10.0

Does exists a patch for this version?

Thanks.

CG




Re: Problem with ecpg

From
Michael Meskes
Date:
On Fri, Oct 31, 2003 at 11:20:27AM -0300, Carmen Gloria Sepulveda Dedes wrote:
> I have pgsql 7.3.4 and ecpg 2.10.0
>
> Does exists a patch for this version?

No, but it is rather simple. Just search for "Unterminated" in
preproc/pgc.l and you'll find some mmerror() calls. In these calls just
replace the ET_ERROR with ET_FATAL. That's it.

Michael
--
Michael Meskes
Email: Michael at Fam-Meskes dot De
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!