Skip to content

Commit

Permalink
SELECT to exec constraints hook as it is a function (#1472)
Browse files Browse the repository at this point in the history
  • Loading branch information
heavycrystal authored Mar 12, 2024
1 parent 701a87b commit a413580
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions flow/connectors/postgres/qrep.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ import (
"github.com/PeerDB-io/peer-flow/shared"
)

const qRepMetadataTableName = "_peerdb_query_replication_metadata"
const QRepOverwriteTempTablePrefix = "_peerdb_overwrite_"
const (
qRepMetadataTableName = "_peerdb_query_replication_metadata"
QRepOverwriteTempTablePrefix = "_peerdb_overwrite_"
)

func (c *PostgresConnector) GetQRepPartitions(
ctx context.Context,
Expand Down Expand Up @@ -654,7 +656,7 @@ func (c *PostgresConnector) ConsolidateQRepPartitions(ctx context.Context, confi
if constraintsHookExists {
c.logger.Info("executing constraints hook", slog.String("procName",
fmt.Sprintf("_peerdb_post_run_hook_%s()", config.FlowJobName)))
_, err = tx.Exec(ctx, fmt.Sprintf("CALL _peerdb_post_run_hook_%s()", config.FlowJobName))
_, err = tx.Exec(ctx, fmt.Sprintf("SELECT _peerdb_post_run_hook_%s()", config.FlowJobName))
if err != nil {
return fmt.Errorf("failed to execute stored procedure for applying constraints: %w", err)
}
Expand Down

0 comments on commit a413580

Please sign in to comment.