{"id":270402,"date":"2015-12-15T15:21:02","date_gmt":"2015-12-15T12:21:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=270402"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=270402","title":{"rendered":"\u041a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 PostgreSQL security_barrier \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f"},"content":{"rendered":"<p>       \u0412\u044b \u043c\u043e\u0433\u043b\u0438 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0432 PostgreSQL 9.2 \u0431\u044b\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0434\u043b\u044f security_barrier \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439. \u042f \u0441\u043c\u043e\u0442\u0440\u0435\u043b \u0432 \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0441 \u043f\u0440\u0438\u0446\u0435\u043b\u043e\u043c \u043d\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043d\u0438\u0445, \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u044e\u0449\u0435\u0439\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e \u0437\u0430\u0449\u0438\u0442\u0435 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0441\u0442\u0440\u043e\u043a \u0434\u043b\u044f <a href=\"http:\/\/axleproject.eu\/\">\u043f\u0440\u043e\u0435\u043a\u0442\u0430 AXLE<\/a>, \u0438 \u044f \u043f\u043e\u0434\u0443\u043c\u0430\u043b \u0447\u0442\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u044e \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c \u043a\u0430\u043a \u043e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442. <\/p>\n<p>  \u0420\u043e\u0431\u0435\u0440\u0442 \u0443\u0436\u0435 <a href=\"http:\/\/rhaas.blogspot.com.au\/2012\/03\/security-barrier-views.html\">\u043e\u0431\u044a\u044f\u0441\u043d\u0438\u043b <\/a>\u0432 \u0447\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u0430 \u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439 \u0438 \u043e\u0442 \u0447\u0435\u0433\u043e \u043e\u043d\u0438 \u0437\u0430\u0449\u0438\u0449\u0430\u044e\u0442 (\u043a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u044d\u0442\u043e \u0435\u0449\u0435 \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u043b\u043e\u0441\u044c \u0432 &quot;<a href=\"http:\/\/wiki.postgresql.org\/wiki\/What&#39;s_new_in_PostgreSQL_9.2#Security_barriers_and_Leakproof\">\u0427\u0442\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0432 PostgreSQL 9.2<\/a>&quot;). \u0421\u0435\u0439\u0447\u0430\u0441 \u0436\u0435 \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0442\u043e\u043c\u0443, <i>\u043a\u0430\u043a <\/i>\u043e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0438 \u043e\u0431\u0441\u0443\u0434\u0438\u0442\u044c \u043a\u0430\u043a security_barrier \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442 \u0441 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c\u044b\u043c\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438. <br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4><b>\u041e\u0431\u044b\u0447\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f<\/b><\/h4>\n<p>  \u041f\u0440\u043e\u0441\u0442\u043e\u0435 \u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043e \u0432 \u043c\u0430\u043a\u0440\u043e\u0441\u043d\u043e\u043c \u0432\u0438\u0434\u0435 \u043a\u0430\u043a \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u043e\u0442\u043e\u043c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u0443\u0442\u0435\u043c \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u0430 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u0432 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0433\u043e\u0441\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u0430. \u0414\u0430\u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0430:<\/p>\n<pre><code class=\"sql\">CREATE TABLE t AS SELECT n, 'secret'||n AS secret FROM generate_series(1,20) n; <\/code><\/pre>\n<p>  \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"sql\">CREATE VIEW t_odd AS SELECT n, secret FROM t WHERE n % 2 = 1; <\/code><\/pre>\n<p>  \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u0438\u0434\u0430:<\/p>\n<pre><code class=\"sql\">SELECT * FROM t_odd WHERE n &lt; 4 <\/code><\/pre>\n<p>  \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d \u0432\u043d\u0443\u0442\u0440\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u0438\u0434:<\/p>\n<pre><code class=\"sql\">SELECT * FROM (SELECT * FROM t WHERE n % 2 = 1) t_odd WHERE n &lt; 4 <\/code><\/pre>\n<p>  \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440 \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0439 \u0440\u0430\u0437\u043e\u043c, \u0432\u044b\u043d\u043e\u0441\u044f \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441 \u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u044f WHERE \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441:<\/p>\n<pre><code class=\"sql\">SELECT * FROM t t_odd WHERE (n % 2 = 1) AND (n &lt; 4) <\/code><\/pre>\n<p>  \u0412\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043c\u0433\u043d\u043e\u0432\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0438 \u043e\u043d\u0438 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e \u0432 \u0432\u0438\u0434\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e SQL, \u043d\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u044d\u0442\u043e\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u0432\u043a\u043b\u044e\u0447\u0438\u0432 <i>debug_print_parse = on<\/i>, <i>debug_print_rewritten = on<\/i> \u0438 <i>debug_print_plan = on<\/i> \u0432 postgresql.conf. \u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0437\u0434\u0435\u0441\u044c \u0434\u0435\u0440\u0435\u0432\u044c\u044f \u0440\u0430\u0437\u0431\u043e\u0440\u0430 \u0438 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0438 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0433\u0440\u043e\u043c\u043e\u0437\u0434\u043a\u0438\u0435 \u0438 \u0438\u0445 \u043b\u0435\u0433\u043a\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043e\u043f\u0438\u0440\u0430\u044f\u0441\u044c \u043d\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0435 \u0432\u044b\u0448\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b.<\/p>\n<h4><b>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438<\/b><\/h4>\n<p>  \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u0443-\u0442\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044e, \u0431\u0435\u0437 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0441\u0430\u043c\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0438\u043c \u0432\u0438\u0434\u0435\u0442\u044c \u0447\u0435\u0442\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438. \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u044d\u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0434\u0430:<\/p>\n<pre><code class=\"sql\">regress=&gt; SELECT * FROM t_odd WHERE n &lt; 4;  n | secret   ---+---------  1 | secret1  3 | secret3 (2 rows) <\/code><\/pre>\n<p>  \u043d\u043e \u043a\u043e\u0433\u0434\u0430 \u0432\u044b \u0437\u0430\u0433\u043b\u044f\u043d\u0435\u0442\u0435 \u0432 \u043f\u043b\u0430\u043d, \u0442\u043e \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443:<\/p>\n<pre><code class=\"sql\">regress=&gt; EXPLAIN SELECT * FROM t_odd WHERE n &lt; 4;                     QUERY PLAN                      ---------------------------------------------------  Seq Scan on t  (cost=0.00..31.53 rows=2 width=36)    Filter: ((n &lt; 4) AND ((n % 2) = 1)) (2 rows) <\/code><\/pre>\n<p>  \u041f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0431\u044b\u043b \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d \u0438 \u0435\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0438 \u0431\u044b\u043b\u0438 \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u044b \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441.<\/p>\n<p>  \u0412 SQL, AND \u0438 OR \u043d\u0435 \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u044b. \u041e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440\/\u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c \u0438\u043c\u0435\u0435\u0442 \u043f\u043e\u043b\u043d\u0443\u044e \u0441\u0432\u043e\u0431\u043e\u0434\u0443 \u0432 \u0432\u044b\u0431\u043e\u0440\u0435 \u0432\u0435\u0442\u043a\u0438 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043e\u043d\u0438 \u0441\u0447\u0438\u0442\u0430\u044e\u0442 \u0431\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440\u043e\u0439 \u0432 \u043f\u043b\u0430\u043d\u0435 \u0432\u044b\u0434\u0430\u0447\u0438 \u043e\u0442\u0432\u0435\u0442\u0430 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0438\u043c \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u0432\u0435\u0442\u043e\u043a. \u0422.\u0435. \u0435\u0441\u043b\u0438 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u0441\u0447\u0438\u0442\u0430\u0435\u0442, \u0447\u0442\u043e <b><i>n &lt; 4<\/i><\/b> \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c <b><i>n % 2<\/i><\/b>, \u043e\u043d \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442 \u0435\u0433\u043e \u043f\u0435\u0440\u0432\u044b\u043c. \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0431\u0435\u0437\u0432\u0440\u0435\u0434\u043d\u043e, \u0432\u0435\u0440\u043d\u043e? \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435:<\/p>\n<pre><code class=\"sql\">regress=&gt; CREATE OR REPLACE FUNCTION f_leak(text) RETURNS boolean AS $$ BEGIN   RAISE NOTICE 'Secret is: %',$1;   RETURN true; END; $$ COST 1 LANGUAGE plpgsql;  regress=&gt; SELECT * FROM t_odd WHERE f_leak(secret) AND n &lt; 4; NOTICE:  Secret is: secret1 NOTICE:  Secret is: secret2 NOTICE:  Secret is: secret3 NOTICE:  Secret is: secret4 NOTICE:  Secret is: secret5 NOTICE:  Secret is: secret6 NOTICE:  Secret is: secret7 NOTICE:  Secret is: secret8 NOTICE:  Secret is: secret9 NOTICE:  Secret is: secret10 NOTICE:  Secret is: secret11 NOTICE:  Secret is: secret12 NOTICE:  Secret is: secret13 NOTICE:  Secret is: secret14 NOTICE:  Secret is: secret15 NOTICE:  Secret is: secret16 NOTICE:  Secret is: secret17 NOTICE:  Secret is: secret18 NOTICE:  Secret is: secret19 NOTICE:  Secret is: secret20  n | secret   ---+---------  1 | secret1  3 | secret3 (2 rows)  regress=&gt; EXPLAIN SELECT * FROM t_odd WHERE f_leak(secret) AND n &lt; 4;                         QUERY PLAN                         ----------------------------------------------------------  Seq Scan on t  (cost=0.00..34.60 rows=1 width=36)    Filter: (f_leak(secret) AND (n &lt; 4) AND ((n % 2) = 1)) (2 rows) <\/code><\/pre>\n<p>  \u0423\u043f\u0441! \u041a\u0430\u043a \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0438\u0434\u0435\u0442\u044c, \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441 \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442\u043e\u043c, \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c, \u0441\u0447\u0438\u0442\u0430\u043b\u0430\u0441\u044c \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0448\u0435\u0432\u043e\u0439 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0447\u0435\u043c \u0434\u0440\u0443\u0433\u0438\u0435 \u0442\u0435\u0441\u0442\u044b, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d\u0430 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043b\u0430 \u0432\u0441\u0435 \u0441\u0442\u0440\u043e\u043a\u0438, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u043b \u043d\u0435\u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0435. \u0412\u0440\u0435\u0434\u043e\u043d\u043e\u0441\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u0442 \u0436\u0435 \u0442\u0440\u044e\u043a, \u0447\u0442\u043e\u0431\u044b \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438.<\/p>\n<h4><b>\u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f security_barrier <\/b><\/h4>\n<p>  \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f security_barrier \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0442 \u044d\u0442\u043e, \u0437\u0430\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u043b\u044e\u0431\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u044b. \u0412\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438 \u0432\u044b\u043d\u043e\u0441\u0438\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441, \u043e\u043d\u0438 \u0437\u0430\u043c\u0435\u043d\u044f\u044e\u0442 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c. \u042d\u0442\u043e\u0442 \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441 \u0438\u043c\u0435\u0435\u0442 \u0444\u043b\u0430\u0433 security_barrier \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u043c \u043d\u0430 \u0432\u0441\u0435\u043c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435 \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440\u0443 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0435\u043c\u0443 \u043d\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0442\u0440\u043e\u0433\u0430\u0442\u044c \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441, \u0438\u043b\u0438 \u0432\u044b\u043d\u043e\u0441\u0438\u0442\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u0438\u0437 \u043d\u0435\u0433\u043e, \u043a\u0430\u043a \u043e\u043d \u0441\u0434\u0435\u043b\u0430\u043b \u0431\u044b \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435.<\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441 \u0437\u0430\u0449\u0438\u0442\u043d\u044b\u043c \u0431\u0430\u0440\u044c\u0435\u0440\u043e\u043c:<\/p>\n<pre><code class=\"sql\">CREATE VIEW t_odd_sb WITH (security_barrier) AS SELECT n, secret FROM t WHERE n % 2 = 1; <\/code><\/pre>\n<p>  \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c:<\/p>\n<pre><code class=\"sql\">regress=&gt; SELECT * FROM t_odd_sb WHERE f_leak(secret) AND n &lt; 4; NOTICE:  Secret is: secret1 NOTICE:  Secret is: secret3  n | secret   ---+---------  1 | secret1  3 | secret3 (2 rows)  regress=&gt; EXPLAIN SELECT * FROM t_odd_sb WHERE f_leak(secret) AND n &lt; 4;                           QUERY PLAN                            ---------------------------------------------------------------  Subquery Scan on t_odd_sb  (cost=0.00..31.55 rows=1 width=36)    Filter: f_leak(t_odd_sb.secret)    -&gt;  Seq Scan on t  (cost=0.00..31.53 rows=2 width=36)          Filter: ((n &lt; 4) AND ((n % 2) = 1)) (4 rows) <\/code><\/pre>\n<p>  \u041f\u043b\u0430\u043d \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u043e\u0431\u0449\u0438\u0442\u044c \u0412\u0430\u043c \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u0445\u043e\u0442\u044f \u043e\u043d \u0438 \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u0430 \u0437\u0430\u0449\u0438\u0442\u043d\u043e\u0433\u043e \u0431\u0430\u0440\u044c\u0435\u0440\u0430 \u0432 \u0432\u044b\u0432\u043e\u0434\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f. \u0412\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u0440\u0438\u043d\u0443\u0436\u0434\u0430\u0435\u0442 \u0441\u043a\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c <i><b>t<\/b><\/i> \u0441 \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c\u0438 \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<p>  \u041d\u043e. \u041f\u043e\u0434\u043e\u0436\u0434\u0438\u0442\u0435 \u0441\u0435\u043a\u0443\u043d\u0434\u0443. \u041f\u043e\u0447\u0435\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u043f\u0440\u0435\u0434\u0438\u043a\u0430\u0442 <i><b>n &lt; 4<\/b><\/i> \u0442\u0430\u043a\u0436\u0435 \u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u0442 \u0432 \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u0435? \u0420\u0430\u0437\u0432\u0435 \u044d\u0442\u043e \u043d\u0435 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0434\u044b\u0440\u0430 \u0432 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438? \u0415\u0441\u043b\u0438 <i><b>n &lt; 4<\/b><\/i> \u043e\u043f\u0443\u0449\u0435\u043d\u043e, \u0442\u043e\u0433\u0434\u0430 \u043f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435 <i><b>f_leak(secret)<\/b><\/i>?<\/p>\n<h4><b>LEAKPROOF \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/b><\/h4>\n<p>  \u041e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <i><b>&lt;<\/b><\/i> \u043f\u043e\u043c\u0435\u0447\u0435\u043d \u043a\u0430\u043a <i><b>LEAKPROOF<\/b><\/i>. \u042d\u0442\u043e\u0442 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440, \u0438\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e \u043d\u0435 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u0442 \u0443\u0442\u0435\u0447\u043a\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u043e \u043a <i><b>security_barrier<\/b><\/i> \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u043c. \u041f\u041e \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c \u0441\u043e\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\u043c, \u0412\u044b \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0430\u0442\u0440\u0438\u0431\u0443\u0442 <i><b>LEAKPROOF<\/b><\/i> \u0431\u0443\u0434\u0443\u0447\u0438 \u043e\u0431\u044b\u0447\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c:<\/p>\n<pre><code class=\"sql\">regress=&gt; ALTER FUNCTION f_leak(text)  LEAKPROOF; ERROR:  only superuser can define a leakproof function <\/code><\/pre>\n<p>  \u0441\u0443\u043f\u0435\u0440\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u0436\u0435 \u043c\u043e\u0433\u0443\u0442 \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435, \u0447\u0442\u043e \u0437\u0430\u0445\u043e\u0442\u044f\u0442 \u0438 \u0438\u043c \u043d\u0435 \u043d\u0430\u0434\u043e \u043f\u0440\u0438\u0431\u0435\u0433\u0430\u0442\u044c \u043a \u0442\u0440\u044e\u043a\u0430\u043c \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0443\u0442\u0435\u0447\u043a\u0438 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0434\u0430\u0431\u044b \u043f\u0440\u043e\u0439\u0442\u0438 \u0437\u0430\u0449\u0438\u0442\u043d\u044b\u0439 \u0431\u0430\u0440\u044c\u0435\u0440 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439.<\/p>\n<h4><b>\u041f\u043e\u0447\u0435\u043c\u0443 \u0412\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c security_barrier \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f<\/b><\/h4>\n<p>  \u041e\u0431\u044b\u0447\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432 PostgreSQL 9.3 <a href=\"http:\/\/www.postgresql.org\/docs\/current\/static\/sql-createview.html#SQL-CREATEVIEW-UPDATABLE-VIEWS\">\u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c\u044b\u0435<\/a>, \u043d\u043e security_barrier \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u0435 \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u044e\u0442 \u043f\u043e\u0434 \u0441\u043e\u0431\u043e\u0439 \u00ab\u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b\u00bb. \u042d\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u0412\u0441\u044f \u0441\u0443\u0442\u044c security_barrier \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442\u044c \u044d\u0442\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f. UPDATE \u0432 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441 \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 PostgreSQL \u043e\u0442\u0432\u0435\u0440\u0433\u043d\u0435\u0442 \u043b\u044e\u0431\u044b\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c security_barrier \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435:<\/p>\n<pre><code class=\"sql\">regress = &gt; UPDATE t_odd SET     secret = 'secret_haha' || n; UPDATE 10 regress = &gt; UPDATE t_odd_sb SET     secret = 'secret_haha' || n; ERROR: cannot UPDATE VIEW &quot;t_odd_sb&quot; DETAIL: SECURITY - barrier views ARE NOT automatically updatable. HINT: TO ENABLE updating the VIEW, provide an INSTEAD OF UPDATE TRIGGER OR an unconditional ON UPDATE DO INSTEAD RULE. <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u043e \u0441\u0430\u043c\u043e\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435, \u0432 \u043e\u0442\u043c\u0435\u043d\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u044f \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043d, \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044e \u0437\u0430\u0449\u0438\u0442\u044b \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0441\u0442\u0440\u043e\u043a \u0434\u043b\u044f <a href=\"http:\/\/axleproject.eu\/\">\u043f\u0440\u043e\u0435\u043a\u0442\u0430 AXLE<\/a>. Kohei KaiGai \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u043b \u043e\u0433\u0440\u043e\u043c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0441\u0442\u0440\u043e\u043a, \u0438 \u0442\u0430\u043a\u0438\u0435 \u0432\u0435\u0449\u0438 \u043a\u0430\u043a security_barrier \u0438 LEAKPROOF \u0432 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0438 \u0438\u0437 \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u0449\u0438\u0442\u044b \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0441\u0442\u0440\u043e\u043a \u0432 PostgreSQL. \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0432\u044b\u0437\u043e\u0432 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u043a\u0430\u043a \u0438\u043c\u0435\u0442\u044c \u0434\u0435\u043b\u043e \u0441 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0437\u0430\u0449\u0438\u0442\u043d\u043e\u0433\u043e \u0431\u0430\u0440\u044c\u0435\u0440\u0430 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e \u0438 \u0442\u0430\u043a\u0438\u043c \u043f\u0443\u0442\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u043c\u043e \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c. <\/p>\n<h4><b>\u041f\u043e\u0447\u0435\u043c\u0443 \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u044b?<\/b><\/h4>\n<p>  \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u0442\u044c\u0441\u044f, \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e. \u042f \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u043b\u0441\u044f. \u041a\u043e\u0440\u043e\u0442\u043a\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u2014 \u043c\u044b \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b, \u043d\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043d\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435, \u0447\u0443\u0432\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043a \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0435 \u0432\u0430\u0440\u0438\u0430\u0446\u0438\u0438 AND \u0438 OR \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u0438 \u043d\u0430\u0443\u0447\u0438\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440, \u0447\u0442\u043e \u043e\u043d \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u043d\u0438\u0445 \u0443\u0441\u043b\u043e\u0432\u0438\u044f. \u0422\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0443\u0436\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u044b \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438, \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0449\u0435 \u043f\u043e\u043c\u0435\u0447\u0430\u0442\u044c \u043f\u043e\u0434\u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a\u0430\u043a \u0437\u0430\u0431\u043e\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c\/\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043d\u0438\u0445.<\/p>\n<p>  \u0412 PostgreSQL \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u043d\u0430\u044f \u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u2014 <b><i>CASE<\/i><\/b>. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c <b><i>CASE<\/i><\/b> \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u043d\u0438\u043a\u0430\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u0442\u044c \u0433\u0440\u0430\u043d\u0438\u0446\u044b <b><i>CASE<\/i><\/b>, \u0434\u0430\u0436\u0435 <b><i>LEAKPROOF<\/i><\/b>. \u0420\u0430\u0432\u043d\u043e \u043a\u0430\u043a \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0442\u043e\u0440 \u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432? \u043e\u0441\u043d\u043e\u0432\u044b\u0432\u0430\u044f\u0441\u044c \u043d\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0438 CASE \u0431\u043b\u043e\u043a\u0430. \u0422\u0430\u043a \u0447\u0442\u043e, \u0435\u0441\u043b\u0438 \u0431\u044b \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 CASE \u043a\u0430\u043a \u044f \u0441\u043f\u0440\u043e\u0441\u0438\u043b \u043e\u0431 \u044d\u0442\u043e\u043c \u0432\u043e\u0442 \u0437\u0434\u0435\u0441\u044c, \u043c\u044b \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u0431\u044b \u043d\u0435\u0441 \u043c\u043e\u0433\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441 \u0434\u043b\u044f \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u044f.<\/p>\n<h4><b>\u0412 \u043a\u043e\u0434\u0435<\/b><\/h4>\n<p>  \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 security_barrier \u0431\u044b\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u0432 <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/0e4611c0234d89e288a53351f775c59522baed7c\">0e4611c0234d89e288a53351f775c59522baed7c<\/a> \u0438 \u0443\u0441\u0438\u043b\u0435\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 LEAKPROOF \u0432 <a href=\"https:\/\/github.com\/postgres\/postgres\/commit\/cd30728fb2ed7c367d545fc14ab850b5fa2a4850\">cd30728fb2ed7c367d545fc14ab850b5fa2a4850<\/a>. \u0421\u043b\u043e\u0432\u0430 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u043d\u043e\u0441\u0442\u0438 \u0438\u0434\u0443\u0442 \u0432 commit notes. \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0432\u0441\u0435\u043c, \u043a\u0442\u043e \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u043b \u0443\u0447\u0430\u0441\u0442\u0438\u0435.       <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/273167\/\"> http:\/\/habrahabr.ru\/post\/273167\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       \u0412\u044b \u043c\u043e\u0433\u043b\u0438 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0432 PostgreSQL 9.2 \u0431\u044b\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0434\u043b\u044f security_barrier \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439. \u042f \u0441\u043c\u043e\u0442\u0440\u0435\u043b \u0432 \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0441 \u043f\u0440\u0438\u0446\u0435\u043b\u043e\u043c \u043d\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043d\u0438\u0445, \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u044e\u0449\u0435\u0439\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e \u0437\u0430\u0449\u0438\u0442\u0435 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0441\u0442\u0440\u043e\u043a \u0434\u043b\u044f <a href=\"http:\/\/axleproject.eu\/\">\u043f\u0440\u043e\u0435\u043a\u0442\u0430 AXLE<\/a>, \u0438 \u044f \u043f\u043e\u0434\u0443\u043c\u0430\u043b \u0447\u0442\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u044e \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c \u043a\u0430\u043a \u043e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442. <\/p>\n<p>  \u0420\u043e\u0431\u0435\u0440\u0442 \u0443\u0436\u0435 <a href=\"http:\/\/rhaas.blogspot.com.au\/2012\/03\/security-barrier-views.html\">\u043e\u0431\u044a\u044f\u0441\u043d\u0438\u043b <\/a>\u0432 \u0447\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u0430 \u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0439 \u0438 \u043e\u0442 \u0447\u0435\u0433\u043e \u043e\u043d\u0438 \u0437\u0430\u0449\u0438\u0449\u0430\u044e\u0442 (\u043a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u044d\u0442\u043e \u0435\u0449\u0435 \u043e\u0431\u0441\u0443\u0436\u0434\u0430\u043b\u043e\u0441\u044c \u0432 &quot;<a href=\"http:\/\/wiki.postgresql.org\/wiki\/What&#39;s_new_in_PostgreSQL_9.2#Security_barriers_and_Leakproof\">\u0427\u0442\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0432 PostgreSQL 9.2<\/a>&quot;). \u0421\u0435\u0439\u0447\u0430\u0441 \u0436\u0435 \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u0442\u043e\u043c\u0443, <i>\u043a\u0430\u043a <\/i>\u043e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0438 \u043e\u0431\u0441\u0443\u0434\u0438\u0442\u044c \u043a\u0430\u043a security_barrier \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044e\u0442 \u0441 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c\u044b\u043c\u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u043c\u0438.   <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-270402","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/270402","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=270402"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/270402\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=270402"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=270402"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=270402"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}