Skip to content

Commit 17b42d7

Browse files
authored
Use exec for resource_postgresql_script (#20)
Seems to be better to use Exec than Query for this kind of usage.
1 parent 86484bc commit 17b42d7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

postgresql/resource_postgresql_script.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ func executeCommands(db *DBConnection, commands []string, tries int, backoffDela
106106
func executeBatch(db *DBConnection, commands []string) error {
107107
for _, command := range commands {
108108
log.Printf("[DEBUG] Executing %s", command)
109-
_, err := db.Query(command)
110-
109+
_, err := db.Exec(command)
110+
log.Printf("[DEBUG] Result %s: %v", command, err)
111111
if err != nil {
112112
log.Println("[DEBUG] Error catched:", err)
113113
if _, rollbackError := db.Query("ROLLBACK"); rollbackError != nil {

0 commit comments

Comments
 (0)