@@ -266,19 +266,19 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core&
266266 return false ;
267267 }
268268
269- if (Ctx_.YqlSelectMode != EYqlSelectMode::Disable) {
270- // if (!IsBackwardCompatibleFeatureAvailable(MakeLangVersion(2025, 04))) {
271- // Error() << "YqlSelect is not available before 2025.04";
272- // return false;
273- // }
269+ if (Ctx_.GetYqlSelectMode () != EYqlSelectMode::Disable) {
270+ if (!IsBackwardCompatibleFeatureAvailable (MakeLangVersion (2025 , 04 ))) {
271+ Error () << " YqlSelect is not available before 2025.04" ;
272+ return false ;
273+ }
274274
275275 const auto stmt = core.GetAlt_sql_stmt_core2 ().GetRule_select_stmt1 ();
276276 if (auto result = BuildYqlSelect (Ctx_, Mode_, stmt)) {
277277 blocks.emplace_back (std::move (*result));
278278 break ;
279279 } else if (
280280 result.error () == EYqlSelectError::Unsupported &&
281- Ctx_.YqlSelectMode == EYqlSelectMode::Force)
281+ Ctx_.GetYqlSelectMode () == EYqlSelectMode::Force)
282282 {
283283 Error () << " Translation of the statement "
284284 << " to YqlSelect was forced, but unsupported" ;
@@ -672,6 +672,28 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core&
672672 return false ;
673673 }
674674
675+ if (Ctx_.GetYqlSelectMode () != EYqlSelectMode::Disable) {
676+ const auto langVer = GetMaxLangVersion ();
677+ if (!IsBackwardCompatibleFeatureAvailable (langVer)) {
678+ Error () << " YqlSelect is not available before "
679+ << FormatLangVersion (langVer);
680+ return false ;
681+ }
682+
683+ const auto stmt = core.GetAlt_sql_stmt_core21 ().GetRule_values_stmt1 ();
684+ if (auto result = BuildYqlSelect (Ctx_, Mode_, stmt)) {
685+ blocks.emplace_back (std::move (*result));
686+ break ;
687+ } else if (
688+ result.error () == EYqlSelectError::Unsupported &&
689+ Ctx_.GetYqlSelectMode () == EYqlSelectMode::Force)
690+ {
691+ Error () << " Translation of the statement "
692+ << " to YqlSelect was forced, but unsupported" ;
693+ return false ;
694+ }
695+ }
696+
675697 Ctx_.BodyPart ();
676698 TSqlValues values (Ctx_, Mode_);
677699 TPosition pos;
@@ -3541,6 +3563,14 @@ THashMap<TString, TPragmaDescr> PragmaDescrs{
35413563 }),
35423564 TableElemExt (" YqlSelect" , [](CB_SIG) -> TMaybe<TNodePtr> {
35433565 auto & ctx = query.Context ();
3566+ if (!IsBackwardCompatibleFeatureAvailable (
3567+ ctx.Settings .LangVer ,
3568+ MakeLangVersion (2025 , 04 ),
3569+ ctx.Settings .BackportMode ))
3570+ {
3571+ query.Error () << " YqlSelect is not available before 2025.04" ;
3572+ return Nothing ();
3573+ }
35443574
35453575 const TString* literal = values.size () == 1 ? values[0 ].GetLiteral () : nullptr ;
35463576 if (!literal) {
@@ -3549,19 +3579,17 @@ THashMap<TString, TPragmaDescr> PragmaDescrs{
35493579 }
35503580
35513581 if (*literal == " disable" ) {
3552- ctx.YqlSelectMode = EYqlSelectMode::Disable;
3582+ ctx.SetYqlSelectMode ( EYqlSelectMode::Disable) ;
35533583 } else if (*literal == " auto" ) {
3554- ctx.YqlSelectMode = EYqlSelectMode::Auto;
3584+ ctx.SetYqlSelectMode ( EYqlSelectMode::Auto) ;
35553585 } else if (*literal == " force" ) {
3556- ctx.YqlSelectMode = EYqlSelectMode::Force;
3586+ ctx.SetYqlSelectMode ( EYqlSelectMode::Force) ;
35573587 } else {
35583588 query.Error () << " Unexpected literal '" << *literal << " ' for: " << pragma
35593589 << " , expected 'disable', 'auto' or 'force'" ;
35603590 return Nothing ();
35613591 }
35623592
3563- ctx.DeriveColumnOrder = true ;
3564-
35653593 return TNodePtr ();
35663594 }),
35673595
0 commit comments