BUG #1099: bad syntax error localisation

Started by PostgreSQL Bugs Listabout 22 years ago3 messagesbugs
Jump to latest
#1PostgreSQL Bugs List
pgsql-bugs@postgresql.org

The following bug has been logged online:

Bug reference: 1099
Logged by: Fabien Coelho

Email address: coelho@cri.ensmp.fr

PostgreSQL version: 7.5 Dev

Operating system: linux debian

Description: bad syntax error localisation

Details:

The example is in the regression tests:-)

In src/test/regress/output/create_function_1.source
on line 55:

CREATE FUNCTION test1 (int) RETURNS int LANGUAGE sql
AS 'not even SQL';
ERROR: syntax error at or near "not" at character 1

You may notice that word "not" is not at character 1,
where there is "CREATE".

#2Peter Eisentraut
peter_e@gmx.net
In reply to: PostgreSQL Bugs List (#1)
Re: BUG #1099: bad syntax error localisation

PostgreSQL Bugs List wrote:

CREATE FUNCTION test1 (int) RETURNS int LANGUAGE sql
AS 'not even SQL';
ERROR: syntax error at or near "not" at character 1

You may notice that word "not" is not at character 1,
where there is "CREATE".

The error message refers to the function body, which is parsed
separately and therefore starts the count at 1.

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Peter Eisentraut (#2)
Re: BUG #1099: bad syntax error localisation

Peter Eisentraut <peter_e@gmx.net> writes:

PostgreSQL Bugs List wrote:

CREATE FUNCTION test1 (int) RETURNS int LANGUAGE sql
AS 'not even SQL';
ERROR: syntax error at or near "not" at character 1

The error message refers to the function body, which is parsed
separately and therefore starts the count at 1.

I'm surprised there is no CONTEXT line here though. You would have
gotten one for a syntax error in plpgsql; I must have overlooked doing
it for SQL.

regards, tom lane