@@ -292,6 +292,7 @@ func readSchemaGrants(db *DBConnection, d *schema.ResourceData) error {
292
292
}
293
293
294
294
func readTableGrants (db * DBConnection , d * schema.ResourceData ) error {
295
+ log .Printf ("[DEBUG] Reading table grants" )
295
296
var entityName , query string
296
297
_ , isUser := d .GetOk (grantUserAttr )
297
298
@@ -344,6 +345,7 @@ func readTableGrants(db *DBConnection, d *schema.ResourceData) error {
344
345
if err != nil {
345
346
return err
346
347
}
348
+ defer rows .Close ()
347
349
348
350
for rows .Next () {
349
351
var objName string
@@ -388,11 +390,14 @@ func readTableGrants(db *DBConnection, d *schema.ResourceData) error {
388
390
break
389
391
}
390
392
}
393
+ log .Printf ("[DEBUG] Collected table grants" )
391
394
392
395
return nil
393
396
}
394
397
395
398
func readCallableGrants (db * DBConnection , d * schema.ResourceData ) error {
399
+ log .Printf ("[DEBUG] Reading callable grants" )
400
+
396
401
var entityName , query string
397
402
398
403
_ , isUser := d .GetOk (grantUserAttr )
@@ -444,6 +449,7 @@ func readCallableGrants(db *DBConnection, d *schema.ResourceData) error {
444
449
}
445
450
return false
446
451
}
452
+ defer rows .Close ()
447
453
448
454
privilegesSet := schema .NewSet (schema .HashString , nil )
449
455
for rows .Next () {
@@ -465,11 +471,13 @@ func readCallableGrants(db *DBConnection, d *schema.ResourceData) error {
465
471
if ! privilegesSet .Equal (d .Get (grantPrivilegesAttr ).(* schema.Set )) {
466
472
d .Set (grantPrivilegesAttr , privilegesSet )
467
473
}
474
+ log .Printf ("[DEBUG] Reading callable grants - Done" )
468
475
469
476
return nil
470
477
}
471
478
472
479
func readLanguageGrants (db * DBConnection , d * schema.ResourceData ) error {
480
+ log .Printf ("[DEBUG] Reading language grants" )
473
481
474
482
var entityName , query string
475
483
@@ -503,6 +511,7 @@ func readLanguageGrants(db *DBConnection, d *schema.ResourceData) error {
503
511
}
504
512
505
513
objects := d .Get (grantObjectsAttr ).(* schema.Set )
514
+ defer rows .Close ()
506
515
507
516
for rows .Next () {
508
517
var objName string
@@ -526,6 +535,7 @@ func readLanguageGrants(db *DBConnection, d *schema.ResourceData) error {
526
535
break
527
536
}
528
537
}
538
+ log .Printf ("[DEBUG] Reading language grants - Done" )
529
539
530
540
return nil
531
541
}
0 commit comments