From ed469395fb08fed238090949394e42b86032c512 Mon Sep 17 00:00:00 2001
From: Garet Halliday <ghalliday@gfxlabs.io>
Date: Thu, 29 Sep 2022 16:24:16 -0500
Subject: [PATCH] add alter as write hint

---
 Dockerfile                                    | 1 +
 go.mod                                        | 2 +-
 go.sum                                        | 4 ++--
 lib/gat/database/query_router/query_router.go | 3 ++-
 4 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 3179a291..209cea14 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -2,5 +2,6 @@ FROM golang
 
 WORKDIR /wd
 COPY . /wd
+RUN go mod tidy
 RUN go build ./cmd/cgat
 ENTRYPOINT ["./cgat"]
diff --git a/go.mod b/go.mod
index 38b5d081..71544486 100644
--- a/go.mod
+++ b/go.mod
@@ -3,7 +3,7 @@ module gfx.cafe/gfx/pggat
 go 1.19
 
 require (
-	gfx.cafe/ghalliday1/pg3p v0.0.18
+	gfx.cafe/ghalliday1/pg3p v0.0.19
 	gfx.cafe/ghalliday1/pgparser v0.0.9
 	gfx.cafe/util/go/bufpool v0.0.0-20220906091724-3a24b7f40ccf
 	gfx.cafe/util/go/generic v0.0.0-20220917152604-80373e5a2c51
diff --git a/go.sum b/go.sum
index 998c306b..f78b0455 100644
--- a/go.sum
+++ b/go.sum
@@ -1,7 +1,7 @@
 cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
 cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
-gfx.cafe/ghalliday1/pg3p v0.0.18 h1:rEaTLvIW4RvO0/YYVU0vosvhp+KH5FdOm8OmWGRKBac=
-gfx.cafe/ghalliday1/pg3p v0.0.18/go.mod h1:dVy94HSyywugiaUJm+4EyhC41TOL3SHSr+FUubKa7s8=
+gfx.cafe/ghalliday1/pg3p v0.0.19 h1:c78xhRKZzssQEKBgsg95n9Xh0ORiLY4GWp7KqlgFqRg=
+gfx.cafe/ghalliday1/pg3p v0.0.19/go.mod h1:dVy94HSyywugiaUJm+4EyhC41TOL3SHSr+FUubKa7s8=
 gfx.cafe/ghalliday1/pgparser v0.0.9 h1:mj1819zaEO964rFMr9lzGIoKLdZdjWAs6CqPvcSAhYg=
 gfx.cafe/ghalliday1/pgparser v0.0.9/go.mod h1:mte3a6XnIWVexcvJJrkYQ2ozbSx/soIJ4ivXf8pS1No=
 gfx.cafe/util/go/bufpool v0.0.0-20220906091724-3a24b7f40ccf h1:ya4IK1D+Kq0DrFdrrZ7tjmp3BgoO4v5sCAeUytR6j1U=
diff --git a/lib/gat/database/query_router/query_router.go b/lib/gat/database/query_router/query_router.go
index 6b050280..722ca318 100644
--- a/lib/gat/database/query_router/query_router.go
+++ b/lib/gat/database/query_router/query_router.go
@@ -97,7 +97,8 @@ func (r *QueryRouter) InferRole(query string) (config.ServerRole, error) {
 			lex.KeywordCreate,
 			lex.KeywordTruncate,
 			lex.KeywordVacuum,
-			lex.KeywordAnalyze:
+			lex.KeywordAnalyze,
+			lex.KeywordAlter:
 			return config.SERVERROLE_PRIMARY, nil
 		case lex.KeywordBegin:
 			depth += 1
-- 
GitLab