Merge v3
This commit is contained in:
Vendored
+117
-112
@@ -5,10 +5,10 @@ SET check_function_bodies = false;
|
||||
SET client_min_messages = warning;
|
||||
|
||||
|
||||
CREATE SCHEMA "1";
|
||||
CREATE SCHEMA test;
|
||||
|
||||
|
||||
ALTER SCHEMA "1" OWNER TO postgrest_test;
|
||||
ALTER SCHEMA test OWNER TO postgrest_test;
|
||||
|
||||
|
||||
CREATE SCHEMA postgrest;
|
||||
@@ -30,7 +30,7 @@ CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
|
||||
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
|
||||
|
||||
|
||||
SET search_path = "1", pg_catalog;
|
||||
SET search_path = test, pg_catalog;
|
||||
|
||||
|
||||
CREATE TYPE enum_menagerie_type AS ENUM (
|
||||
@@ -39,7 +39,7 @@ CREATE TYPE enum_menagerie_type AS ENUM (
|
||||
);
|
||||
|
||||
|
||||
ALTER TYPE "1".enum_menagerie_type OWNER TO postgrest_test;
|
||||
ALTER TYPE test.enum_menagerie_type OWNER TO postgrest_test;
|
||||
|
||||
SET search_path = postgrest, pg_catalog;
|
||||
|
||||
@@ -76,25 +76,25 @@ CREATE FUNCTION set_authors_only_owner() RETURNS trigger
|
||||
LANGUAGE plpgsql
|
||||
AS $$
|
||||
begin
|
||||
NEW.owner = current_setting('user_vars.user_id');
|
||||
NEW.owner = current_setting('postgrest.claims.id');
|
||||
RETURN NEW;
|
||||
end
|
||||
$$;
|
||||
|
||||
ALTER FUNCTION postgrest.set_authors_only_owner() OWNER TO postgrest_test;
|
||||
|
||||
CREATE FUNCTION "1".insert_insertable_view_with_join() RETURNS trigger
|
||||
CREATE FUNCTION test.insert_insertable_view_with_join() RETURNS trigger
|
||||
LANGUAGE plpgsql
|
||||
AS $$
|
||||
begin
|
||||
INSERT INTO "1".auto_incrementing_pk (nullable_string, non_nullable_string) VALUES (NEW.nullable_string, NEW.non_nullable_string);
|
||||
INSERT INTO test.auto_incrementing_pk (nullable_string, non_nullable_string) VALUES (NEW.nullable_string, NEW.non_nullable_string);
|
||||
RETURN NEW;
|
||||
end;
|
||||
$$;
|
||||
|
||||
ALTER FUNCTION "1".insert_insertable_view_with_join() OWNER TO postgrest_test;
|
||||
ALTER FUNCTION test.insert_insertable_view_with_join() OWNER TO postgrest_test;
|
||||
|
||||
SET search_path = "1", pg_catalog;
|
||||
SET search_path = test, pg_catalog;
|
||||
|
||||
SET default_tablespace = '';
|
||||
|
||||
@@ -107,7 +107,7 @@ CREATE TABLE authors_only (
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE "1".authors_only OWNER TO postgrest_test_author;
|
||||
ALTER TABLE test.authors_only OWNER TO postgrest_test_author;
|
||||
|
||||
|
||||
CREATE TABLE auto_incrementing_pk (
|
||||
@@ -118,7 +118,7 @@ CREATE TABLE auto_incrementing_pk (
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE "1".auto_incrementing_pk OWNER TO postgrest_test;
|
||||
ALTER TABLE test.auto_incrementing_pk OWNER TO postgrest_test;
|
||||
|
||||
|
||||
CREATE SEQUENCE auto_incrementing_pk_id_seq
|
||||
@@ -129,7 +129,7 @@ CREATE SEQUENCE auto_incrementing_pk_id_seq
|
||||
CACHE 1;
|
||||
|
||||
|
||||
ALTER TABLE "1".auto_incrementing_pk_id_seq OWNER TO postgrest_test;
|
||||
ALTER TABLE test.auto_incrementing_pk_id_seq OWNER TO postgrest_test;
|
||||
|
||||
|
||||
ALTER SEQUENCE auto_incrementing_pk_id_seq OWNED BY auto_incrementing_pk.id;
|
||||
@@ -143,7 +143,7 @@ CREATE TABLE compound_pk (
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE "1".compound_pk OWNER TO postgrest_test;
|
||||
ALTER TABLE test.compound_pk OWNER TO postgrest_test;
|
||||
|
||||
|
||||
CREATE TABLE has_fk (
|
||||
@@ -153,7 +153,7 @@ CREATE TABLE has_fk (
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE "1".has_fk OWNER TO postgrest_test;
|
||||
ALTER TABLE test.has_fk OWNER TO postgrest_test;
|
||||
|
||||
|
||||
CREATE SEQUENCE has_fk_id_seq
|
||||
@@ -164,18 +164,18 @@ CREATE SEQUENCE has_fk_id_seq
|
||||
CACHE 1;
|
||||
|
||||
|
||||
ALTER TABLE "1".has_fk_id_seq OWNER TO postgrest_test;
|
||||
ALTER TABLE test.has_fk_id_seq OWNER TO postgrest_test;
|
||||
|
||||
|
||||
ALTER SEQUENCE has_fk_id_seq OWNED BY has_fk.id;
|
||||
|
||||
CREATE MATERIALIZED VIEW "1".materialized_view AS
|
||||
CREATE MATERIALIZED VIEW test.materialized_view AS
|
||||
SELECT
|
||||
version();
|
||||
|
||||
ALTER TABLE "1".materialized_view OWNER TO postgrest_test;
|
||||
ALTER TABLE test.materialized_view OWNER TO postgrest_test;
|
||||
|
||||
CREATE VIEW "1".insertable_view_with_join AS
|
||||
CREATE VIEW test.insertable_view_with_join AS
|
||||
SELECT has_fk.id,
|
||||
has_fk.auto_inc_fk,
|
||||
has_fk.simple_fk,
|
||||
@@ -186,12 +186,12 @@ CREATE VIEW "1".insertable_view_with_join AS
|
||||
JOIN auto_incrementing_pk USING (id));
|
||||
|
||||
|
||||
ALTER TABLE "1".insertable_view_with_join OWNER TO postgrest_test;
|
||||
ALTER TABLE test.insertable_view_with_join OWNER TO postgrest_test;
|
||||
|
||||
CREATE VIEW "1".has_count_column AS
|
||||
CREATE VIEW test.has_count_column AS
|
||||
SELECT 1 AS count;
|
||||
|
||||
ALTER TABLE "1".insertable_view_with_join OWNER TO postgrest_test;
|
||||
ALTER TABLE test.insertable_view_with_join OWNER TO postgrest_test;
|
||||
|
||||
|
||||
CREATE TABLE items (
|
||||
@@ -199,50 +199,51 @@ CREATE TABLE items (
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE "1".items OWNER TO postgrest_test;
|
||||
ALTER TABLE test.items OWNER TO postgrest_test;
|
||||
|
||||
CREATE TABLE complex_items (
|
||||
id bigint NOT NULL,
|
||||
name text,
|
||||
settings json
|
||||
settings json,
|
||||
arr_data INTEGER[]
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE "1".complex_items OWNER TO postgrest_test;
|
||||
ALTER TABLE test.complex_items OWNER TO postgrest_test;
|
||||
|
||||
--- Structure for testing table relations
|
||||
CREATE TABLE clients(
|
||||
id INT PRIMARY KEY NOT NULL,
|
||||
name TEXT NOT NULL
|
||||
);
|
||||
ALTER TABLE "1".clients OWNER TO postgrest_test;
|
||||
ALTER TABLE test.clients OWNER TO postgrest_test;
|
||||
|
||||
CREATE TABLE projects(
|
||||
id INT PRIMARY KEY NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
client_id INT REFERENCES clients(id)
|
||||
);
|
||||
ALTER TABLE "1".projects OWNER TO postgrest_test;
|
||||
ALTER TABLE test.projects OWNER TO postgrest_test;
|
||||
|
||||
CREATE TABLE tasks(
|
||||
id INT PRIMARY KEY NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
project_id INT REFERENCES projects(id)
|
||||
);
|
||||
ALTER TABLE "1".tasks OWNER TO postgrest_test;
|
||||
ALTER TABLE test.tasks OWNER TO postgrest_test;
|
||||
|
||||
CREATE TABLE users(
|
||||
id INT PRIMARY KEY NOT NULL,
|
||||
name TEXT NOT NULL
|
||||
);
|
||||
ALTER TABLE "1".users OWNER TO postgrest_test;
|
||||
ALTER TABLE test.users OWNER TO postgrest_test;
|
||||
|
||||
CREATE TABLE users_tasks(
|
||||
user_id INT REFERENCES users(id),
|
||||
task_id INT REFERENCES tasks(id),
|
||||
CONSTRAINT task_user PRIMARY KEY (task_id,user_id)
|
||||
);
|
||||
ALTER TABLE "1".users_tasks OWNER TO postgrest_test;
|
||||
ALTER TABLE test.users_tasks OWNER TO postgrest_test;
|
||||
|
||||
CREATE TABLE comments(
|
||||
id INT PRIMARY KEY NOT NULL,
|
||||
@@ -252,31 +253,22 @@ task_id INT NOT NULL,
|
||||
content TEXT NOT NULL,
|
||||
FOREIGN KEY (task_id,user_id) REFERENCES users_tasks (task_id,user_id)
|
||||
);
|
||||
ALTER TABLE "1".comments OWNER TO postgrest_test;
|
||||
ALTER TABLE test.comments OWNER TO postgrest_test;
|
||||
|
||||
CREATE TABLE users_projects(
|
||||
user_id INT REFERENCES users(id),
|
||||
project_id INT REFERENCES projects(id),
|
||||
CONSTRAINT project_user PRIMARY KEY (project_id, user_id)
|
||||
);
|
||||
ALTER TABLE "1".users_projects OWNER TO postgrest_test;
|
||||
ALTER TABLE test.users_projects OWNER TO postgrest_test;
|
||||
|
||||
CREATE VIEW "1".projects_view AS
|
||||
CREATE VIEW test.projects_view AS
|
||||
SELECT
|
||||
projects.id,
|
||||
projects.name,
|
||||
projects.client_id
|
||||
FROM projects;
|
||||
ALTER TABLE "1".projects_view OWNER TO postgrest_test;
|
||||
------- SAMPLE DATA -----
|
||||
INSERT INTO clients VALUES (1, 'Microsoft'),(2, 'Apple');
|
||||
INSERT INTO projects VALUES (1,'Windows 7', 1),(2,'Windows 10', 1),(3,'IOS', 2),(4,'OSX', 2);
|
||||
INSERT INTO tasks VALUES (1,'Design w7',1),(2,'Code w7',1),(3,'Design w10',2),(4,'Code w10',2),(5,'Design IOS',3),(6,'Code IOS',3),(7,'Design OSX',4),(8,'Code OSX',4);
|
||||
INSERT INTO users VALUES (1, 'Angela Martin'),(2, 'Michael Scott'),(3, 'Dwight Schrute');
|
||||
INSERT INTO users_projects VALUES(1,1),(1,2),(2,3),(2,4),(3,1),(3,3);
|
||||
INSERT INTO users_tasks VALUES(1,1),(1,2),(1,3),(1,4),(2,5),(2,6),(2,7),(3,1),(3,5);
|
||||
INSERT INTO comments VALUES (1, 1, 2, 6, 'Needs to be delivered ASAP');
|
||||
----------------
|
||||
ALTER TABLE test.projects_view OWNER TO postgrest_test;
|
||||
|
||||
CREATE SEQUENCE items_id_seq
|
||||
START WITH 1
|
||||
@@ -286,27 +278,36 @@ CREATE SEQUENCE items_id_seq
|
||||
CACHE 1;
|
||||
|
||||
|
||||
ALTER TABLE "1".items_id_seq OWNER TO postgrest_test;
|
||||
ALTER TABLE test.items_id_seq OWNER TO postgrest_test;
|
||||
|
||||
|
||||
ALTER SEQUENCE items_id_seq OWNED BY items.id;
|
||||
|
||||
|
||||
|
||||
CREATE FUNCTION "1".getitemrange(min bigint, max bigint) RETURNS SETOF "1".items AS $$
|
||||
SELECT * FROM "1".items WHERE id > $1 AND id <= $2;
|
||||
CREATE FUNCTION test.getitemrange(min bigint, max bigint) RETURNS SETOF test.items AS $$
|
||||
SELECT * FROM test.items WHERE id > $1 AND id <= $2;
|
||||
$$ LANGUAGE SQL;
|
||||
|
||||
CREATE FUNCTION "1".test_empty_rowset() RETURNS SETOF int AS $$
|
||||
CREATE FUNCTION test_empty_rowset() RETURNS SETOF int AS $$
|
||||
SELECT null::int FROM (SELECT 1) a WHERE false;
|
||||
$$ LANGUAGE SQL;
|
||||
|
||||
CREATE FUNCTION "1".sayhello(name text) RETURNS text AS $$
|
||||
CREATE TYPE public.jwt_claims AS (role text, id text);
|
||||
|
||||
CREATE FUNCTION test.login(id text, pass text)
|
||||
RETURNS public.jwt_claims
|
||||
SECURITY DEFINER
|
||||
AS $$
|
||||
SELECT rolname::text, id::text FROM postgrest.auth WHERE id = id AND pass = pass;
|
||||
$$ LANGUAGE SQL;
|
||||
|
||||
CREATE FUNCTION test.sayhello(name text) RETURNS text AS $$
|
||||
SELECT 'Hello, ' || $1;
|
||||
$$ LANGUAGE SQL;
|
||||
|
||||
|
||||
CREATE FUNCTION "1".problem() RETURNS void LANGUAGE plpgsql AS
|
||||
CREATE FUNCTION test.problem() RETURNS void LANGUAGE plpgsql AS
|
||||
$$
|
||||
BEGIN
|
||||
RAISE 'bad thing';
|
||||
@@ -325,7 +326,7 @@ CREATE TABLE menagerie (
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE "1".menagerie OWNER TO postgrest_test;
|
||||
ALTER TABLE test.menagerie OWNER TO postgrest_test;
|
||||
|
||||
|
||||
CREATE TABLE no_pk (
|
||||
@@ -334,7 +335,7 @@ CREATE TABLE no_pk (
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE "1".no_pk OWNER TO postgrest_test;
|
||||
ALTER TABLE test.no_pk OWNER TO postgrest_test;
|
||||
|
||||
|
||||
CREATE TABLE nullable_integer (
|
||||
@@ -342,7 +343,7 @@ CREATE TABLE nullable_integer (
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE "1".nullable_integer OWNER TO postgrest_test;
|
||||
ALTER TABLE test.nullable_integer OWNER TO postgrest_test;
|
||||
|
||||
|
||||
CREATE TABLE simple_pk (
|
||||
@@ -351,7 +352,7 @@ CREATE TABLE simple_pk (
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE "1".simple_pk OWNER TO postgrest_test;
|
||||
ALTER TABLE test.simple_pk OWNER TO postgrest_test;
|
||||
|
||||
|
||||
CREATE TABLE json
|
||||
@@ -360,14 +361,14 @@ CREATE TABLE json
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE "1".json OWNER TO postgrest_test;
|
||||
ALTER TABLE test.json OWNER TO postgrest_test;
|
||||
|
||||
|
||||
CREATE TABLE tsearch (
|
||||
text_search_vector tsvector
|
||||
);
|
||||
|
||||
ALTER TABLE "1".tsearch OWNER TO postgrest_test;
|
||||
ALTER TABLE test.tsearch OWNER TO postgrest_test;
|
||||
|
||||
SET search_path = postgrest, pg_catalog;
|
||||
|
||||
@@ -385,8 +386,8 @@ SET search_path = private, pg_catalog;
|
||||
|
||||
|
||||
CREATE TABLE articles (
|
||||
id integer PRIMARY KEY NOT NULL,
|
||||
body text,
|
||||
id integer NOT NULL,
|
||||
owner name NOT NULL
|
||||
);
|
||||
|
||||
@@ -394,22 +395,32 @@ CREATE TABLE articles (
|
||||
ALTER TABLE private.articles OWNER TO postgrest_test;
|
||||
|
||||
|
||||
CREATE SEQUENCE articles_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
CREATE TABLE article_stars (
|
||||
article_id int REFERENCES articles(id),
|
||||
user_id int REFERENCES test.users(id),
|
||||
created_at timestamp NOT NULL DEFAULT now(),
|
||||
CONSTRAINT user_article PRIMARY KEY (article_id, user_id)
|
||||
);
|
||||
|
||||
ALTER TABLE private.article_stars OWNER TO postgrest_test;
|
||||
|
||||
|
||||
ALTER TABLE private.articles_id_seq OWNER TO postgrest_test;
|
||||
|
||||
SET search_path = test, pg_catalog;
|
||||
|
||||
|
||||
ALTER SEQUENCE articles_id_seq OWNED BY articles.id;
|
||||
|
||||
CREATE VIEW "articleStars" AS
|
||||
SELECT article_id AS "articleId", user_id AS "userId", created_at AS "createdAt"
|
||||
FROM private.article_stars;
|
||||
|
||||
SET search_path = "1", pg_catalog;
|
||||
ALTER TABLE test."articleStars" OWNER TO postgrest_test;
|
||||
|
||||
CREATE VIEW articles AS
|
||||
SELECT *
|
||||
FROM private.articles;
|
||||
|
||||
ALTER TABLE test.articles OWNER TO postgrest_test;
|
||||
|
||||
ALTER TABLE ONLY auto_incrementing_pk ALTER COLUMN id SET DEFAULT nextval('auto_incrementing_pk_id_seq'::regclass);
|
||||
|
||||
@@ -417,36 +428,10 @@ ALTER TABLE ONLY auto_incrementing_pk ALTER COLUMN id SET DEFAULT nextval('auto_
|
||||
|
||||
ALTER TABLE ONLY has_fk ALTER COLUMN id SET DEFAULT nextval('has_fk_id_seq'::regclass);
|
||||
|
||||
|
||||
|
||||
ALTER TABLE ONLY items ALTER COLUMN id SET DEFAULT nextval('items_id_seq'::regclass);
|
||||
|
||||
|
||||
SET search_path = private, pg_catalog;
|
||||
|
||||
|
||||
ALTER TABLE ONLY articles ALTER COLUMN id SET DEFAULT nextval('articles_id_seq'::regclass);
|
||||
|
||||
|
||||
SET search_path = "1", pg_catalog;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
SELECT pg_catalog.setval('auto_incrementing_pk_id_seq', 1, true);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
SELECT pg_catalog.setval('has_fk_id_seq', 1, false);
|
||||
|
||||
|
||||
@@ -469,24 +454,20 @@ SET search_path = private, pg_catalog;
|
||||
|
||||
|
||||
|
||||
SET search_path = test, pg_catalog;
|
||||
|
||||
SELECT pg_catalog.setval('articles_id_seq', 1, false);
|
||||
|
||||
|
||||
SET search_path = "1", pg_catalog;
|
||||
|
||||
CREATE FUNCTION public.always_true("1".items) RETURNS boolean
|
||||
CREATE FUNCTION public.always_true(test.items) RETURNS boolean
|
||||
LANGUAGE sql STABLE
|
||||
AS $$ SELECT true $$;
|
||||
|
||||
ALTER FUNCTION public.always_true("1".items) OWNER TO postgrest_test;
|
||||
ALTER FUNCTION public.always_true(test.items) OWNER TO postgrest_test;
|
||||
|
||||
|
||||
|
||||
ALTER TABLE ONLY authors_only
|
||||
ADD CONSTRAINT authors_only_pkey PRIMARY KEY (secret);
|
||||
|
||||
CREATE TRIGGER insert_insertable_view_with_join INSTEAD OF INSERT ON "1".insertable_view_with_join FOR EACH ROW EXECUTE PROCEDURE "1".insert_insertable_view_with_join();
|
||||
CREATE TRIGGER insert_insertable_view_with_join INSTEAD OF INSERT ON test.insertable_view_with_join FOR EACH ROW EXECUTE PROCEDURE test.insert_insertable_view_with_join();
|
||||
|
||||
|
||||
CREATE TRIGGER secrets_owner_track BEFORE INSERT OR UPDATE ON authors_only FOR EACH ROW EXECUTE PROCEDURE postgrest.set_authors_only_owner();
|
||||
@@ -533,10 +514,6 @@ ALTER TABLE ONLY auth
|
||||
SET search_path = private, pg_catalog;
|
||||
|
||||
|
||||
ALTER TABLE ONLY articles
|
||||
ADD CONSTRAINT articles_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
SET search_path = postgrest, pg_catalog;
|
||||
|
||||
|
||||
@@ -549,7 +526,7 @@ SET search_path = private, pg_catalog;
|
||||
CREATE TRIGGER articles_owner_track BEFORE INSERT OR UPDATE ON articles FOR EACH ROW EXECUTE PROCEDURE postgrest.update_owner();
|
||||
|
||||
|
||||
SET search_path = "1", pg_catalog;
|
||||
SET search_path = test, pg_catalog;
|
||||
|
||||
|
||||
ALTER TABLE ONLY has_fk
|
||||
@@ -562,11 +539,11 @@ ALTER TABLE ONLY has_fk
|
||||
|
||||
|
||||
|
||||
REVOKE ALL ON SCHEMA "1" FROM PUBLIC;
|
||||
REVOKE ALL ON SCHEMA "1" FROM postgrest_test;
|
||||
GRANT ALL ON SCHEMA "1" TO postgrest_test;
|
||||
GRANT USAGE ON SCHEMA "1" TO postgrest_anonymous;
|
||||
GRANT USAGE ON SCHEMA "1" TO postgrest_test_author;
|
||||
REVOKE ALL ON SCHEMA test FROM PUBLIC;
|
||||
REVOKE ALL ON SCHEMA test FROM postgrest_test;
|
||||
GRANT ALL ON SCHEMA test TO postgrest_test;
|
||||
GRANT USAGE ON SCHEMA test TO postgrest_anonymous;
|
||||
GRANT USAGE ON SCHEMA test TO postgrest_test_author;
|
||||
|
||||
|
||||
|
||||
@@ -657,6 +634,14 @@ REVOKE ALL ON TABLE projects_view FROM PUBLIC;
|
||||
REVOKE ALL ON TABLE projects_view FROM postgrest_test;
|
||||
GRANT ALL ON TABLE projects_view TO postgrest_test;
|
||||
GRANT ALL ON TABLE projects_view TO postgrest_anonymous;
|
||||
REVOKE ALL ON TABLE articles FROM PUBLIC;
|
||||
REVOKE ALL ON TABLE articles FROM postgrest_test;
|
||||
GRANT ALL ON TABLE articles TO postgrest_test;
|
||||
GRANT ALL ON TABLE articles TO postgrest_anonymous;
|
||||
REVOKE ALL ON TABLE "articleStars" FROM PUBLIC;
|
||||
REVOKE ALL ON TABLE "articleStars" FROM postgrest_test;
|
||||
GRANT ALL ON TABLE "articleStars" TO postgrest_test;
|
||||
GRANT ALL ON TABLE "articleStars" TO postgrest_anonymous;
|
||||
---------
|
||||
|
||||
|
||||
@@ -670,6 +655,11 @@ REVOKE ALL ON FUNCTION test_empty_rowset() FROM postgrest_test;
|
||||
GRANT EXECUTE ON FUNCTION test_empty_rowset() TO postgrest_test;
|
||||
GRANT EXECUTE ON FUNCTION test_empty_rowset() TO postgrest_anonymous;
|
||||
|
||||
REVOKE ALL ON FUNCTION login(text, text) FROM PUBLIC;
|
||||
REVOKE ALL ON FUNCTION login(text, text) FROM postgrest_test;
|
||||
GRANT EXECUTE ON FUNCTION login(text, text) TO postgrest_test;
|
||||
GRANT EXECUTE ON FUNCTION login(text, text) TO postgrest_anonymous;
|
||||
|
||||
REVOKE ALL ON FUNCTION sayhello(text) FROM PUBLIC;
|
||||
REVOKE ALL ON FUNCTION sayhello(text) FROM postgrest_test;
|
||||
GRANT EXECUTE ON FUNCTION sayhello(text) TO postgrest_test;
|
||||
@@ -743,10 +733,10 @@ REVOKE ALL ON TABLE has_count_column FROM postgrest_test;
|
||||
GRANT ALL ON TABLE has_count_column TO postgrest_test;
|
||||
GRANT ALL ON TABLE has_count_column TO postgrest_anonymous;
|
||||
|
||||
REVOKE ALL ON FUNCTION public.always_true("1".items) FROM PUBLIC;
|
||||
REVOKE ALL ON FUNCTION public.always_true("1".items) FROM postgrest_test;
|
||||
GRANT ALL ON FUNCTION public.always_true("1".items) TO postgrest_test;
|
||||
GRANT ALL ON FUNCTION public.always_true("1".items) TO postgrest_anonymous;
|
||||
REVOKE ALL ON FUNCTION public.always_true(test.items) FROM PUBLIC;
|
||||
REVOKE ALL ON FUNCTION public.always_true(test.items) FROM postgrest_test;
|
||||
GRANT ALL ON FUNCTION public.always_true(test.items) TO postgrest_test;
|
||||
GRANT ALL ON FUNCTION public.always_true(test.items) TO postgrest_anonymous;
|
||||
|
||||
|
||||
SET search_path = postgrest, pg_catalog;
|
||||
@@ -764,3 +754,18 @@ SET search_path = private, pg_catalog;
|
||||
REVOKE ALL ON TABLE articles FROM PUBLIC;
|
||||
REVOKE ALL ON TABLE articles FROM postgrest_test;
|
||||
GRANT ALL ON TABLE articles TO postgrest_test;
|
||||
|
||||
SET search_path = test, private, postgrest, public, pg_catalog;
|
||||
|
||||
------- SAMPLE DATA -----
|
||||
INSERT INTO clients VALUES (1, 'Microsoft'),(2, 'Apple');
|
||||
INSERT INTO projects VALUES (1,'Windows 7', 1),(2,'Windows 10', 1),(3,'IOS', 2),(4,'OSX', 2);
|
||||
INSERT INTO tasks VALUES (1,'Design w7',1),(2,'Code w7',1),(3,'Design w10',2),(4,'Code w10',2),(5,'Design IOS',3),(6,'Code IOS',3),(7,'Design OSX',4),(8,'Code OSX',4);
|
||||
INSERT INTO users VALUES (1, 'Angela Martin'),(2, 'Michael Scott'),(3, 'Dwight Schrute');
|
||||
INSERT INTO users_projects VALUES(1,1),(1,2),(2,3),(2,4),(3,1),(3,3);
|
||||
INSERT INTO users_tasks VALUES(1,1),(1,2),(1,3),(1,4),(2,5),(2,6),(2,7),(3,1),(3,5);
|
||||
INSERT INTO comments VALUES (1, 1, 2, 6, 'Needs to be delivered ASAP');
|
||||
INSERT INTO postgrest.auth (id, pass, rolname) VALUES ('jdoe', '1234', 'postgrest_test_author');
|
||||
INSERT INTO private.articles (id, body, owner) VALUES (1, 'No… It''s a thing; it''s like a plan, but with more greatness.', 2), (2, 'Stop talking, brain thinking. Hush.', 3), (3, 'It''s a fez. I wear a fez now. Fezes are cool.', 1);
|
||||
INSERT INTO private.article_stars (article_id, user_id) VALUES (1,1), (1,2), (2,3), (3,2), (1,3);
|
||||
----------------
|
||||
|
||||
Reference in New Issue
Block a user