END is not a reserved word

From: Vicky Vergara <vicky_vergara(at)hotmail(dot)com>
To: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: END is not a reserved word
Date: 2025-08-25 22:48:52
Message-ID: DM8P220MB0390E641335AE886D0FF8CE68A3EA@DM8P220MB0390.NAMP220.PROD.OUTLOOK.COM
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello all

A simplification of the problem I found:

Here is a function (taken from the postgres documentation)
```
CREATE FUNCTION add(integer, integer) RETURNS integer
AS 'select $1 + $2;'
LANGUAGE SQL
IMMUTABLE
RETURNS NULL ON NULL INPUT;
```

"Accidentally" did the following:
```
SELECT add(3,4) END;
```
On postgres 14 and over+ there is no problem:
```
end
-----
7
(1 row)
```
On Postgres 13 and under:
```
ERROR: syntax error at or near "END"
LINE 1: SELECT add(3,4) END;
```

On the list of reserved words, END is marked as reserved.
https://www.postgresql.org/docs/current/sql-keywords-appendix.html

Since postgres 14+ is not reserved and can be used, for example as a column name.
Unless I am mistaken that shouldn't happen.

Made a small CI test with the code above: (link will be unavailable when gihub removes the workflow)
Fails as expected as `end` is a reserved word (pg13)
https://github.com/cvvergara/pgrouting/actions/runs/17222387428/job/48860365813#step:8:32
But on the other test runs it has no problem (pg17)
https://github.com/cvvergara/pgrouting/actions/runs/17222387428/job/48860365870#step:8:27

Regards
Vicky Vergara
pgRouting developer

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sami Imseih 2025-08-25 22:51:38 Re: Per backend relation statistics tracking
Previous Message Jacob Champion 2025-08-25 22:38:59 Re: Support getrandom() for pg_strong_random() source