pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: feikesteenbergen@gmail.com
Subject: BUG #15555: Syntax errors when using the COMMENT command in plpgsql and a "comment" variable
Date: Mon, 17 Dec 2018 09:10:12 +0000
Message-ID: <15555-149bbd70ddc7b4b6@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      15555
Logged by:          Feike Steenbergen
Email address:      feikesteenbergen@gmail.com
PostgreSQL version: 11.1
Operating system:   CentOS Linux release 7.5.1804 (Core)
Description:        

Recently, I ran into an issue when trying to put comments on objects in
plpgsql DO block, for example the following:

DO $$
DECLARE
    "comment" text := 'This is a comment';
BEGIN
    COMMENT ON TABLE abc IS 'This is another comment';
END;
$$;

Generates the following error message:

ERROR:  42601: syntax error at or near "ON"
LINE 5:     COMMENT ON TABLE abc IS 'This is another comment';

Renaming the variable from "comment" to something else makes the problem go
away,
as well as wrapping the COMMENT command in an EXECUTE call;
It happens both when double quoting the identifier, or when omitting the
double
quotes.

For now I'll just avoid using comment as a variable name altogether, but I
was
surprised by this behaviour.

Kind regards,

Feike



view thread (6+ messages)  latest in thread

Message-ID: <15555-149bbd70ddc7b4b6@postgresql.org>
Permalink:  ../15555-149bbd70ddc7b4b6@postgresql.org/
Also on:    postgresql.org/message-id/15555-149bbd70ddc7b4b6@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, feikesteenbergen@gmail.com
  Subject: Re: BUG #15555: Syntax errors when using the COMMENT command in plpgsql and a "comment" variable
  In-Reply-To: <15555-149bbd70ddc7b4b6@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox