Re: BUG #1486: Apostrophes are not ignored in pgplsql comments - Mailing list pgsql-bugs

From Richard Huxton
Subject Re: BUG #1486: Apostrophes are not ignored in pgplsql comments
Date
Msg-id 4219E860.6030806@archonet.com
Whole thread Raw
In response to BUG #1486: Apostrophes are not ignored in pgplsql comments  ("Andrew Gold" <agold@cbamedia.com>)
List pgsql-bugs
Andrew Gold wrote:
> The following bug has been logged online:
>
> Bug reference:      1486
> Logged by:          Andrew Gold
> Email address:      agold@cbamedia.com
> PostgreSQL version: 7.4.7
> Operating system:   Debian Linux
> Description:        Apostrophes are not ignored in pgplsql comments
> Details:
>
> In pgplsql functions, apostrophes in comments are not ignored by the pgplsql
> interpreter. Parsing errors result from correct spelling in comments. For
> example, a comment such as:
>
> -- This can't be a good way to solve this.
>
> will generate errors. This seems to be a general bug and was easily
> duplicated.

I don't think it's a plpgsql problem though - rather an artefact of the
SQL parser. You're actually doing

CREATE FUNCTION foo() RETURNS ... AS <some text value> LANGUAGE ...;

I think the problem is while the SQL parser is processing the text-value
- you need to escape the single-quote to get past that stage of parsing.

There are similar issues with regexp strings.

If you're using dollar-quoting in 8.0 the problem is gone.

--
   Richard Huxton
   Archonet Ltd

pgsql-bugs by date:

Previous
From: "Magnus Hagander"
Date:
Subject: Re: problem installing postgresql-8.0.1 on Windows 2K
Next
From: Richard Huxton
Date:
Subject: Re: BUG #1485: upper case user names / creatuser