Skip to content

New functions#6

Open
jnasbyupgrade wants to merge 40 commits intoPostgres-Extensions:masterfrom
jnasbyupgrade:new_functions
Open

New functions#6
jnasbyupgrade wants to merge 40 commits intoPostgres-Extensions:masterfrom
jnasbyupgrade:new_functions

Conversation

@jnasbyupgrade
Copy link
Copy Markdown
Contributor

Add many new functions.

Remove defunct Travis CI and replace with Github automation.

Add support for Claude Code

bed3604 Fix pg_regress on versions > 12 (Postgres-Extensions#5) (Postgres-Extensions#6)

git-subtree-dir: pgxntool
git-subtree-split: bed36044679d6b53ad7cd2875272552a4ad6508a
Biggest change is that starting with Postgres 12 OID columns in catalog
tables were no longer hidden, which required adjusting a few views and
tests. Also update pgxntool.
Also, refactor common code between it and function__arg_types()
- Eliminate duplicate NULL array creation logic by restructuring CASE statement
- Use pronargs instead of parsing proargtypes text for array size
- Move data type definitions and mapping functions to beginning of file
- Improve code organization and readability
- Add enum types equivalent to relation_relkind for pg_proc fields:
  * routine_prokind and routine_type (function/procedure/aggregate/window)
  * routine_proargmode and routine_argument_mode (in/out/inout/variadic/table)
  * routine_provolatile and routine_volatility (immutable/stable/volatile)
  * routine_proparallel and routine_parallel_safety (safe/restricted/unsafe)
- Remove explicit type grants, rely on default privileges
- Clean up redundant comments in mapping functions
- Add comprehensive test suite for new enum types and permissions
jnasbyupgrade and others added 12 commits January 22, 2026 17:04
54793a3 Merge branch 'master' into upstream/stable
ab7f6e2 Stamp 1.0.0
3a571ba Add pg_tle support and modernize test infrastructure (#11)
b96ea6d Add support for Claude code; build and doc improvements (#9)
e9c24de Fix pg_regress on versions > 12 (Postgres-Extensions#5)

git-subtree-dir: pgxntool
git-subtree-split: 54793a39251290657767816d23b45d6297f3a671
Versioned files should now be kept in git.

Also, fix missing .gitignore
3b8cb2a Stamp 1.1.0
550a901 Remove commit.md (maintained in pgxntool-test)
d73ca93 Add unique test database names to prevent conflicts (#13)
9b344be Add update-setup-files.sh for 3-way merging after pgxntool-sync (#12)
REVERT: 54793a3 Merge branch 'master' into upstream/stable
REVERT: bed3604 Fix pg_regress on versions > 12 (Postgres-Extensions#5) (Postgres-Extensions#6)

git-subtree-dir: pgxntool
git-subtree-split: 3b8cb2a96c2611bb44b1d69fd533fd0f23fa8995
639756c Stamp 1.1.1
6ba3176 Fix pg_tle exception handler and empty upgrade files (#15)

git-subtree-dir: pgxntool
git-subtree-split: 639756c43a64717347b82b46acfec5be478a7bbf
PostgreSQL 15 (commit 07eee5a0) moved "char" from TYPCATEGORY_STRING to
TYPCATEGORY_INTERNAL, which removed the implicit I/O coercion path that
allowed "char"::some_enum to work. Replace the "char" overloads for
routine__type, routine__argument_mode, routine__volatility, and
routine__parallel_safety with explicit CREATE CAST ... WITH INOUT AS
IMPLICIT entries.

Also fix two bugs in trigger__parse exposed by PG17:
- current_setting('server_version')::real fails when the version string
  includes a distro suffix; switch to server_version_num::int
- pg_get_triggerdef renders temp functions as "pg_temp.f" while ::regproc
  gives "pg_temp_N.f", breaking the regexp split on the EXECUTE clause;
  replace the name-based pattern with a generic EXECUTE (FUNCTION|PROCEDURE)
  regex

Fix PG15+ permission denied on public schema in object_type tests by
granting CREATE ON SCHEMA public to the test role (PG15 revoked this
from PUBLIC by default).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add all new types, casts, and functions to the upgrade file that were
previously only in the versioned install file:
- New routine enum types: routine_prokind, routine_type, routine_proargmode,
  routine_argument_mode, routine_provolatile, routine_volatility,
  routine_proparallel, routine_parallel_safety, and composite routine_argument
- CREATE CAST ("char" AS ...) WITH INOUT AS IMPLICIT for the four prokind/
  proargmode/provolatile/proparallel enums (PG15+ compatibility)
- Functions: routine__type, routine__argument_mode, routine__volatility,
  routine__parallel_safety, and trigger__parse(oid) with PG17 fixes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Resolve conflicts keeping new_functions branch changes:
- CI: updated PG version matrix (18..10) and test command
- pgxntool: version history, unique REGRESS_DBNAME
- trigger__parse: generic EXECUTE regex pattern
- Test expected output and setup for new functions
jnasbyupgrade and others added 11 commits April 6, 2026 17:41
121f0b3 Stamp 2.0.0
ad3ca7e Remove .source support; add test/install, test/build, and verify-results (#18)
c010cf8 Fix bash 3.2 compatibility (#23)
abeb9d3 Remove .source file support from pg_regress integration (#22)
08c1879 Stamp 1.1.2
6e0dad2 Fix double --dbname bug that defeated unique test database names

git-subtree-dir: pgxntool
git-subtree-split: 121f0b38fabd1d0ebd2c975254e59421553e2830
Add entries for test/build/sql/ and test/install/schedule from new
pgxntool optional test features.
Replace the hand-rolled test/.build/ machinery with pgxntool's native
test-build feature:

- Move test/sql/zzz_build.sql → test/build/zzz_build.sql and its
  expected output to test/build/expected/. pgxntool auto-detects
  test/build/*.sql and runs them via a separate pg_regress pass before
  the main installcheck, providing the same SQL syntax sanity check.

- Update test/deps.sql to load the extension directly instead of via
  the generated test/.build/active.sql symlink.

- Remove the TEST_BUILD_DIR block from Makefile (dep.mk, active.sql,
  new.sql, upgrade.sql generation, set-test-new/set-test-upgrade
  targets). The old_version and clean_old_version targets are kept for
  upgrade testing.

- Remove test/load_new.sql (extension loading is now in deps.sql).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The zzz_ prefix was used to sort the test last in test/sql/; in
test/build/ there's no need for that since test-build is a separate
pg_regress pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
pgxntool/run-test-build.sh uses rsync to sync test/build/*.sql into
test/build/sql/ for pg_regress. The pgxn/pgxn-tools container doesn't
include rsync, so install it explicitly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add test/build/upgrade.sql: installs cat_tools 0.2.1, runs ALTER
  EXTENSION UPDATE, and rolls back. Skips on PG12+ since the 0.2.1
  install script uses SELECT c.oid AS reloid, c.* which produces a
  duplicate oid column (fixed by the upgrade script, but can't reach it
  from the broken install).
- Add expected output files for PG12+ and pre-PG12 cases.
- Add DATA += sql/cat_tools--0.2.1.sql to Makefile so make install
  deploys the historical version for the upgrade test.
- Populate sql/cat_tools--0.2.1--0.3.0.sql with all changes from
  cat_tools.sql.in that were missing: default privileges, omit_column
  helper, pg_class_v/pg_attribute_v/column/pg_extension_v view
  recreation, new helper functions, routine__ functions, text overloads
  for relation__relkind/kind, updated object__catalog, and more.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The 0.2.1 install script used SELECT c.oid AS reloid, c.* and similar
patterns that produce duplicate oid column names on PG12+, where oid
became a visible regular column in system catalog tables.

Fix the three affected views using DO blocks with dynamic column lists:
- _cat_tools.pg_class_v: exclude oid from pg_class c.*
- _cat_tools.pg_attribute_v: exclude attmissingval (PG11+ pseudo-type)
  and exclude oid from pg_type t.* (prevents duplicate via _cat_tools.column
  which joins pg_attribute_v with pg_constraint, which also has oid on PG12+)
- cat_tools.pg_extension_v: exclude oid from pg_extension e.*

Also fix the upgrade script: DROP VIEW pg_extension_v needed CASCADE
because pg_extension__get(name) depends on the view's row type. Add
the function recreation after the view is rebuilt.

Update the upgrade test to run on all PG versions without skipping,
using SET LOCAL client_min_messages = ERROR to suppress expected
deprecation warnings (the 0.2.1 install sets LOCAL WARNING which
must be overridden with another LOCAL).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
0.2.1 is a released version and must not be modified. Instead, the
upgrade test selects its starting point based on PG version:
- PG12+: install the current version (0.3.0) and run ALTER EXTENSION
  UPDATE as a no-op sanity check. SET LOCAL client_min_messages=WARNING
  to suppress the "already installed" notice (the install script's own
  SET LOCAL reverts when the script returns).
- PG11 and below: install 0.2.1 and run the real upgrade. SET LOCAL
  client_min_messages=ERROR to suppress expected deprecation warnings
  (same SET LOCAL scoping issue).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…t just PG12+

pg_attribute gained attmissingval in PG11 with pseudo-type anyarray,
which is not allowed in view column definitions. This breaks the 0.2.1
install script on PG11 just as the oid visibility issue breaks it on PG12+.
Use VERSION '0.3.0' on PG11+, only test the real upgrade on PG10.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant