Error when using unquoted identifier that contains the word end in a begin atomic block - Mailing list pgsql-bugs

From Jonathan Zacharuk
Subject Error when using unquoted identifier that contains the word end in a begin atomic block
Date
Msg-id YT2PR01MB4318B3BD0B4D84546C3EAC169C1DA@YT2PR01MB4318.CANPRD01.PROD.OUTLOOK.COM
Whole thread Raw
Responses Re: Error when using unquoted identifier that contains the word end in a begin atomic block
List pgsql-bugs

PostgreSQL 15.2 (Debian 15.2-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit

Run via Docker 15.4 image

 

It seems to me that within a BEGIN ATOMIC block the use of the word “end” within an unquoted identifier is causing an error.

The word “end” is a reserved keyword. However, it is my understanding from the documentation that keywords cannot be used *as* an identifier, but they should be able to be used within an identifier.

For instance, the “end” in effective_end_date is a valid identifier.

 

-- Create a data set with the word end in it.

CREATE VIEW test_view AS

SELECT CURRENT_TIMESTAMP as effective_end_date

> OK

> Query Time: 0.002s

 

-- This function is successfully created (note the quoted “effective_end_date”).

CREATE OR REPLACE FUNCTION test_function_success() RETURNS TIMESTAMP

LANGUAGE SQL

BEGIN ATOMIC

  SELECT DISTINCT "effective_end_date"

                FROM test_view;

END

> Affected rows: 0

> Query Time: 0.001s

 

-- This function fails to be created. I would expect this to work.

CREATE OR REPLACE FUNCTION test_function_fail() RETURNS TIMESTAMP

LANGUAGE SQL

BEGIN ATOMIC

  SELECT DISTINCT effective_end_date

                FROM test_view

> ERROR:  syntax error at end of input

LINE 6:  FROM test_view

                       ^

 

> Query Time: 0s

pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: BUG #18068: Insufficient permission unless SUPERUSER
Next
From: Tom Lane
Date:
Subject: Re: Error when using unquoted identifier that contains the word end in a begin atomic block