From: | Thiemo Kellner <pgresql(at)thiam(dot)ch> |
---|---|
To: | pgGeneral(at)thiam(dot)ch, pgNovice <pgsql-novice(at)postgresql(dot)org> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | Re: [GENERAL] Error >>syntax error<< at >>$1<< at character 53 |
Date: | 2004-08-09 20:23:42 |
Message-ID: | 200408092223.42372.pgresql@thiam.ch |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-novice |
Thanks for the quick answer. A pitty, this does not work. I just intended to
use this table various times and using a variable would have meant better
maintainability.
Cheers,
Thiemo
Am Montag, 9. August 2004 02.27 schrieben Sie:
> Don't use plpgsql variables named the same as tables or fields that you
> need to reference in queries inside the function. plpgsql will think it
> ought to substitute the variable value as a parameter.
>
> 8.0devel generates a more useful error message from this function:
>
> regression=# select get_summary();
> ERROR: syntax error at or near "$1" at character 53
> QUERY: select OBJEKTKATEGORIE, OBJEKTGRUPPE, OBJEKT from $1
> CONTEXT: PL/pgSQL function "get_summary" line 9 at for over select rows
> LINE 1: select OBJEKTKATEGORIE, OBJEKTGRUPPE, OBJEKT from $1
> ^
>
> Here you can actually see the query string fed to the SQL engine,
> and see that STR_OBJEKTVIEW got replaced by a parameter symbol,
> which of course is not going to work.
>
> regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2004-08-09 20:41:40 | Re: PostgreSQL 8.0 Feature List? |
Previous Message | Tom Lane | 2004-08-09 19:31:00 | Re: Losing records when server hang |
From | Date | Subject | |
---|---|---|---|
Next Message | Roberto Rezende de Assis | 2004-08-10 10:43:29 | SOUNDEX |
Previous Message | Oliver Elphick | 2004-08-09 20:09:17 | Re: Copy query results to a file |