Skip to content

Commit

Permalink
fix parameter interpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed May 24, 2024
1 parent 4fc4df0 commit 60a9c73
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions flow/connectors/postgres/sink.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type PgCopyReader struct {

func NewPgCopyPipe() (PgCopyReader, PgCopyWriter) {
read, write := io.Pipe()
schema := PgCopyShared{schemaLatch: make(chan struct{}, 0)}
schema := PgCopyShared{schemaLatch: make(chan struct{})}
return PgCopyReader{PipeReader: read, schema: &schema},
PgCopyWriter{PipeWriter: write, schema: &schema}
}
Expand Down Expand Up @@ -174,7 +174,7 @@ func (p PgCopyWriter) ExecuteQueryWithTx(
// TODO use pgx simple query arg parsing code (it's internal, need to copy)
// TODO correctly interpolate
for i, arg := range args {
query = strings.ReplaceAll(query, fmt.Sprintf("$%d", i), fmt.Sprint(arg))
query = strings.ReplaceAll(query, fmt.Sprintf("$%d", i+1), fmt.Sprint(arg))
}

copyQuery := fmt.Sprintf("COPY %s (%s) TO STDOUT", query, strings.Join(cols, ","))
Expand Down

0 comments on commit 60a9c73

Please sign in to comment.