CREATETABLE t3 (s int, t text);
SECURITY LABELONTABLE t3 IS'system_u:object_r:sepgsql_fixed_table_t:s0'; INSERTINTO t3 VALUES (1, 'sss'), (2, 'ttt'), (3, 'uuu');
CREATETABLE t5 (e text, f text, g text);
SECURITY LABELONTABLE t5 IS'system_u:object_r:sepgsql_table_t:s0';
SECURITY LABELONCOLUMN t5.e IS'system_u:object_r:sepgsql_table_t:s0';
SECURITY LABELONCOLUMN t5.f IS'system_u:object_r:sepgsql_ro_table_t:s0';
SECURITY LABELONCOLUMN t5.g IS'system_u:object_r:sepgsql_secret_table_t:s0';
--- -- partitioned table parent CREATETABLE t1p (o int, p text, q text) PARTITION BY RANGE (o);
SECURITY LABELONTABLE t1p IS'system_u:object_r:sepgsql_table_t:s0';
SECURITY LABELONCOLUMN t1p.o IS'system_u:object_r:sepgsql_table_t:s0';
SECURITY LABELONCOLUMN t1p.p IS'system_u:object_r:sepgsql_ro_table_t:s0';
SECURITY LABELONCOLUMN t1p.q IS'system_u:object_r:sepgsql_secret_table_t:s0';
-- partitioned table children CREATETABLE t1p_ones PARTITION OF t1p FORVALUESFROM ('0') TO ('10');
SECURITY LABELONCOLUMN t1p_ones.o IS'system_u:object_r:sepgsql_table_t:s0';
SECURITY LABELONCOLUMN t1p_ones.p IS'system_u:object_r:sepgsql_ro_table_t:s0';
SECURITY LABELONCOLUMN t1p_ones.q IS'system_u:object_r:sepgsql_secret_table_t:s0'; CREATETABLE t1p_tens PARTITION OF t1p FORVALUESFROM ('10') TO ('100');
SECURITY LABELONCOLUMN t1p_tens.o IS'system_u:object_r:sepgsql_table_t:s0';
SECURITY LABELONCOLUMN t1p_tens.p IS'system_u:object_r:sepgsql_ro_table_t:s0';
SECURITY LABELONCOLUMN t1p_tens.q IS'system_u:object_r:sepgsql_secret_table_t:s0';
---
CREATETABLE customer (cid intprimarykey, cname text, ccredit text);
SECURITY LABELONCOLUMN customer.ccredit IS'system_u:object_r:sepgsql_secret_table_t:s0'; INSERTINTO customer VALUES (1, 'Taro', '1111-2222-3333-4444'),
(2, 'Hanako', '5555-6666-7777-8888'); CREATE FUNCTION customer_credit(int) RETURNS text AS'SELECT regexp_replace(ccredit, ''-[0-9]+$'', ''-????'') FROM customer WHERE cid = $1'
LANGUAGE sql;
SECURITY LABELON FUNCTION customer_credit(int) IS'system_u:object_r:sepgsql_trusted_proc_exec_t:s0';
SELECT objtype, objname, labelFROM pg_seclabels WHERE provider = 'selinux' AND objtype in ('table', 'column') AND objname in ('t1', 't2', 't3', 't4', 't5', 't5.e', 't5.f', 't5.g', 't1p', 't1p.o', 't1p.p', 't1p.q', 't1p_ones', 't1p_ones.o', 't1p_ones.p', 't1p_ones.q', 't1p_tens', 't1p_tens.o', 't1p_tens.p', 't1p_tens.q') ORDERBY objname COLLATE"C";
CREATESCHEMA my_schema_1; CREATETABLE my_schema_1.ts1 (a int, b text); CREATETABLE my_schema_1.pts1 (o int, p text) PARTITION BY RANGE (o); CREATETABLE my_schema_1.pts1_ones PARTITION OF my_schema_1.pts1 FORVALUESFROM ('0') to ('10');
CREATESCHEMA my_schema_2; CREATETABLE my_schema_2.ts2 (x int, y text); CREATETABLE my_schema_2.pts2 (o int, p text) PARTITION BY RANGE (o); CREATETABLE my_schema_2.pts2_tens PARTITION OF my_schema_2.pts2 FORVALUESFROM ('10') to('100');
SELECT * FROM t1; -- ok SELECT * FROM t2; -- ok SELECT * FROM t3; -- ok SELECT * FROM t4; -- failed SELECT * FROM t5; -- failed SELECT e,f FROM t5; -- ok SELECT (t1.*)::record FROM t1; -- ok SELECT (t4.*)::record FROM t4; -- failed
--- -- partitioned table parent SELECT * FROM t1p; -- failed SELECT o,p FROM t1p; -- ok --partitioned table children SELECT * FROM t1p_ones; -- failed SELECT o FROM t1p_ones; -- ok SELECT o,p FROM t1p_ones; -- ok SELECT * FROM t1p_tens; -- failed SELECT o FROM t1p_tens; -- ok SELECT o,p FROM t1p_tens; -- ok ---
SELECT * FROM customer; -- failed SELECT cid, cname, customer_credit(cid) FROM customer; -- ok
SELECT count(*) FROM t5; -- ok SELECT count(*) FROM t5 WHERE g ISNULL; -- failed
--- -- partitioned table parent SELECT count(*) FROM t1p; -- ok SELECT count(*) FROM t1p WHERE q ISNULL; -- failed -- partitioned table children SELECT count(*) FROM t1p_ones; -- ok SELECT count(*) FROM t1p_ones WHERE q ISNULL; -- failed SELECT count(*) FROM t1p_tens; -- ok SELECT count(*) FROM t1p_tens WHERE q ISNULL; -- failed ---
UPDATE t1 SET b = b || '_upd'; -- ok UPDATE t2 SET y = y || '_upd'; -- failed UPDATE t3 SET t = t || '_upd'; -- failed UPDATE t4 SET n = n || '_upd'; -- failed UPDATE t5 SET e = 'xyz'; -- ok UPDATE t5 SET e = f || '_upd'; -- ok UPDATE t5 SET e = g || '_upd'; -- failed
--- -- partitioned table parent UPDATE t1p SET o = 9WHERE o < 10; -- ok UPDATE t1p SET o = 99WHERE o >= 10; -- ok UPDATE t1p SET o = ascii(COALESCE(p,'upd'))%10WHERE o < 10; -- ok UPDATE t1p SET o = ascii(COALESCE(q,'upd'))%100WHERE o >= 10; -- failed -- partitioned table children UPDATE t1p_ones SET o = 9; -- ok UPDATE t1p_ones SET o = ascii(COALESCE(p,'upd'))%10; -- ok UPDATE t1p_ones SET o = ascii(COALESCE(q,'upd'))%10; -- failed UPDATE t1p_tens SET o = 99; -- ok UPDATE t1p_tens SET o = ascii(COALESCE(p,'upd'))%100; -- ok UPDATE t1p_tens SET o = ascii(COALESCE(q,'upd'))%100; -- failed ---
DELETEFROM t1; -- ok DELETEFROM t2; -- failed DELETEFROM t3; -- failed DELETEFROM t4; -- failed DELETEFROM t5; -- ok DELETEFROM t5 WHERE f ISNULL; -- ok DELETEFROM t5 WHERE g ISNULL; -- failed
--- -- partitioned table parent DELETEFROM t1p; -- ok DELETEFROM t1p WHERE p ISNULL; -- ok DELETEFROM t1p WHERE q ISNULL; -- failed -- partitioned table children DELETEFROM t1p_ones WHERE p ISNULL; -- ok DELETEFROM t1p_ones WHERE q ISNULL; -- failed; DELETEFROM t1p_tens WHERE p ISNULL; -- ok DELETEFROM t1p_tens WHERE q ISNULL; -- failed ---
-- -- COPY TO/FROM statements --
COPY t1 TO'/dev/null'; -- ok
COPY t2 TO'/dev/null'; -- ok
COPY t3 TO'/dev/null'; -- ok
COPY t4 TO'/dev/null'; -- failed
COPY t5 TO'/dev/null'; -- failed
COPY t5(e,f) TO'/dev/null'; -- ok
--- -- partitioned table parent
COPY (SELECT * FROM t1p) TO'/dev/null'; -- failed
COPY (SELECT (o,p) FROM t1p) TO'/dev/null'; -- ok -- partitioned table children
COPY t1p_ones TO'/dev/null'; -- failed
COPY t1p_ones(o,p) TO'/dev/null'; -- ok
COPY t1p_tens TO'/dev/null'; -- failed
COPY t1p_tens(o,p) TO'/dev/null'; -- ok ---
COPY t1 FROM'/dev/null'; -- ok
COPY t2 FROM'/dev/null'; -- failed
COPY t3 FROM'/dev/null'; -- ok
COPY t4 FROM'/dev/null'; -- failed
COPY t5 FROM'/dev/null'; -- failed
COPY t5 (e,f) FROM'/dev/null'; -- failed
COPY t5 (e) FROM'/dev/null'; -- ok
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.