Re: ECPG and escape strings

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: ECPG and escape strings
Date: 2005-08-22 20:27:45
Message-ID: 200508222027.j7MKRji03320@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-interfaces pgsql-patches


It turns out I made a mistake in trying to be too smart about adding E''
escapes for ecpg strings that have backslashes. I have reversed the
attached patch to fix the problem. Thanks for the report.

---------------------------------------------------------------------------

Michael Fuhr wrote:
> ECPG seems to be a little overzealous with the new escape string syntax:
>
> % cat foo.pgc
> int
> main(void)
> {
> putchar('\n');
> return 0;
> }
>
> % ecpg foo.pgc
>
> % gcc -I`pg_config --includedir` -c foo.c
> foo.pgc: In function `main':
> foo.pgc:4: `E' undeclared (first use in this function)
> foo.pgc:4: (Each undeclared identifier is reported only once
> foo.pgc:4: for each function it appears in.)
> foo.pgc:4: syntax error before character constant
>
> % cat foo.c
> /* Processed by ecpg (4.1.1) */
> /* These include files are added by the preprocessor */
> #include <ecpgtype.h>
> #include <ecpglib.h>
> #include <ecpgerrno.h>
> #include <sqlca.h>
> /* End of automatic include section */
> #line 1 "foo.pgc"
> int
> main(void)
> {
> putchar(E'\n');
> return 0;
> }
>
> --
> Michael Fuhr
> http://www.fuhr.org/~mfuhr/
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 20.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim C. Nasby 2005-08-22 20:54:09 Re: [GENERAL] Cascades Failing
Previous Message Jim Nasby 2005-08-22 20:27:33 Re: CREATE USER and pg_user

Browse pgsql-interfaces by date

  From Date Subject
Next Message Michael Meskes 2005-08-23 07:40:36 Re: ECPG and escape strings
Previous Message Greg Sabino Mullane 2005-08-22 01:47:27 Re: DBD::Pg performance bites compared to DBD::mysql?

Browse pgsql-patches by date

  From Date Subject
Next Message Alvaro Herrera 2005-08-22 22:12:33 bug in opclass "alter table owner" handling?
Previous Message Andrew Dunstan 2005-08-22 17:24:44 Re: [HACKERS] PostgreSQL 8.0.3 and Ipv6