feat: add limited update

This commit is contained in:
steve-chavez
2022-03-26 15:29:13 +01:00
committed by Steve Chavez
parent 799daa7556
commit f4becf99ad
9 changed files with 291 additions and 18 deletions
+9
View File
@@ -736,3 +736,12 @@ INSERT INTO test.fav_numbers VALUES (ROW(0.5, 0.5), 'A'), (ROW(0.6, 0.6), 'B');
TRUNCATE TABLE test.arrays CASCADE;
INSERT INTO test.arrays VALUES (0, '{1,2,3}', '{{1,2,3},{4,5,6},{7,8,9}}'), (1, '{11,12,13}', '{{11,12,13},{14,15,16},{17,18,19}}');
TRUNCATE TABLE test.limited_updated_items CASCADE;
INSERT INTO test.limited_updated_items VALUES (1, 'item-1'), (2, 'item-2'), (3, 'item-3');
TRUNCATE TABLE test.limited_updated_items_cpk CASCADE;
INSERT INTO test.limited_updated_items_cpk VALUES (1, 'item-1'), (2, 'item-2'), (3, 'item-3');
TRUNCATE TABLE test.limited_updated_items_no_pk CASCADE;
INSERT INTO test.limited_updated_items_no_pk VALUES (1, 'item-1'), (2, 'item-2'), (3, 'item-3');
+4
View File
@@ -163,6 +163,10 @@ GRANT ALL ON TABLE
, clientinfo
, contact
, chores
, limited_mut_items
, limited_mut_items_cpk
, limited_mut_items_no_pk
, limited_mut_items_view
TO postgrest_test_anonymous;
GRANT INSERT ON TABLE insertonly TO postgrest_test_anonymous;
+31
View File
@@ -2465,3 +2465,34 @@ CREATE AGGREGATE test.unsupported_agg (*) (
SFUNC = public.dummy,
STYPE = int
);
create view no_pk_view as
select * from no_pk;
create table limited_update_items(
id int primary key
, name text
);
create table limited_update_items_cpk(
id int
, name text
, primary key (id, name)
);
create table limited_update_items_no_pk(
id int
, name text
);
create view limited_update_items_view as
select * from limited_update_items;
create function reset_limited_items(tbl_name text default '') returns void as $_$ begin
execute format(
$$
delete from %I;
insert into %I values (1, 'item-1'), (2, 'item-2'), (3, 'item-3');
$$::text,
tbl_name, tbl_name);
end; $_$ language plpgsql volatile;