Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions internal/sources/cloudsqlpg/cloud_sql_pg.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,17 @@ func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.So

err = pool.Ping(ctx)
if err != nil {
pool.Close()
return nil, fmt.Errorf("unable to connect successfully: %w", err)
}

var res int
err = pool.QueryRow(ctx, "SELECT 1").Scan(&res)
if err != nil {
pool.Close()
return nil, fmt.Errorf("failed to execute 'SELECT 1' after connection: %w", err)
}

s := &Source{
Config: r,
Pool: pool,
Expand Down