test(contrib/drivers/pgsql): add Union, DO and Raw Where test coverage - #4679
Merged
Conversation
- Add pgsql_z_unit_feature_union_test.go: Union/UnionAll on db and model - Add pgsql_z_unit_feature_model_do_test.go: DO struct insert/update/where with nullable table schema, pointer fields, DAO pattern, field prefix - Enhance pgsql_z_unit_raw_test.go: add Test_Raw_Where for subquery and field comparison with gdb.Raw, adapted for PgSQL quoting - Add testdata/table_with_prefix.sql for FieldPrefix test
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request adds comprehensive test coverage for Union/UnionAll operations, DO (Data Object) pattern functionality, and Raw Where clause handling in the PostgreSQL driver, ported from the MySQL driver test suite with appropriate PostgreSQL-specific adaptations.
Changes:
- Added 4 Union/UnionAll tests covering both database-level and model-level operations
- Added 10 DO pattern tests for insert, batch insert, update, pointer field handling, WHERE clauses, DAO pattern, and field prefix mapping
- Added 3 Raw Where tests for subquery NOT EXISTS and field comparison using gdb.Raw()
- Added PostgreSQL-compatible test data SQL file for field prefix tests
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| contrib/drivers/pgsql/pgsql_z_unit_feature_union_test.go | Implements Union/UnionAll tests at both db and model levels with proper PostgreSQL integer type assertions |
| contrib/drivers/pgsql/pgsql_z_unit_feature_model_do_test.go | Comprehensive DO pattern tests with nullable schema, RowsAffected() validation, and field prefix handling |
| contrib/drivers/pgsql/pgsql_z_unit_raw_test.go | Adds Test_Raw_Where function with double-quote quoting for PostgreSQL identifier syntax |
| contrib/drivers/pgsql/testdata/table_with_prefix.sql | PostgreSQL-compatible schema for field prefix tests (SERIAL vs AUTO_INCREMENT) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
gqcn
approved these changes
Feb 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
pgsql_z_unit_feature_union_test.go: 4 tests for Union/UnionAll on both db and model levelpgsql_z_unit_feature_model_do_test.go: 10 tests for DO (Data Object) pattern - insert, batch insert, update, pointer fields, WHERE, DAO pattern, and field prefix handlingpgsql_z_unit_raw_test.go: addTest_Raw_Wherefor subquery NOT EXISTS and field comparison usinggdb.Raw(), adapted for PgSQL double-quote quotingtestdata/table_with_prefix.sqlfor PgSQL-compatible FieldPrefix testAll tests adapted from MySQL driver test suite with PgSQL-specific adjustments:
Test plan
ref #4689