Skip to content

Commit

Permalink
remove SkipPkeyAndReplicaCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
heavycrystal committed Jan 19, 2024
1 parent 9c80128 commit d67ac65
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
24 changes: 8 additions & 16 deletions flow/connectors/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ func (c *PostgresConnector) GetTableSchema(
) (*protos.GetTableSchemaBatchOutput, error) {
res := make(map[string]*protos.TableSchema)
for _, tableName := range req.TableIdentifiers {
tableSchema, err := c.getTableSchemaForTable(tableName, req.SkipPkeyAndReplicaCheck)
tableSchema, err := c.getTableSchemaForTable(tableName)
if err != nil {
return nil, err
}
Expand All @@ -600,27 +600,19 @@ func (c *PostgresConnector) GetTableSchema(

func (c *PostgresConnector) getTableSchemaForTable(
tableName string,
skipPkeyAndReplicaCheck bool,
) (*protos.TableSchema, error) {
schemaTable, err := utils.ParseSchemaTable(tableName)
if err != nil {
return nil, err
}

var pKeyCols []string
var replicaIdentityType ReplicaIdentityType
if !skipPkeyAndReplicaCheck {
var replErr error
replicaIdentityType, replErr = c.getReplicaIdentityType(schemaTable)
if replErr != nil {
return nil, fmt.Errorf("[getTableSchema]:error getting replica identity for table %s: %w", schemaTable, replErr)
}

var err error
pKeyCols, err = c.getPrimaryKeyColumns(replicaIdentityType, schemaTable)
if err != nil {
return nil, fmt.Errorf("[getTableSchema]:error getting primary key column for table %s: %w", schemaTable, err)
}
replicaIdentityType, err := c.getReplicaIdentityType(schemaTable)
if err != nil {
return nil, fmt.Errorf("[getTableSchema] error getting replica identity for table %s: %w", schemaTable, err)
}
pKeyCols, err := c.getPrimaryKeyColumns(replicaIdentityType, schemaTable)
if err != nil {
return nil, fmt.Errorf("[getTableSchema] error getting primary key column for table %s: %w", schemaTable, err)
}

// Get the column names and types
Expand Down
1 change: 0 additions & 1 deletion protos/flow.proto
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ message GetTableSchemaBatchInput {
peerdb_peers.Peer peer_connection_config = 1;
repeated string table_identifiers = 2;
string flow_name = 3;
bool skip_pkey_and_replica_check = 4;
}

message GetTableSchemaBatchOutput {
Expand Down

0 comments on commit d67ac65

Please sign in to comment.