Re: sintax error
От | Richard Huxton |
---|---|
Тема | Re: sintax error |
Дата | |
Msg-id | 4B7E6E47.5020503@archonet.com обсуждение исходный текст |
Ответ на | sintax error (iuri de araujo sampaio <iuri.sampaio@gmail.com>) |
Ответы |
Re: sintax error
Re: sintax error |
Список | pgsql-sql |
On 19/02/10 07:52, iuri de araujo sampaio wrote: > Hi there, > i have got the followed error in the pgsql function bellow. Log messages > point to: > > ******************** > ERROR: syntax error at end of input > LINE 1: SELECT > ^ > QUERY: SELECT > CONTEXT: SQL statement in PL/PgSQL function > "cms_permission__revoke_permission" near line 67 > > ********** Error ********** > > ERROR: syntax error at end of input > SQL state: 42601 > Context: SQL statement in PL/PgSQL function > "cms_permission__revoke_permission" near line 67 > > ******************** > > However, I couldn't find any sintax error in those SELECT statements > does anyone have any idea what is wrong with it? I thought it was the PERFORM statements, but it's not. The line number seems right, although the error message is misleading. > if v_count < 1 then> return;> end if; That bare return isn't legal. Try "return NULL" instead. The "error at end of input" means it was looking for an expression to return and couldn't find one. Oh - unrelated tips. 1. You can have multi-line comments with /* ... */ - very useful for debugging. 2. Any version of PostgreSQL from the last few years supports "dollar quoting". http://www.postgresql.org/docs/8.4/static/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS That lets you do: create or replace function ... as $$ ... IF myvar = 'normal-quoting works here' THEN ... $$ language plpgsql; -- Richard Huxton Archonet Ltd
В списке pgsql-sql по дате отправления: