Skip to content

fix(contrib/drivers/pgsql): Merge duplicated fields, especially for key constraints.#4465

Merged
hailaz merged 1 commit intogogf:masterfrom
wangle201210:feat/pgsql_table_field
Oct 13, 2025
Merged

fix(contrib/drivers/pgsql): Merge duplicated fields, especially for key constraints.#4465
hailaz merged 1 commit intogogf:masterfrom
wangle201210:feat/pgsql_table_field

Conversation

@wangle201210
Copy link
Member

pgsql 执行TableFields 或者字段信息时需要合并key信息

@houseme houseme requested a review from Copilot October 13, 2025 09:41
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 PR implements proper merging of key information for PostgreSQL table fields when multiple constraints exist on the same field. The changes ensure that when a field has multiple constraints (e.g., both primary key and unique), the TableFields method correctly prioritizes and merges the key information with the hierarchy: pri > uni > others.

Key changes:

  • Modified field processing logic to merge duplicate field entries instead of skipping them
  • Implemented constraint priority system where primary key takes precedence over unique constraints
  • Added comprehensive test coverage for both single and composite constraint scenarios

Reviewed Changes

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

File Description
contrib/drivers/pgsql/pgsql_table_fields.go Updated field processing logic to merge key constraints with proper priority handling
contrib/drivers/pgsql/pgsql_z_unit_db_test.go Added test cases to verify correct merging of field constraints and composite primary keys

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@hailaz hailaz changed the title TableFields 或者字段信息时需要合并key信息 fix(contrib/drivers/pgsql): Merge duplicated fields, especially for key constraints. Oct 13, 2025
@wangle201210 wangle201210 force-pushed the feat/pgsql_table_field branch from e98f927 to d8d88c4 Compare October 13, 2025 10:06
@hailaz hailaz merged commit 416f314 into gogf:master Oct 13, 2025
18 checks passed
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.

3 participants