语法错误授权角色
Syntax eroor grant roles
我在尝试授予角色时遇到问题。我的命令是:
grant john.doe to john;
我收到错误:
ERROR: syntax error at or near "."
我正在使用 postgres 数据库。
如果您的角色确实是 john.doe,请使用
grant "john.doe" to john;
https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
SQL identifiers and key words must begin with a letter (a-z, but also
letters with diacritical marks and non-Latin letters) or an underscore
(_). Subsequent characters in an identifier or key word can be
letters, underscores, digits (0-9), or dollar signs ($). Note that
dollar signs are not allowed in identifiers according to the letter of
the SQL standard, so their use might render applications less
portable.
还有:
There is a second kind of identifier: the delimited identifier or
quoted identifier. It is formed by enclosing an arbitrary sequence of
characters in double-quotes (")
最后:
Quoted identifiers can contain any character, except the character
with code zero. (To include a double quote, write two double quotes.)
This allows constructing table or column names that would otherwise
not be possible, such as ones containing spaces or ampersands. The
length limitation still applies.
此外,大多数 Postgres 人员建议避免将 "camelCase" 或 "Other.Nam3s" 作为标识符...
我在尝试授予角色时遇到问题。我的命令是:
grant john.doe to john;
我收到错误:
ERROR: syntax error at or near "."
我正在使用 postgres 数据库。
如果您的角色确实是 john.doe,请使用
grant "john.doe" to john;
https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
SQL identifiers and key words must begin with a letter (a-z, but also letters with diacritical marks and non-Latin letters) or an underscore (_). Subsequent characters in an identifier or key word can be letters, underscores, digits (0-9), or dollar signs ($). Note that dollar signs are not allowed in identifiers according to the letter of the SQL standard, so their use might render applications less portable.
还有:
There is a second kind of identifier: the delimited identifier or quoted identifier. It is formed by enclosing an arbitrary sequence of characters in double-quotes (")
最后:
Quoted identifiers can contain any character, except the character with code zero. (To include a double quote, write two double quotes.) This allows constructing table or column names that would otherwise not be possible, such as ones containing spaces or ampersands. The length limitation still applies.
此外,大多数 Postgres 人员建议避免将 "camelCase" 或 "Other.Nam3s" 作为标识符...