MCPcopy Create free account
hub / github.com/cloudquery/cloudquery / isPostgresDB

Function isPostgresDB

plugins/destination/postgresql/client/client_test.go:62–74  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

60}
61
62func isPostgresDB(ctx context.Context) (bool, error) {
63 conn, err := getConnection(ctx)
64 if err != nil {
65 return false, err
66 }
67 defer conn.Close()
68 var version string
69 err = conn.QueryRow(ctx, "select version()").Scan(&version)
70 if err != nil {
71 return false, fmt.Errorf("failed to get version %w", err)
72 }
73 return strings.HasPrefix(strings.ToLower(version), "postgresql"), nil
74}
75
76var safeMigrations = plugin.SafeMigrations{
77 AddColumn: true,

Calls 5

getConnectionFunction · 0.85
ScanMethod · 0.80
ErrorfMethod · 0.80
CloseMethod · 0.65
QueryRowMethod · 0.65

Tested by

no test coverage detected