Re: BUG #1486: Apostrophes are not ignored in pgplsql comments

From: Richard Huxton <dev(at)archonet(dot)com>
To: Andrew Gold <agold(at)cbamedia(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1486: Apostrophes are not ignored in pgplsql comments
Date: 2005-02-21 13:55:44
Message-ID: 4219E860.6030806@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Andrew Gold wrote:
> The following bug has been logged online:
>
> Bug reference: 1486
> Logged by: Andrew Gold
> Email address: agold(at)cbamedia(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Ludwig Lim 2005-02-21 13:56:45 BUG #1494: psql \df to_char
Previous Message naresh soni 2005-02-21 13:28:54 BUG #1493: image storeg