create table bugtest (
	id serial not null primary key,
	name text not null unique
);

create function insert_bugtest (
	vname text )
returns int as $f$
begin
	insert into bugtest ( name ) values ( vname );
	return currval('bugtest_id_seq');
end; $f$ language plpgsql security definer;

select insert_bugtest('Before ALTER');

alter table bugtest add is_true boolean;
alter table bugtest alter is_true set default true;

select insert_bugtest('Look, its null');

create or replace function insert_bugtest (
	vname text )
returns int as $f$
begin
	insert into bugtest ( name ) values ( vname );
	return currval('bugtest_id_seq');
end; $f$ language plpgsql security definer;

select insert_bugtest('Now its true.');

select * from bugtest order by id;