Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: When using Text columns, ScanStruct does not work for pointer struct field & and the column is mandatory #1258

Open
flymedllva opened this issue Jun 6, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@flymedllva
Copy link

flymedllva commented Jun 6, 2024

Bug Report

YDB GO SDK version:

v3.71.0

Description:

When using Text columns, ScanStruct does not work for pointer struct field](bug: When using Text columns, ScanStruct does not work for pointer struct field & and the column is mandatory)

CREATE TABLE `test`
(
    `id`         Text NOT NULL
);
type T struct {
	ID        *string   `sql:"id"`
}

Not work, error: cannot cast 'TEST' (type 'Utf8') to '**string' destination at github.com/ydb-platform/ydb-go-sdk/v3/internal/value.textValue.castTo(value.go:2046) at `github.com/ydb-platform/ydb-go-sdk/v3/internal/query/scanner.StructScanner.ScanStruct(struct.go:64)

row, err := s.ydbConn.Query().ReadResultSet(ctx, "select id from `test`;")
nextRow, err := row.NextRow(ctx)
var t T
err = nextRow.ScanStruct(&t, query.WithScanStructAllowMissingColumnsFromSelect(), query.WithScanStructAllowMissingFieldsInStruct())
@flymedllva flymedllva added the bug Something isn't working label Jun 6, 2024
@flymedllva flymedllva changed the title bug: When using Text columns, ScanStruct does not work bug: When using Text columns, ScanStruct does not work for pointer struct field Jun 6, 2024
@flymedllva flymedllva changed the title bug: When using Text columns, ScanStruct does not work for pointer struct field bug: When using Text columns, ScanStruct does not work for pointer struct field & and the column is mandatory Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant