Thread: TG_RELNAME problem

TG_RELNAME problem

From
Uros
Date:
Hello ,

When i use TG_RELNAME with SELECT INTO and from

Create or replace function "fn_i_generate_path_category"() returns trigger as '
declare
    n integer;
    category RECORD;
    tmp RECORD;
begin
        raise notice ''%'',TG_RELNAME;
    if new."path" = '''' then
        SELECT INTO tmp "id_category" from TG_RELNAME where "path" = ''Top'';
        if FOUND then
        ...............

When function is started i get error:

 ERROR:  syntax error at or near "$1" at character 29

What can I do

--
Best regards,
 Uros                          mailto:uros@sir-mag.com


Re: TG_RELNAME problem

From
"cnliou"
Date:
>    if new."path" = '''' then
>        SELECT INTO tmp "id_category" from TG_RELNAME where
"path" = ''Top'';
>        if FOUND then

Perhaps you will get some idea if you read the document:

37.6.4. Executing Dynamic Commands

Regards,
CN

Re: TG_RELNAME problem

From
Uros Gruber
Date:
Hi,


I already found a solution. I use
FOR tmp IN EXECUTE ''SELECT.....'' || TG_RELNAME || ''...'' loop

and it works. Thanks anyway

--
regards,
 Uros

Wednesday, February 25, 2004, 4:49:19 PM, you wrote:

>>    if new."path" = '''' then
>>        SELECT INTO tmp "id_category" from TG_RELNAME where
c> "path" = ''Top'';
>>        if FOUND then

c> Perhaps you will get some idea if you read the document:

c> 37.6.4. Executing Dynamic Commands

c> Regards,
c> CN

c> ---------------------------(end of
c> broadcast)---------------------------
c> TIP 6: Have you searched our list archives?

c>                http://archives.postgresql.org