Repository navigation
feat(postgres): add comprehensive PostgreSQL function support (array, network, UUID, hstore, range) - #26
Merged
Conversation
…tructors New function modules: - array.py: 17 array functions (array_agg, array_append, etc.) - network.py: 15 network functions (inet_client_addr, inet_merge, etc.) - uuid.py: 7 UUID functions (uuid_generate_v1, uuid_generate_v4, etc.) Fix range constructors to use sentinel pattern for bounds parameter: - int4range, int8range, numrange, tsrange, tstzrange, daterange - Omit bounds when using default inclusive '[]', include when explicitly specified Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add PostgreSQL hstore extension functions including: - Constructors: hstore_from_record, hstore_from_key_value - Key/Value extraction: akeys, skeys, avals, svals, each - Conversion: hstore_to_array, hstore_to_matrix, hstore_to_json, hstore_to_jsonb, hstore_to_json_loose, hstore_to_jsonb_loose - Existence: hstore_exist, hstore_defined - Delete: hstore_delete, hstore_delete_keys, hstore_delete_pairs - Record: hstore_populate_record - Operators: hstore_get_value, hstore_get_values, hstore_concat, hstore_key_exists, hstore_all_keys_exist, hstore_any_key_exists, hstore_contains, hstore_contained_by, hstore_subtract_*, hstore_to_array_operator, hstore_to_matrix_operator, hstore_record_update - Subscript: hstore_subscript_get, hstore_subscript_set Note: Generic function names (exist, delete, defined, slice, populate_record, record_update) are prefixed with hstore_ to avoid confusion with unrelated functionality.
…refix Rename generic function names to avoid confusion: - akeys → hstore_akeys - skeys → hstore_skeys - avals → hstore_avals - svals → hstore_svals - each → hstore_each All hstore functions now consistently use the hstore_ prefix.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## release/v1.0.0.dev10 #26 +/- ##
========================================================
+ Coverage 72.93% 72.98% +0.05%
========================================================
Files 122 126 +4
Lines 6924 7193 +269
Branches 1144 1178 +34
========================================================
+ Hits 5050 5250 +200
- Misses 1471 1512 +41
- Partials 403 431 +28
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
4 of 12 tasks
vistart
added a commit
that referenced
this pull request
Apr 12, 2026
… network, UUID, hstore, range) (#26) * feat(postgres): add array, network, UUID functions and fix range constructors New function modules: - array.py: 17 array functions (array_agg, array_append, etc.) - network.py: 15 network functions (inet_client_addr, inet_merge, etc.) - uuid.py: 7 UUID functions (uuid_generate_v1, uuid_generate_v4, etc.) Fix range constructors to use sentinel pattern for bounds parameter: - int4range, int8range, numrange, tsrange, tstzrange, daterange - Omit bounds when using default inclusive '[]', include when explicitly specified Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(postgres): add comprehensive hstore function support Add PostgreSQL hstore extension functions including: - Constructors: hstore_from_record, hstore_from_key_value - Key/Value extraction: akeys, skeys, avals, svals, each - Conversion: hstore_to_array, hstore_to_matrix, hstore_to_json, hstore_to_jsonb, hstore_to_json_loose, hstore_to_jsonb_loose - Existence: hstore_exist, hstore_defined - Delete: hstore_delete, hstore_delete_keys, hstore_delete_pairs - Record: hstore_populate_record - Operators: hstore_get_value, hstore_get_values, hstore_concat, hstore_key_exists, hstore_all_keys_exist, hstore_any_key_exists, hstore_contains, hstore_contained_by, hstore_subtract_*, hstore_to_array_operator, hstore_to_matrix_operator, hstore_record_update - Subscript: hstore_subscript_get, hstore_subscript_set Note: Generic function names (exist, delete, defined, slice, populate_record, record_update) are prefixed with hstore_ to avoid confusion with unrelated functionality. * refactor(postgres): rename hstore extraction functions with hstore_ prefix Rename generic function names to avoid confusion: - akeys → hstore_akeys - skeys → hstore_skeys - avals → hstore_avals - svals → hstore_svals - each → hstore_each All hstore functions now consistently use the hstore_ prefix. * chore: add changelog fragment for PR #26 * test(postgres): add hstore function tests for full coverage --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
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.



Description
Adds comprehensive PostgreSQL function support to the
rhosocial-activerecord-postgresbackend, supplementing the existing math, text search, and XML functions with new categories:Array functions (18 functions):
array_agg,array_agg_distinctarray_append,array_prepend,array_cat,array_remove,array_replacearray_dims,array_fill,array_length,array_lower,array_upper,array_ndims,array_position,array_positionsarray_to_string,string_to_array,unnestNetwork address functions (16 functions):
inet_client_addr,inet_client_port,inet_server_addr,inet_server_portinet_merge,inet_and,inet_or,inetnot,inet_set_maskinet_masklen,inet_netmask,inet_network,inet_recv,inet_show,cidr_netmask,macaddr8_set7bitUUID functions (8 functions):
uuid_generate_v1,uuid_generate_v1mc,uuid_generate_v3,uuid_generate_v4,uuid_generate_v5uuid_nil,uuid_maxHstore functions (33 functions):
hstore_from_record,hstore_from_key_valuehstore_akeys,hstore_skeys,hstore_avals,hstore_svals,hstore_eachhstore_to_array,hstore_to_matrix,hstore_to_json,hstore_to_jsonb,hstore_to_json_loose,hstore_to_jsonb_loosehstore_slice,hstore_exist,hstore_defined,hstore_get_value,hstore_get_valueshstore_delete,hstore_delete_keys,hstore_delete_pairs,hstore_concathstore_key_exists,hstore_all_keys_exist,hstore_any_key_exists,hstore_contains,hstore_contained_byhstore_subtract_key,hstore_subtract_keys,hstore_subtract_pairshstore_to_array_operator,hstore_to_matrix_operator,hstore_record_update,hstore_subscript_get,hstore_subscript_set,hstore_populate_recordRange constructors (6 functions):
int4range,int8range,numrange,tsrange,tstzrange,daterangeType of change
feat: A new featuredocs: Documentation only changesperf: A code change that improves performancetest: Adding missing tests or correcting existing testschore: Changes to the build process or auxiliary toolsci: Changes to our CI configuration files and scriptsbuild: Changes that affect the build system or external dependenciesrevert: Reverts a previous commitBreaking Change
Applicable
rhosocial-activerecordVersion Range: >=1.0.0,<2.0.0Related Repositories/Packages
None - this change is isolated to the postgres backend.
Testing
Test Plan:
pytest tests/rhosocial/activerecord_test/feature/backend/postgres/test_postgres_array_functions.pypytest tests/rhosocial/activerecord_test/feature/backend/postgres/test_postgres_network_functions.pypytest tests/rhosocial/activerecord_test/feature/backend/postgres/test_postgres_uuid_functions.pypytest tests/rhosocial/activerecord_test/feature/backend/postgres/test_postgres_range_constructors.pyChecklist
README.md, etc.).changelog.d/<issue_number>.<type>.md).Additional Notes
This PR renames hstore extraction functions with
hstore_prefix for naming consistency (commit6f7404b). The range constructors were previously inrange.pytypes module; this PR adds them as proper function exports infunctions/.