TG_RELNAME problem

Started by Uros Gruberabout 22 years ago3 messagesgeneral
Jump to latest
#1Uros Gruber
uros@sir-mag.com

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

#2cnliou
cnliou@so-net.net.tw
In reply to: Uros Gruber (#1)
Re: TG_RELNAME problem

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

#3Uros Gruber
uros@sir-mag.com
In reply to: cnliou (#2)
Re: TG_RELNAME problem

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