Skip to content

Commit 3ca30a5

Browse files
authored
Removed weird restriction for optional pg (#8175)
1 parent b4a5ff5 commit 3ca30a5

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

ydb/library/yql/ast/yql_type_string.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ class TTypeParser
186186

187187
private:
188188
TAstNode* ParseType() {
189-
bool isPgType = false;
190189
TAstNode* type = nullptr;
191190

192191
switch (Token) {
@@ -324,13 +323,11 @@ class TTypeParser
324323
if (id.SkipPrefix("pg")) {
325324
if (NPg::HasType(TString(id))) {
326325
type = MakePgType(id);
327-
isPgType = true;
328326
GetNextToken();
329327
}
330328
} else if (id.SkipPrefix("_pg")) {
331329
if (NPg::HasType(TString(id)) && !id.StartsWith('_')) {
332330
type = MakePgType(TString("_") + id);
333-
isPgType = true;
334331
GetNextToken();
335332
}
336333
}
@@ -342,10 +339,6 @@ class TTypeParser
342339

343340
if (type) {
344341
while (Token == '?') {
345-
if (isPgType) {
346-
return AddError(TString("PG type can't be wrapped into Optional type"));
347-
}
348-
349342
type = MakeOptionalType(type);
350343
GetNextToken();
351344
}

ydb/library/yql/ast/yql_type_string_ut.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,4 +678,9 @@ Y_UNIT_TEST_SUITE(TTypeString)
678678
TestFormat("((Pg int4))", "pgint4");
679679
TestFormat("((Pg _int4))", "_pgint4");
680680
}
681+
682+
Y_UNIT_TEST(FormatOptionalPg) {
683+
TestFormat("((Optional (Pg int4)))", "Optional<pgint4>");
684+
TestFormat("((Optional (Pg _int4)))", "Optional<_pgint4>");
685+
}
681686
}

0 commit comments

Comments
 (0)