assert.sql

application/octet-stream

Filename: assert.sql
Type: application/octet-stream
Part: 0
Message: Assertion with aborted UPDATE in subtransaction
CREATE OR REPLACE FUNCTION update()
    RETURNS SETOF TEXT AS $aa$
DECLARE
    query_to_execute text;
BEGIN
    execute $$select * from t_big for no key update$$;
    FOR i IN 1..3 LOOP
            query_to_execute:= $$update t_big set c1 = c1+1 ;$$;
            begin
                execute query_to_execute;
                raise exception 'Exception';
            exception
                when others then
                    raise notice 'Caught exception: %', sqlerrm;
            end;
            execute query_to_execute;
        END LOOP;
END;
$aa$
    LANGUAGE plpgsql;


drop table if exists t_big;
create table t_big(c1 bigint,  filler CHAR(700) DEFAULT '');
alter table t_big alter column filler set storage PLAIN;
insert into t_big select 1,  'abcdefghi' || x from generate_series(1,2) x;
SET default_transaction_isolation = 'read committed';
select * from update();