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