fix: ignore views on col/fk as target

Also refactor self relationship findRel logic
This commit is contained in:
steve-chavez
2022-05-16 12:22:24 -05:00
committed by Steve Chavez
parent 2be63b36d6
commit f7b173163c
8 changed files with 144 additions and 93 deletions
+3
View File
@@ -775,3 +775,6 @@ INSERT INTO oid_test(id, oid_col, oid_array_col) VALUES (1, '12345', '{1,2,3,4,5
TRUNCATE TABLE private.internal_job CASCADE;
INSERT INTO private.internal_job (id, parent_id) VALUES (1, null);
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);
+5
View File
@@ -181,6 +181,11 @@ GRANT ALL ON TABLE
, xmltest
, oid_test
, job
, series
, adaptation_notifications
, series_popularity
, test
, view_test
TO postgrest_test_anonymous;
GRANT INSERT ON TABLE insertonly TO postgrest_test_anonymous;
+25
View File
@@ -2605,3 +2605,28 @@ CREATE TABLE private.internal_job
CREATE VIEW test.job AS
SELECT j.id, j.parent_id
FROM private.internal_job j;
-- https://github.com/PostgREST/postgrest/issues/2238
CREATE TABLE series (
id bigint PRIMARY KEY,
title text NOT NULL
);
CREATE TABLE adaptation_notifications (
id bigint PRIMARY KEY,
series bigint REFERENCES series(id),
status text
);
CREATE VIEW series_popularity AS
SELECT id, random() AS popularity_score
FROM series;
-- https://github.com/PostgREST/postgrest/issues/1643
CREATE TABLE test.test (
id BIGINT NOT NULL PRIMARY KEY,
parent_id BIGINT CONSTRAINT parent_test REFERENCES test(id)
);
CREATE OR REPLACE VIEW test.view_test AS
SELECT id FROM test.test;