Skip to content

test(contrib/drivers/pgsql): add Union, DO and Raw Where test coverage - #4679

Merged
gqcn merged 2 commits into
gogf:masterfrom
lingcoder:test/pgsql-union-do-raw
Feb 11, 2026
Merged

test(contrib/drivers/pgsql): add Union, DO and Raw Where test coverage#4679
gqcn merged 2 commits into
gogf:masterfrom
lingcoder:test/pgsql-union-do-raw

Conversation

@lingcoder

@lingcoder lingcoder commented Feb 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add pgsql_z_unit_feature_union_test.go: 4 tests for Union/UnionAll on both db and model level
  • Add pgsql_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 handling
  • Enhance pgsql_z_unit_raw_test.go: add Test_Raw_Where for subquery NOT EXISTS and field comparison using gdb.Raw(), adapted for PgSQL double-quote quoting
  • Add testdata/table_with_prefix.sql for PgSQL-compatible FieldPrefix test

All tests adapted from MySQL driver test suite with PgSQL-specific adjustments:

  • Nullable table schema for DO partial inserts (PgSQL NOT NULL is stricter than MySQL)
  • Double-quote identifier quoting instead of backticks
  • Unquoted table aliases in generated SQL

Test plan

  • All 15 new tests pass locally
  • Full pgsql test suite (107 tests) passes with zero regressions

ref #4689

- 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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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.

Comment thread contrib/drivers/pgsql/testdata/table_with_prefix.sql Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@gqcn
gqcn merged commit 46cc4ce into gogf:master Feb 11, 2026
16 checks passed
@lingcoder
lingcoder deleted the test/pgsql-union-do-raw branch February 28, 2026 00:31
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