@@ -271,7 +271,7 @@ func (db *psqlxStore) lockTxBySources(tx *sqlx.Tx, sff SourceFamilies) error {
271
271
}
272
272
273
273
func createSource (ctx context.Context , tx * sqlx.Tx , s Source ) (* Source , error ) {
274
- r := tx .QueryRowxContext (ctx , `INSERT INTO sources (name, component, instance, options, time, target_id)
274
+ r := tx .QueryRowxContext (ctx , `INSERT INTO sources (name, component, instance, options, time, target_id)
275
275
VALUES ($1, $2, $3, $4, $5, $6) RETURNING *` , s .Name , s .Component , s .Instance , s .Options , s .Time , s .Target )
276
276
err := r .StructScan (& s )
277
277
if err != nil {
@@ -284,11 +284,11 @@ func createSourceIfNotExists(ctx context.Context, tx *sqlx.Tx, s Source) (*Sourc
284
284
var err error
285
285
q := `
286
286
WITH q as (
287
- SELECT * FROM sources
287
+ SELECT * FROM sources
288
288
WHERE name=$1 AND component=$2 AND instance=$3 AND options=$4
289
- ),
289
+ ),
290
290
c AS (
291
- INSERT INTO sources (name, component, instance, options, time, target_id)
291
+ INSERT INTO sources (name, component, instance, options, time, target_id)
292
292
SELECT $1, $2, $3, $4, $5, $6
293
293
WHERE NOT EXISTS (SELECT 1 FROM q)
294
294
RETURNING *
0 commit comments