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 correct values from PostgreSQL record when columns have identical name #173

Merged
merged 2 commits into from
Apr 29, 2020

Conversation

rzane
Copy link
Contributor

@rzane rzane commented Mar 13, 2020

It's fairly common to select two columns that are assigned the same name. In those scenarios, you can't really rely on the dictionary version of the record, but you get the values by their index.

Previously, when two columns with the same name were selected, the PostgreSQL Record would return only the first column's value.

>>> query = "SELECT 1 AS id, 2 AS id"
>>> row = await database.fetch_one(query=query)
>>> list(row.values())
[1, 1]

This PR fixes that bug and returns the correct values.

@tomchristie
Copy link
Member

Fantastic, thanks!

@rzane Since this is your first approved PR, you're welcome to an invite to maintainers if you'd like it? That'd give you permissions to approve or merge PRs.

Thanks for your time on this. 😀

@tomchristie tomchristie merged commit 5cccb5c into encode:master Apr 29, 2020
@vmarkovtsev
Copy link
Contributor

@tomchristie did you mean myself or Ray?..

@tomchristie
Copy link
Member

I meant Ray, yup. We're trying to move to an open doors policy of "invites to the maintainers team for anyone who gets a PR through"

@vmarkovtsev
Copy link
Contributor

All right 👍 I wonder if #199 counts in my case, too.

@tomchristie
Copy link
Member

Yup absolutely, just not always succeeding in tracking it! 😬

@tomchristie tomchristie changed the title Make sure the correct values are returned from a PostgreSQL record Return correct values from PostgreSQL record when columns have identical name Apr 30, 2020
@tomchristie tomchristie mentioned this pull request Apr 30, 2020
@rzane rzane deleted the fix-incorrect-values branch May 6, 2020 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants