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