From 49542432795207890050d0d3d547b7a11d07ca9b Mon Sep 17 00:00:00 2001 From: "Michael J. Sullivan" Date: Thu, 20 Feb 2025 20:46:32 -0800 Subject: [PATCH] Don't ISE during recompilation of queries that produce warnings (#8363) The queries get recompiled without their full source buffer, which some of the span machinery gets mad at. Hack around it. (There are certainly better approaches.) --- edb/common/span.py | 7 ++++++- edb/server/compiler/rpc.pyx | 2 +- edb/server/dbview/dbview.pyx | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/edb/common/span.py b/edb/common/span.py index efdbb04faed..425e7c60ff3 100644 --- a/edb/common/span.py +++ b/edb/common/span.py @@ -89,8 +89,13 @@ def __getstate__(self): return dic def _calc_points(self): + # HACK: If we don't have an actual buffer (probably because we + # are recompiling after a schema change), just fake something + # long enough. Line numbers will be wrong but positions will + # still be right... + buffer = self.buffer.encode('utf-8') if self.buffer else b' ' * self.end self._points = ql_parser.SourcePoint.from_offsets( - self.buffer.encode('utf-8'), + buffer, [self.start, self.end] ) diff --git a/edb/server/compiler/rpc.pyx b/edb/server/compiler/rpc.pyx index 6ffa3649943..469c4998975 100644 --- a/edb/server/compiler/rpc.pyx +++ b/edb/server/compiler/rpc.pyx @@ -128,7 +128,7 @@ cdef class SQLParamsSource: return self._cached_key def text(self): - return '' + return '' def serialize(self): if self._serialized is not None: diff --git a/edb/server/dbview/dbview.pyx b/edb/server/dbview/dbview.pyx index 7ee48274392..77e84ca5905 100644 --- a/edb/server/dbview/dbview.pyx +++ b/edb/server/dbview/dbview.pyx @@ -513,7 +513,7 @@ cdef class Database: try: query_req = rpc.CompilationRequest.deserialize( in_data, - "", + "", self.server.compilation_config_serializer, )