Re: PLPGSQL - Trigger Insert acting strange

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Hadley Willan <hadley(dot)willan(at)deeper(dot)co(dot)nz>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PLPGSQL - Trigger Insert acting strange
Date: 2002-10-21 04:46:45
Message-ID: 10581.1035175605@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hadley Willan <hadley(dot)willan(at)deeper(dot)co(dot)nz> writes:
> CREATE OR REPLACE FUNCTION fn_del_pol_grp_folder_unit(
> VARCHAR(32),
> INTEGER,
> INTEGER ) RETURNS BOOLEAN AS'
> DECLARE
> _policy_group ALIAS FOR $1;
> _folder ALIAS FOR $2;
> _unit ALIAS FOR $3;
> BEGIN
> RAISE NOTICE ''fn_del_pol_grp_folder_unit, %,%,%'',
> _policy_group, _folder, _unit;

> DELETE FROM policy_group_folder_unit
> WHERE policy_group = quote_literal(_policy_group)
> AND folder = _folder
> AND unit_number = _unit;

> RETURN TRUE;
> END;'
> language 'plpgsql';

I don't believe you want quote_literal() here. plpgsql can pass
variables into queries just fine...

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message frank_lupo 2002-10-21 06:32:41 Re: [pgadmin-support] hi
Previous Message Hadley Willan 2002-10-21 04:32:07 PLPGSQL - Trigger Insert acting strange