Postgres用户权限无效

时间:2017-06-22 22:01:09

标签: postgresql

我创建了一个Postgres用户int r = rand(); if (r < RAND_MAX / 4) { // sword - 25% probability } else if (r < 3 * RAND_MAX / 4) { // knife - 50% probability } else { // axe - 25% probability } ,并授予 private static string CreateColumnString(Colors value) { // This is how we do it in embedded programming in C // In C we wouldn't need to convert, but alas in C# we do // So first ... var num = Convert.ToByte(value); // ToUint16 would work as well, but ToByte makes your intentions clearer // Then bitwise '& 'every bit position you care about to compose your string // For example: 0b0011 & 0b1111 = 0b0011 (3 AND 15 = 3) var s = (num & 1) > 0 ? "Red" : ""; s = (num & 2) > 0 ? s + "|Green": s; return (num & 2) > 0 ? s + "|Blue" : s; } 的所有权限,当我尝试从数据库中选择一个表时,我收到了一个权限被拒绝错误。

创建user1

user1

以user1身份登录

my_db

2 个答案:

答案 0 :(得分:0)

ALTER DATABASE name OWNER TO new_owner;

您必须将数据库my_db的所有者更改为用户名user1

答案 1 :(得分:0)

我知道这可能要晚了,但是您可能要分配 这是从我的试用中得到的,我能够解决类似的问题。似乎您必须为表函数和序列设置类似的特权,如下所示

    GRANT ALL PRIVILEGES ON DATABASE yourdb TO yourusr;
    GRANT ALL ON ALL TABLES IN SCHEMA your_schema TO yourusr;
    GRANT ALL ON ALL SEQUENCES IN SCHEMA your_schema TO yourusr;
    GRANT ALL ON ALL FUNCTIONS IN SCHEMA your_schema TO yourusr;