Robert Haas <robertmhaas@gmail.com> wrote:
> What is the use case for the status quo?
Much simplified:
create table party
( countyno smallint not null, caseno varchar(14) not null, partyno smallint not null, name text not null, address text,
isaddrsealedboolean not null, primary key (countyno, caseno, partyno)
);
create table sealedaddrauth
( userid text not null primary key
);
create view partyview as select countyno, caseno, partyno, case when isaddrsealed and not exists (select *
fromsealedaddrauth where userid = current_user) then '*** SEALED ***' else address end as address,
isaddrsealedfrom party
;
insert into party values (1,'2010FA000123',1,'Jane Doe',
'123 Victim Ave., Anytown, WI 53599',true);
insert into party values (1,'2010FA000123',2,'John Doe',
'123 Stalker St., Hometown, WI 53666',false);
-- Kevin