Revert bulk update patch
- Revert patch #2311 - Keep the refactor done to qsFiltersRoot - Keep the refactor done to the items tables - Add tests that now work with pg-safeupdate as a result
This commit is contained in:
Vendored
+8
-14
@@ -781,12 +781,6 @@ INSERT INTO private.internal_job (id, parent_id) VALUES (2, 1);
|
||||
TRUNCATE TABLE test.test CASCADE;
|
||||
INSERT INTO test.test (id, parent_id) VALUES (1, null), (2, 1);
|
||||
|
||||
TRUNCATE TABLE test.bulk_update_items CASCADE;
|
||||
INSERT INTO test.bulk_update_items (id, name, observation) VALUES (1, 'item-1', NULL), (2, 'item-2', NULL), (3, 'item-3', NULL);
|
||||
|
||||
TRUNCATE TABLE test.bulk_update_items_cpk CASCADE;
|
||||
INSERT INTO test.bulk_update_items_cpk (id, name, observation) VALUES (1, 'item-1', NULL), (2, 'item-2', NULL), (3, 'item-3', NULL);
|
||||
|
||||
TRUNCATE TABLE shops CASCADE;
|
||||
INSERT INTO shops(id, address, shop_geom) VALUES(1, '1369 Cambridge St', 'SRID=4326;POINT(-71.10044 42.373695)');
|
||||
INSERT INTO shops(id, address, shop_geom) VALUES(2, '757 Massachusetts Ave', 'SRID=4326;POINT(-71.10543 42.366432)');
|
||||
@@ -804,11 +798,11 @@ INSERT INTO "SPECIAL ""@/\#~_-".names (id, name) VALUES (1, 'John'), (2, 'Mary')
|
||||
TRUNCATE TABLE do$llar$s CASCADE;
|
||||
INSERT INTO do$llar$s (a$num$) VALUES (100), (200), (300);
|
||||
|
||||
TRUNCATE TABLE safe_update CASCADE;
|
||||
INSERT INTO safe_update(id, name) VALUES (1, 'First'), (2, 'Second'), (3, 'Third');
|
||||
TRUNCATE TABLE safe_delete CASCADE;
|
||||
INSERT INTO safe_delete(id, name) VALUES (1, 'First'), (2, 'Second'), (3, 'Third');
|
||||
TRUNCATE TABLE unsafe_update CASCADE;
|
||||
INSERT INTO unsafe_update(id, name) VALUES (1, 'First'), (2, 'Second'), (3, 'Third');
|
||||
TRUNCATE TABLE unsafe_delete CASCADE;
|
||||
INSERT INTO unsafe_delete(id, name) VALUES (1, 'First'), (2, 'Second'), (3, 'Third');
|
||||
TRUNCATE TABLE safe_update_items CASCADE;
|
||||
INSERT INTO safe_update_items(id, name, observation) VALUES (1, 'item-1', NULL), (2, 'item-2', NULL), (3, 'item-3', NULL);
|
||||
TRUNCATE TABLE safe_delete_items CASCADE;
|
||||
INSERT INTO safe_delete_items(id, name, observation) VALUES (1, 'item-1', NULL), (2, 'item-2', NULL), (3, 'item-3', NULL);
|
||||
TRUNCATE TABLE unsafe_update_items CASCADE;
|
||||
INSERT INTO unsafe_update_items(id, name, observation) VALUES (1, 'item-1', NULL), (2, 'item-2', NULL), (3, 'item-3', NULL);
|
||||
TRUNCATE TABLE unsafe_delete_items CASCADE;
|
||||
INSERT INTO unsafe_delete_items(id, name, observation) VALUES (1, 'item-1', NULL), (2, 'item-2', NULL), (3, 'item-3', NULL);
|
||||
|
||||
Vendored
+4
-6
@@ -189,16 +189,14 @@ GRANT ALL ON TABLE
|
||||
, series_popularity
|
||||
, test
|
||||
, view_test
|
||||
, bulk_update_items
|
||||
, bulk_update_items_cpk
|
||||
, shops
|
||||
, shop_bles
|
||||
, "SPECIAL ""@/\#~_-".names
|
||||
, do$llar$s
|
||||
, safe_update
|
||||
, safe_delete
|
||||
, unsafe_update
|
||||
, unsafe_delete
|
||||
, safe_update_items
|
||||
, safe_delete_items
|
||||
, unsafe_update_items
|
||||
, unsafe_delete_items
|
||||
TO postgrest_test_anonymous;
|
||||
|
||||
GRANT INSERT ON TABLE insertonly TO postgrest_test_anonymous;
|
||||
|
||||
Vendored
+13
-24
@@ -2534,7 +2534,7 @@ select * from limited_delete_items_cpk;
|
||||
create function reset_items_tables(tbl_name text default '') returns void as $_$ begin
|
||||
execute format(
|
||||
$$
|
||||
delete from %I;
|
||||
delete from %I where true; -- WHERE is required for pg-safeupdate tests
|
||||
insert into %I values (1, 'item-1'), (2, 'item-2'), (3, 'item-3');
|
||||
$$::text,
|
||||
tbl_name, tbl_name);
|
||||
@@ -2638,21 +2638,6 @@ CREATE TABLE test.test (
|
||||
CREATE OR REPLACE VIEW test.view_test AS
|
||||
SELECT id FROM test.test;
|
||||
|
||||
-- Tables to test bulk updates
|
||||
|
||||
CREATE TABLE test.bulk_update_items (
|
||||
id INT PRIMARY KEY,
|
||||
name TEXT,
|
||||
observation TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE test.bulk_update_items_cpk (
|
||||
id INT,
|
||||
name TEXT,
|
||||
observation TEXT,
|
||||
PRIMARY KEY (id, name)
|
||||
);
|
||||
|
||||
create extension if not exists postgis with schema extensions;
|
||||
|
||||
create table shops (
|
||||
@@ -2692,24 +2677,28 @@ CREATE TABLE do$llar$s (
|
||||
|
||||
-- Tables and functions to test the pg-safeupdate library
|
||||
|
||||
CREATE TABLE test.safe_update(
|
||||
CREATE TABLE test.safe_update_items(
|
||||
id INT PRIMARY KEY,
|
||||
name TEXT
|
||||
name TEXT,
|
||||
observation TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE test.safe_delete(
|
||||
CREATE TABLE test.safe_delete_items(
|
||||
id INT PRIMARY KEY,
|
||||
name TEXT
|
||||
name TEXT,
|
||||
observation TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE test.unsafe_update(
|
||||
CREATE TABLE test.unsafe_update_items(
|
||||
id INT PRIMARY KEY,
|
||||
name TEXT
|
||||
name TEXT,
|
||||
observation TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE test.unsafe_delete(
|
||||
CREATE TABLE test.unsafe_delete_items(
|
||||
id INT PRIMARY KEY,
|
||||
name TEXT
|
||||
name TEXT,
|
||||
observation TEXT
|
||||
);
|
||||
|
||||
CREATE OR REPLACE FUNCTION test.load_safeupdate() RETURNS VOID AS $$
|
||||
|
||||
Reference in New Issue
Block a user