R: Re: R: Re: Weird EXECUTE ... USING behaviour

From: Vincenzo Romano <vincenzo(dot)romano(at)notorand(dot)it>
To: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: R: Re: R: Re: Weird EXECUTE ... USING behaviour
Date: 2010-01-13 21:39:15
Message-ID: 3eff28921001131339m1ab06720m92995977eb02026b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

My issue involves the USING predicates, though.

Il giorno 13 gen, 2010 10:26 p., "Adrian Klaver" <adrian(dot)klaver(at)gmail(dot)com>
ha scritto:

On 01/13/2010 09:37 AM, Vincenzo Romano wrote: > > 2010/1/13 Vincenzo
Romano<vincenzo(dot)romano(at)notoran(dot)(dot)(dot)
CREATE OR REPLACE FUNCTION public.alter_test(tbl text)
RETURNS void
LANGUAGE plpgsql
AS $function$
DECLARE
len integer :=3;
BEGIN
RAISE NOTICE '%,%' ,len,$1;
EXECUTE '
alter table '||tbl||' add check(length(tc_table_code) <
'||len||' )';
RETURN;
END;
$function$

Some playing around got the above to work for a test case on my machine
(8.4). The substitution is done before the check is parsed.

--

Adrian Klaver adrian(dot)klaver(at)gmail(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message akuster 2010-01-13 21:47:54 Re: How to subscribe to your security list?
Previous Message Adrian Klaver 2010-01-13 21:26:52 Re: R: Re: Weird EXECUTE ... USING behaviour