Skip to content

Commit 27e37b9

Browse files
shnikdvitstn
andauthored
Long domain name (#9144)
Co-authored-by: Vitaly Stoyan <vvvv@ydb.tech>
1 parent 84e30aa commit 27e37b9

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

ydb/core/kqp/ut/pg/kqp_pg_ut.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4733,6 +4733,33 @@ Y_UNIT_TEST_SUITE(KqpPg) {
47334733
UNIT_ASSERT_VALUES_EQUAL(ydbResults.begin()->Getcolumns().at(i).Getname(), colNames[i]);
47344734
}
47354735
}
4736+
4737+
Y_UNIT_TEST(LongDomainName) {
4738+
NKikimrConfig::TAppConfig appConfig;
4739+
appConfig.MutableTableServiceConfig()->SetEnablePreparedDdl(true);
4740+
auto setting = NKikimrKqp::TKqpSetting();
4741+
auto serverSettings = TKikimrSettings()
4742+
.SetAppConfig(appConfig)
4743+
.SetKqpSettings({setting})
4744+
.SetDomainRoot(std::string(65, 'a'));
4745+
TKikimrRunner kikimr(serverSettings.SetWithSampleTables(false));
4746+
auto db = kikimr.GetQueryClient();
4747+
auto settings = NYdb::NQuery::TExecuteQuerySettings().Syntax(NYdb::NQuery::ESyntax::Pg);
4748+
{
4749+
auto result = db.ExecuteQuery(R"(
4750+
CREATE TABLE t (id INT PRIMARY KEY, data1 UUID[]);
4751+
)", NYdb::NQuery::TTxControl::NoTx(), settings).ExtractValueSync();
4752+
UNIT_ASSERT_C(result.IsSuccess(), result.GetIssues().ToString());
4753+
}
4754+
4755+
{
4756+
const auto query = Q_(R"(
4757+
SELECT * FROM t;
4758+
)");
4759+
auto result = db.ExecuteQuery(query, NYdb::NQuery::TTxControl::BeginTx().CommitTx(), settings).ExtractValueSync();
4760+
UNIT_ASSERT_C(result.IsSuccess(), result.GetIssues().ToString());
4761+
}
4762+
}
47364763
}
47374764

47384765
} // namespace NKqp

ydb/library/yql/parser/pg_wrapper/syscache.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -696,10 +696,10 @@ namespace NMiniKQL {
696696
void PgCreateSysCacheEntries(void* ctx) {
697697
auto main = (TMainContext*)ctx;
698698
if (main->GUCSettings) {
699-
if (main->GUCSettings->Get("ydb_database")) {
699+
if (main->GUCSettings->Get("ydb_database") && main->GUCSettings->Get("ydb_database")->size() < NAMEDATALEN) {
700700
main->CurrentDatabaseName = NYql::TSysCache::MakePgDatabaseHeapTuple(NYql::PG_CURRENT_DATABASE_ID, main->GUCSettings->Get("ydb_database")->c_str());
701701
}
702-
if (main->GUCSettings->Get("ydb_user")) {
702+
if (main->GUCSettings->Get("ydb_user") && main->GUCSettings->Get("ydb_user")->size() < NAMEDATALEN) {
703703
main->CurrentUserName = NYql::TSysCache::MakePgRolesHeapTuple(NYql::PG_CURRENT_USER_ID, main->GUCSettings->Get("ydb_user")->c_str());
704704
}
705705
}

0 commit comments

Comments
 (0)