Skip to content

[r2dbc-mysql] getColumnMetadatas() of JasyncMetadata lose columns with the same names #390

Closed
@davin111

Description

@davin111

I use spring-r2dbc and (latest 2.1.23) jasync-r2dbc-mysql for my project, and there are a few inner join queries.

But when I use databaseClient.sql("~").fetch().all()~ for joining tables which have column with the same names (ex> id, create_time, update_time) and retrieving the columns, I get unexpected results. The returned rows (maps) have mismatched column names and values!

The reason is that (jasync) getColumnMetadatas() executed in ColumnMapRowMapper in spring-r2dbc returns missing columns.

I debugged some codes, and figured out that this is because of implementation of JasyncMetadata of like below.

private val metadata: Map<String, ColumnMetadata> = columnNames.map { it to JasyncColumnMetadata(it) }.toMap()

Also I checked the implementation of the r2dbc-spi interface RowMetadata of the latest version of r2dbc-mariadb doesn't have this issue. It returned all columns regardless of the same names.

Actually, in jasync-r2dbc-mysql versions compatible with r2dbc-spi versions below 1 (which used getColumnNames()), there was no issue like it.

If I'm right, can I try to fix this issue? However, if you think the context related with this issue is too difficult or complex for a new contributor, please tell me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions