GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix postgres KeyError with missing explicit columns (#190) by rsommer · Pull Request #482 · encode/databases

This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Conversation

@rsommer

@rsommer rsommer commented Apr 1, 2022

Copy link
Copy Markdown

If no explicit colum info is present, the postgres Record class causes a
KeyError. Besides the given example in #190 this also
happens if you construct the queries from text-clauses.

Handling this the same way as if there is no entry in self._column_map
fixes the error.

A simple testcase is added as well.

I did a simple test run using sqlite and postgres.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Roland Sommer and others added 3 commits April 1, 2022 12:42
Roland Sommer
Fix postgres KeyError with missing explicit columns (encode#190)
b049b9d
If no explicit colum info is present, the postgres Record class causes a
KeyError. Besides the given example in encode#190 this also
happens if you construct the queries from text-clauses.

Handling this the same way as if there is no entry in `self._column_map`
fixes the error.

A simple testcase is added as well.
@collerek
Merge branch 'master' into fix_postgres_keyerror
338b6ea
@aminalaee
Merge branch 'master' into fix_postgres_keyerror
dfef796
zanieb
zanieb approved these changes Jul 27, 2023
View reviewed changes
zanieb
zanieb reviewed Jul 27, 2023
View reviewed changes
Comment thread databases/backends/postgres.py
try:
idx, datatype = self._column_map[key]
except KeyError:
return self._row[key]

@zanieb zanieb Jul 27, 2023

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be setting raw to self._row[key] to ensure the processor runs on it still?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@zanieb
Merge branch 'master' into fix_postgres_keyerror
158f967

This branch has not been deployed

No deployments
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

1 more reviewer
@zanieb zanieb zanieb approved these changes
Reviewers whose approvals may not affect merge requirements

At least 1 approving review is required to merge this pull request.

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@rsommer @zanieb @collerek @aminalaee
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.