-
-
Notifications
You must be signed in to change notification settings - Fork 56
chore: improve tests by adding more SQL scenarios and adding descriptions to the tested query variations #296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b112585
chore: improve tests by adding more SQL scenarios and adding descript…
martin-georgiev a873d10
chore: improve tests by adding more SQL scenarios and adding descript…
martin-georgiev ecef5d1
chore: improve tests by adding more SQL scenarios and adding descript…
martin-georgiev 470b491
no message
martin-georgiev 7adfd74
Merge branch 'main' into more-tests
martin-georgiev 9f15459
chore: improve tests by adding more SQL scenarios and adding descript…
martin-georgiev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Consider adding more comprehensive PostgreSQL ARRAY test cases
The current test cases cover the basic usage of PostgreSQL ARRAY constructor, but could be expanded to include additional PostgreSQL-specific functionality according to the official documentation:
ARRAY[1, NULL, 3]ARRAY[1, 'text', TRUE]ARRAY[[1,2], [3,4]]ARRAY[]These additional test cases would provide more comprehensive coverage of PostgreSQL's ARRAY functionality.
🌐 Web query:
💡 Result:
PostgreSQL's ARRAY constructor provides flexible ways to work with array data types, offering both direct syntax options and programmatic functionality. Here's a breakdown of key implementations:
Array Creation and Insertion
Basic array insertion can be done with either:
ARRAY[]constructor syntaxMultidimensional arrays require consistent sub-array dimensions:
Mismatched dimensions trigger errors like:
ERROR: multidimensional arrays must have matching sub-array dimensions [3]Array Querying and Manipulation
Element access uses 1-based indexing:
Array searching with
ANY():Using UNNEST() to expand arrays:
Aggregation with
ARRAY_AGG():Common Use Cases
Storing multiple related values
REAL[2]for lat/long) [4][5]Matrix/Grid Data
integer[4]) [3]Temporary Data Handling
Key Functions
array_cat()array_cat(ARRAY[1,2], ARRAY[3,4])array_length()array_length(phones, 1)array_replace()array_replace(phones, 'old','new')array_remove()array_remove(phones, '(discontinued)')Implementation Notes
text[]won't accept integers)phones[2] = '...') or entire arrays [5]For most relational datasets, normalization remains preferable, but arrays shine in scenarios requiring ordered collections or when integrating with applications using array data structures.
Citations:
Expand PostgreSQL ARRAY Test Cases for Comprehensive Coverage
The current tests in
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ArrTest.php(lines 30–34) only validate basic usage of the ARRAY constructor. To better reflect PostgreSQL’s ARRAY functionality—as seen in standard usage examples—it would be beneficial to extend the test cases. Consider adding additional scenarios such as:ARRAY[1, NULL, 3]ARRAY[1, 'text', TRUE]ARRAY[[1,2], [3,4]]ARRAY[]These extra tests would ensure robust coverage of both typical and edge-case behaviors.