我想转储数据库并将转储还原到另一个可能包含数据的数据库中.如何pg_dump生成生成insert on conflict update语句而不仅仅是插入语句?我使用Postgres 9.5
在尝试构建彼此依赖的类型时,我碰到了一堵砖墙,这里是代码:
import graphql.schema.GraphQLObjectType;
import static graphql.schema.GraphQLObjectType.newObject;
import static graphql.Scalars.*;
import graphql.schema.GraphQLFieldDefinition;
import graphql.schema.GraphQLList;
import static graphql.schema.GraphQLFieldDefinition.newFieldDefinition;
public class GraphQLTypes {
private GraphQLObjectType studentType;
private GraphQLObjectType classType;
public GraphQLTypes() {
createStudentType();
createClassType();
}
void createStudentType() {
studentType = newObject().name("Student")
.field(newFieldDefinition().name("name").type(GraphQLString).build())
.field(newFieldDefinition().name("currentClass").type(classType).build())
.build();
}
void createClassType() {
classType = newObject().name("Class")
.field(newFieldDefinition().name("name").type(GraphQLString).build())
.field(newFieldDefinition().name("students").type(new GraphQLList(studentType)).build())
.build();
}
}
Run Code Online (Sandbox Code Playgroud)
它不可能实例化这个类,因为我得到了这个例外
Caused by: graphql.AssertException: type can't be null
at graphql.Assert.assertNotNull(Assert.java:10)
at graphql.schema.GraphQLFieldDefinition.<init>(GraphQLFieldDefinition.java:23)
at graphql.schema.GraphQLFieldDefinition$Builder.build(GraphQLFieldDefinition.java:152)
at graphql_types.GraphQLTypes.createStudentType(GraphQLTypes.java:26)
at graphql_types.GraphQLTypes.<init>(GraphQLTypes.java:19)
Run Code Online (Sandbox Code Playgroud)
很明显,classType尚未在createStudentType()引用它时被实例化.如何解决这个问题?