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

Return only column name to client (SDK) #988

Open
0ctanium opened this issue Nov 8, 2021 · 1 comment · May be fixed by #989
Open

Return only column name to client (SDK) #988

0ctanium opened this issue Nov 8, 2021 · 1 comment · May be fixed by #989
Labels
enhancement New feature or request
Milestone

Comments

@0ctanium
Copy link

0ctanium commented Nov 8, 2021

What would you like to be added or enhanced
When querying ImmuDB, it return the full column path ( "([database].[table].[column])" ) instead of the column name ( "[column]" ). It would be useful, when returning response to transform column path, used for internal processing just the column name to allow end user to process the data correctly.

Ex: query response in pgsql cli
image

Why is this needed
When using some packages, in order to parse raw row data into clear objects, the driver need to get column names.
For example, when scanning a response using database/sql with sqlx in go. The package will look for the column name. But it wont be able to find anything because it can't parse the full column path. So sqlx returns an error saying it can't find the column name "missing destination name (dbinstance.transactions.transaction_id) in *model.Transaction"

Additional context
We started discussing this issue on discord. So if you want te read beginning of that conversation, here is the link:
https://discord.com/channels/831257098368319569/831258571664130068/905107567313842246

@0ctanium 0ctanium added the enhancement New feature or request label Nov 8, 2021
@0ctanium
Copy link
Author

0ctanium commented Nov 8, 2021

To implement this feature the easiest way is to transform the full column path into its name just before sending the response to client.
We also need to take in account the case where two columns have ambigus names. We should throw an error. And then advise the user to use aliases. (like the default behavior of pgsql)

But when returning columns to the end user, we can allow two columns with the same name (like the default behavior of pgsql). And use aliases to differentiate them

@zaza81 zaza81 added this to the v1.3 milestone Dec 16, 2021
@zaza81 zaza81 changed the title Return only column name to client Return only column name to client (SDK) Dec 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants