Skip to content

Patch for saving Table OID and Attribute Number#1117

Closed
calledit wants to merge 3 commits intolib:masterfrom
calledit:patch-1
Closed

Patch for saving Table OID and Attribute Number#1117
calledit wants to merge 3 commits intolib:masterfrom
calledit:patch-1

Conversation

@calledit
Copy link
Copy Markdown

@calledit calledit commented Apr 9, 2023

When columns are renamed in sql queries, tracking the original table and column is not possible in the current implementation.

Example:

SELECT users.user_names AS username, posts.text AS post_text from users
LEFT INNER JOIN posts ON posts.user_id = users.id

In this query the original table will not be accessible, despite postgres acctually returning that information.

This patch adds two propertys to the fieldDesc struct and code to parse those fields from the postgres response.
Originally mentioned in #363

Copy link
Copy Markdown
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

thanks for the contribution. could you please add a test that confirms it works as expected?

Comment thread rows.go Outdated
Comment thread rows.go Outdated
@arp242 arp242 added the needs-test Needs a test before it can be merged label Dec 31, 2025
@arp242 arp242 added the needs-feedback Requires feedback to be actionable label Jan 11, 2026
@arp242
Copy link
Copy Markdown
Collaborator

arp242 commented Jan 11, 2026

As near as I can tell these fields are never actually exposed? So I'm not sure how you would go about actually using them? I guess that's also why a test was never added?

It's not really possible to expose this through database/sql. For better or worse, it doesn't really have any good facilities for exposing very database-specific things such as this.

Let me know if I'm wrong, but as far as I can tell, this is just not possible with a database/sql compatible driver.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-feedback Requires feedback to be actionable needs-test Needs a test before it can be merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants