Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(database/gdb): skip field filtering when table/alias is unknown in FieldsPrefix#4602

Merged
hailaz merged 1 commit intogogf:masterfrom
lingcoder:bugfix/pg-fieldsPrefix
Jan 15, 2026
Merged

fix(database/gdb): skip field filtering when table/alias is unknown in FieldsPrefix#4602
hailaz merged 1 commit intogogf:masterfrom
lingcoder:bugfix/pg-fieldsPrefix

Conversation

@lingcoder
Copy link
Contributor

Summary

  • Fix FieldsPrefix silently dropping fields when called before LeftJoin
  • When table/alias is unknown, skip filtering and return fields directly

Test plan

  • Added unit test Test_Issue4595 in pgsql driver
  • Test covers: FieldsPrefix before LeftJoin, Fields with prefix, FieldsPrefix after LeftJoin

Closes #4595

@lingcoder lingcoder force-pushed the bugfix/pg-fieldsPrefix branch 4 times, most recently from eb01b5c to 7b9e020 Compare January 10, 2026 10:17
Copy link
Member

@gqcn gqcn left a comment

Choose a reason for hiding this comment

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

lgtm

@gqcn gqcn changed the title fix(gdb): skip field filtering when table/alias is unknown in FieldsPrefix fix(database/gdb): skip field filtering when table/alias is unknown in FieldsPrefix Jan 13, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes a bug where FieldsPrefix silently drops fields when called with an alias before the alias is established via LeftJoin. The fix adds logic to skip field filtering when the table/alias is unknown (not yet registered in the model).

Changes:

  • Added early return in mappingAndFilterToTableFields when a table/alias is unknown and not the main table
  • Added comprehensive test coverage for the fix in the PostgreSQL driver

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
database/gdb/gdb_model_utility.go Added check to skip field filtering when table/alias is unknown (i.e., not yet registered via LeftJoin)
contrib/drivers/pgsql/pgsql_z_unit_issue_test.go Added Test_Issue4595 with 3 test cases covering FieldsPrefix before/after LeftJoin and Fields with prefix

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gqcn gqcn added the awesome It's awesome! We keep watching. label Jan 13, 2026
@hailaz hailaz merged commit 3e73e2d into gogf:master Jan 15, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awesome It's awesome! We keep watching.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FieldsPrefix silently drops fields when using table alias before LeftJoin (PostgreSQL)

3 participants