Reserved Keywords and Table Names保留关键字与表名冲突
Some table, column, function and argument names can cause issues with PostGraphile due to conflicts with auto-generated type and field names. In these cases you can generally change the GraphQL type and field names for your PostgreSQL schema to avoid conflicts using smart tags.
部分表名、列名、函数名和参数名可能会与 PostGraphile 自动生成的 GraphQL 类型和字段名产生冲突,从而引发异常。遇到此类情况时,通常可以使用 smart tag 来重命名 PostgreSQL schema 对应的 GraphQL 类型或字段名,从而规避冲突。
Note that in many cases the singular or the plural of the words below may also cause issues, so assume the list below includes singulars and plurals too. The same goes for snake_case vs camelCase since PostGraphile automatically converts between these for you.
请注意,在许多情况下,下述词汇的单数或复数形式同样可能引发冲突,因此请将列表视为同时涵盖单复数两种形式。同理,由于 PostGraphile 会自动在 snake_case 与 camelCase 之间进行转换,这两种命名风格的写法也都在影响范围内。
-
[Table]
query,mutation,subscription- conflict with the root-levelQuery,MutationandSubscriptionGraphQL types.[表]
query、mutation、subscription:与 GraphQL 根类型Query、Mutation和Subscription冲突。 -
[Table, Function]
node- conflicts with the GraphQL rootnode(...)interface.[表、函数]
node:与 GraphQL 根接口node(...)冲突。 -
[Column, Argument]
order_by/orderBy- Used by PostGraphile for ordering, may cause issues when declared as a function argument or table column.[列、参数]
order_by/orderBy:被 PostGraphile 用作排序参数名,若将其用作函数参数或表列名可能会引发冲突。 -
[Column]
primary_key- we automatically addorderBy: PRIMARY_KEY_ASCto ordering, if you have a column calledprimary_keythen this value will be generated twice and cause issues.[列]
primary_key:PostGraphile 会自动在排序枚举中添加orderBy: PRIMARY_KEY_ASC,如果你的表中也存在名为primary_key的列,会导致该枚举值重复生成并引发问题。
There are other potential conflicts too, if you discover more conflicts then please consider using the "Edit this page" link to suggest some changes!
此外还可能存在其他潜在的命名冲突;如果你发现了更多冲突项,欢迎点击页面中的“Edit this page”链接提交补充建议!
Non-unique table names非唯一表名
If there exists multiple schemas with the same table name inside of them, it
can cause naming conflicts as the same name will be generated for each. To
support non-unique table names you should either apply an @name smart
tag to one or both tables, or implement an inflection
override that will change how
the GraphQL type names are generated from the raw table name.
如果多个 schema 中存在同名的数据表,系统会为它们生成相同的 GraphQL 类型名,从而引发命名冲突。要支持多 schema 下的同名表,可以为其中一张或两张表添加 @name smart tag,或者实现一个 inflection 覆写,以自定义从原始表名生成 GraphQL 类型名的规则。