Re: DO like block for for anonymous procedures

2021-07-28 Thread Vijaykumar Jain
please ignore, i overlooked the obvious. truncate table t; TRUNCATE TABLE postgres=# do $$ declare valuelist int[] := ARRAY[1,2,3,4,5,1]; -- purposely inserting duplicate that would rollback everything declare i int; begin for i in select k from unnest(valuelist) p(k) loop insert into t values(i);

DO like block for for anonymous procedures

2021-07-28 Thread Vijaykumar Jain
Hi, PostgreSQL: Documentation: 13: DO Is it possible to run a DO block for multiple transactions ? I am not sure if i'll be able explain it more verbally, but -- the entire DO block like a function block is a single tx postgres=# do $$ declare