Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql 执行脚本时,启用RLS的Alter table在事务中不起作用_Postgresql_Postgresql 10 - Fatal编程技术网

Postgresql 执行脚本时,启用RLS的Alter table在事务中不起作用

Postgresql 执行脚本时,启用RLS的Alter table在事务中不起作用,postgresql,postgresql-10,Postgresql,Postgresql 10,我已将此脚本另存为db.sql: begin; create schema api; create table api.users( id serial primary key, name text ); insert into api.users(id, name) values (1, 'alex'), (2, 'john'); grant usage on schema api to publi

我已将此脚本另存为
db.sql

begin;

    create schema api;

    create table api.users(
        id serial primary key,
        name text
    );

    insert into api.users(id, name) values
    (1, 'alex'),
    (2, 'john');

    grant usage on schema api to public;

    grant all on api.users to public;

    alter table api.users force row level security;

commit;
我使用
psql-h localhost-U postgres-f db.sql-w app执行它,但是当我运行
SELECT oid时,从pg_类中重新命名,其中relrowsecurity='true'未给出结果。
运行
altertableapi后,用户强制执行行级安全性
同样,上一个查询返回users表


似乎更改事务中的表不起作用。

psql中的表api.users应该与api.users中的select*相同。据我所知,您确定调用时已填充
client()
?可能它是空的…它会返回它应该返回的“a”,如果它是空的,则不应返回任何行,否?与其他服务器相关,可能您必须拒绝所有服务器的访问,并且只有在找到
client()
时才授予权限。很抱歉,我从未使用过pgsql,因此我不知道详细信息,只能回答一般问题。问题是,您可以根据
client()
进行检查,但如果我看对了,则没有任何限制。