From 28e8d33f2f941b4ae7fe8817104a466eb9196b37 Mon Sep 17 00:00:00 2001 From: Will Baker Date: Fri, 28 Feb 2025 10:33:55 -0500 Subject: [PATCH] materialize-postgres: include table name in logs for failed table alterations Adds information to the error and logging for failed table operations to assist in their resolution. --- materialize-postgres/client.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/materialize-postgres/client.go b/materialize-postgres/client.go index 36bcee916a..9991826d24 100644 --- a/materialize-postgres/client.go +++ b/materialize-postgres/client.go @@ -159,7 +159,8 @@ func (c *client) AlterTable(ctx context.Context, ta sql.TableAlter) (string, boi return strings.Join(stmts, "\n"), func(ctx context.Context) error { for _, stmt := range stmts { if _, err := c.db.ExecContext(ctx, stmt); err != nil { - return err + log.WithField("stmt", stmt).Error("alter table statement failed") + return fmt.Errorf("executing alter table for table %s: %w", ta.Identifier, err) } } return nil