From ea7858874bd710d84554db9b8c9deeb5cd0471cb Mon Sep 17 00:00:00 2001 From: Raphael 'kena' Poss Date: Mon, 24 Apr 2023 21:18:47 +0200 Subject: [PATCH] fixups --- Makefile | 31 +++++++++++++++--------------- pkg/sql/plpgsql/parser/.gitignore | 2 ++ pkg/sql/plpgsql/parser/BUILD.bazel | 2 ++ pkg/sql/plpgsql/parser/plpgsql.y | 5 ++++- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 74c971c7e578..7e907216075d 100644 --- a/Makefile +++ b/Makefile @@ -769,23 +769,23 @@ COCKROACHSHORT := ./cockroachshort$(SUFFIX) COCKROACHSQL := ./cockroach-sql$(SUFFIX) LOG_TARGETS = \ - pkg/util/log/severity/severity_generated.go \ - pkg/util/log/channel/channel_generated.go \ - pkg/util/log/eventpb/eventlog_channels_generated.go \ - pkg/util/log/eventpb/json_encode_generated.go \ - pkg/util/log/log_channels_generated.go + pkg/util/log/severity/severity_generated.go \ + pkg/util/log/channel/channel_generated.go \ + pkg/util/log/eventpb/eventlog_channels_generated.go \ + pkg/util/log/eventpb/json_encode_generated.go \ + pkg/util/log/log_channels_generated.go SQLPARSER_TARGETS = \ - pkg/sql/parser/sql.go \ - pkg/sql/parser/helpmap_test.go \ - pkg/sql/parser/help_messages.go \ - pkg/sql/lexbase/tokens.go \ - pkg/sql/lexbase/keywords.go \ - pkg/sql/lexbase/reserved_keywords.go \ - pkg/sql/plpgsql/parser/plpgsql.go \ - pkg/sql/plpgsql/parser/lexbase/tokens.go \ - pkg/sql/plpgsql/parser/lexbase/keywords.go \ - pkg/sql/scanner/token_names_test.go + pkg/sql/parser/sql.go \ + pkg/sql/parser/helpmap_test.go \ + pkg/sql/parser/help_messages.go \ + pkg/sql/lexbase/tokens.go \ + pkg/sql/lexbase/keywords.go \ + pkg/sql/lexbase/reserved_keywords.go \ + pkg/sql/plpgsql/parser/plpgsql.go \ + pkg/sql/plpgsql/parser/lexbase/tokens.go \ + pkg/sql/plpgsql/parser/lexbase/keywords.go \ + pkg/sql/scanner/token_names_test.go PROTOBUF_TARGETS := bin/.go_protobuf_sources bin/.gw_protobuf_sources $(PROTOBUF_TARGETS): fake-protobufs @@ -1498,6 +1498,7 @@ pkg/sql/lexbase/tokens.go: pkg/sql/parser/gen/sql.go.tmp echo; \ grep '^const [A-Z][_A-Z0-9]* ' $^) > $@.tmp || rm $@.tmp mv -f $@.tmp $@ + # The lex package is now the primary source for the token constant # definitions. Modify the code generated by goyacc here to refer to # the definitions in the lex package. diff --git a/pkg/sql/plpgsql/parser/.gitignore b/pkg/sql/plpgsql/parser/.gitignore index dea1f14b6384..164a8943e8bf 100644 --- a/pkg/sql/plpgsql/parser/.gitignore +++ b/pkg/sql/plpgsql/parser/.gitignore @@ -2,3 +2,5 @@ # for reasoning and alternatives). plpgsql.go +y.output +gen diff --git a/pkg/sql/plpgsql/parser/BUILD.bazel b/pkg/sql/plpgsql/parser/BUILD.bazel index 62e379647fff..9cf3f9ac4567 100644 --- a/pkg/sql/plpgsql/parser/BUILD.bazel +++ b/pkg/sql/plpgsql/parser/BUILD.bazel @@ -42,11 +42,13 @@ go_library( "//pkg/sql/parser/statements", "//pkg/sql/pgwire/pgcode", "//pkg/sql/pgwire/pgerror", + "//pkg/sql/plpgsql/parser/lexbase", "//pkg/sql/scanner", "//pkg/sql/sem/plpgsqltree", "//pkg/sql/sem/tree", "//pkg/sql/types", "@com_github_cockroachdb_errors//:errors", + "@com_github_cockroachdb_redact//:redact", # keep ], ) diff --git a/pkg/sql/plpgsql/parser/plpgsql.y b/pkg/sql/plpgsql/parser/plpgsql.y index 59ddf9203fad..8c168831b7c2 100644 --- a/pkg/sql/plpgsql/parser/plpgsql.y +++ b/pkg/sql/plpgsql/parser/plpgsql.y @@ -4,9 +4,11 @@ package parser import ( "fmt" + "github.com/cockroachdb/cockroach/pkg/sql/plpgsql/parser/lexbase" "github.com/cockroachdb/cockroach/pkg/sql/scanner" "github.com/cockroachdb/cockroach/pkg/sql/sem/plpgsqltree" "github.com/cockroachdb/errors" + "github.com/cockroachdb/redact" ) %} @@ -688,7 +690,8 @@ getdiag_item: unreserved_keyword { case "returned_sqlstate": $$.val = plpgsqltree.PlpgsqlGetdiagReturnedSqlstate; default: - setErr(plpgsqllex, errors.New("unrecognized GET DIAGNOSTICS item " + $1 )) + // TODO(jane): Should this use an unimplemented error instead? + setErr(plpgsqllex, errors.Newf("unrecognized GET DIAGNOSTICS item: %s", redact.Safe($1))) } } ;