R: Re: R: Re: Weird EXECUTE ... USING behaviour - Mailing list pgsql-general

From Vincenzo Romano
Subject R: Re: R: Re: Weird EXECUTE ... USING behaviour
Date
Msg-id 3eff28921001131339m1ab06720m92995977eb02026b@mail.gmail.com
Whole thread Raw
In response to Re: R: Re: Weird EXECUTE ... USING behaviour  (Adrian Klaver <adrian.klaver@gmail.com>)
Responses Re: R: Re: R: Re: Weird EXECUTE ... USING behaviour
List pgsql-general

My issue involves the USING predicates, though.

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

On 01/13/2010 09:37 AM, Vincenzo Romano wrote: > > 2010/1/13 Vincenzo Romano<vincenzo.romano@notoran... 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.klaver@gmail.com

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: R: Re: Weird EXECUTE ... USING behaviour
Next
From: Adrian Klaver
Date:
Subject: Re: R: Re: R: Re: Weird EXECUTE ... USING behaviour