Re: [BUGS] BUG #2171: Differences compiling plpgsql in

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: andrew5(at)ece(dot)cmu(dot)edu, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>, PostgreSQL-interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: [BUGS] BUG #2171: Differences compiling plpgsql in
Date: 2006-02-07 01:40:18
Message-ID: 200602070140.k171eIY00569@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-interfaces pgsql-patches

Michael Meskes wrote:
> On Wed, Feb 01, 2006 at 11:48:45PM -0500, Bruce Momjian wrote:
> > I have researched your report, and you are right, there are two ecpg
> > bugs here. First, dollar quoting uses single-quotes internally to do
> > the quoting, but it does not double any single-quotes in the
> > dollar-quoted string.
>
> Actually ecpg should not translate dollar quoting at all. I'm going to
> fix this. Dollar quotes will then be send to the backend with
> translation and the backend takes care of the rest.

Well, CVS version before I modified it had "dolq" stuff in the lexer to
handle dollar quotes and pass it as SCONST to the parser.

> > Second, when a dollar quoted string or single-quoted string spans
> > multiple lines, ecpg does not escape the newline that is part of the
> > string. Some compilers will accept an unescaped newline in a string,
> > while others will not:
>
> Not sure, but there appears to be a bug in the routine that outputs a
> statement. I will change that one as well and would ask you to just
> check again. It seems to me that this also fixes your problem. I tried
> with the one test case in this email and it seems to work. But then I'm
> currently travelling and do not have that much spare time to test.

The problem is that output.c does:

printf("abc
def");

While some compilers are OK with that, others are not. I changed it to
output:

printf("abc\n\
def");

--
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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Matej Rizman 2006-02-07 02:41:03 BUG #2243: Postgresql fails to finish some queries
Previous Message James William Pye 2006-02-07 01:22:51 Re: BUG #2240: length() with geometric types

Browse pgsql-interfaces by date

  From Date Subject
Next Message Matson, Sunny (GE Healthcare) 2006-02-07 09:29:46 ECPG interface issue
Previous Message Bruce Momjian 2006-02-07 01:24:19 Re: PQprint under Windows

Browse pgsql-patches by date

  From Date Subject
Next Message Christopher Kings-Lynne 2006-02-07 02:22:34 Re: drop if exists remainder
Previous Message Thomas F. O'Connell 2006-02-06 23:56:45 Re: pgbench: Support Multiple Simultaneous Runs (with Mean and Std. Dev.)