@@ -14,6 +14,7 @@ import (
14
14
"github.com/stretchr/testify/require"
15
15
"github.com/ydb-platform/ydb-go-genproto/protos/Ydb"
16
16
17
+ "github.com/ydb-platform/ydb-go-sdk/v3"
17
18
"github.com/ydb-platform/ydb-go-sdk/v3/internal/scanner"
18
19
"github.com/ydb-platform/ydb-go-sdk/v3/internal/xerrors"
19
20
"github.com/ydb-platform/ydb-go-sdk/v3/table"
@@ -514,3 +515,61 @@ func (c *customTestUnmarshalUUIDTyped) UnmarshalYDB(raw scanner.RawValue) error
514
515
func (c * customTestUnmarshalUUIDTyped ) String () string {
515
516
return string (* c )
516
517
}
518
+
519
+ func TestRegressionIssue1636 (t * testing.T ) {
520
+ for _ , tt := range []struct {
521
+ name string
522
+ executeDataQueryOverQueryService bool
523
+ }{
524
+ {
525
+ name : "ydb.WithExecuteDataQueryOverQueryClient(false)" ,
526
+ executeDataQueryOverQueryService : false ,
527
+ },
528
+ {
529
+ name : "ydb.WithExecuteDataQueryOverQueryClient(true)" ,
530
+ executeDataQueryOverQueryService : true ,
531
+ },
532
+ } {
533
+ t .Run (tt .name , func (t * testing.T ) {
534
+ var (
535
+ scope = newScope (t )
536
+ driver = scope .Driver (ydb .WithExecuteDataQueryOverQueryClient (tt .executeDataQueryOverQueryService ))
537
+ )
538
+ err := driver .Table ().Do (scope .Ctx , func (ctx context.Context , s table.Session ) error {
539
+ stmt , err := s .Prepare (ctx , `
540
+ DECLARE $val AS Uint64;
541
+ SELECT $val;
542
+ ` )
543
+ if err != nil {
544
+ return fmt .Errorf ("prepare failed: %w" , err )
545
+ }
546
+ _ , r , err := stmt .Execute (ctx , table .DefaultTxControl (),
547
+ table .NewQueryParameters (table .ValueParam ("$val" , types .Uint64Value (123 ))),
548
+ )
549
+ if err != nil {
550
+ return fmt .Errorf ("prepared statement execute failed: %w" , err )
551
+ }
552
+
553
+ if ! r .NextResultSet (ctx ) {
554
+ return fmt .Errorf ("no result set: %w" , r .Err ())
555
+ }
556
+
557
+ if ! r .NextRow () {
558
+ return fmt .Errorf ("no row: %w" , r .Err ())
559
+ }
560
+
561
+ var v uint64
562
+ if err := r .Scan (& v ); err != nil {
563
+ return fmt .Errorf ("scan failed: %w" , err )
564
+ }
565
+
566
+ if v != 123 {
567
+ return fmt .Errorf ("unexpected value: %d" , v )
568
+ }
569
+
570
+ return r .Err ()
571
+ })
572
+ require .NoError (t , err )
573
+ })
574
+ }
575
+ }
0 commit comments