Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
5a01ec5
Pull pgxntool from git@github.com:decibel/pgxntool.git stable
jnasbyupgrade Nov 6, 2024
81bdb18
Squashed 'pgxntool/' changes from c0af00f..bed3604
jnasbyupgrade Nov 6, 2024
d231a58
Add support for Postgres 13
jnasbyupgrade Nov 7, 2024
e8e2717
Add pgxn-tools CI
jnasbyupgrade Nov 7, 2024
0ff8a9a
Fix CI version matrix
jnasbyupgrade Nov 7, 2024
5c59f66
Remove .travis.yml
jnasbyupgrade Nov 11, 2024
ca7c8c1
Add new relkind entries
jnasbyupgrade Aug 28, 2025
700ac3b
Add relation__is_temp and relation__is_catalog functions
jnasbyupgrade Aug 29, 2025
4addd8c
Fix relation__column_names test to use temporary table instead of pg_…
jnasbyupgrade Sep 3, 2025
b1afca2
Fix missing commits
jnasbyupgrade Sep 3, 2025
3bde4a8
Add function__arg_names()
jnasbyupgrade Sep 23, 2025
c75eb40
Rename function__arg_* to routine__parse_arg_*
jnasbyupgrade Sep 23, 2025
262434f
Remove errant function from README
jnasbyupgrade Sep 23, 2025
6ad3efb
Refactor routine__arg_names() and reorganize file structure
jnasbyupgrade Sep 25, 2025
82be5ac
Add enum types for pg_proc fields and clean up permissions
jnasbyupgrade Sep 25, 2025
7a5fe71
Add missing test file
jnasbyupgrade Nov 11, 2025
21ec71b
Add automated test workflow
jnasbyupgrade Nov 11, 2025
55db3c7
Pull pgxntool from git@github.com:decibel/pgxntool.git release
jnasbyupgrade Jan 22, 2026
5332bc5
Squashed 'pgxntool/' changes from bed3604..54793a3
jnasbyupgrade Jan 22, 2026
4b86e4f
Update .gitignore from pgxntool template
jnasbyupgrade Jan 22, 2026
4c780b0
Update to new pgxntool standards
jnasbyupgrade Feb 4, 2026
65a998b
Pull pgxntool from git@github.com:decibel/pgxntool.git release
jnasbyupgrade Feb 19, 2026
5e73ee9
Squashed 'pgxntool/' changes from 54793a3..3b8cb2a
jnasbyupgrade Feb 19, 2026
5f7e573
Pull pgxntool from git@github.com:decibel/pgxntool.git release
jnasbyupgrade Feb 19, 2026
bb6146b
Squashed 'pgxntool/' changes from 3b8cb2a..639756c
jnasbyupgrade Feb 19, 2026
a4f0695
Add placeholder comment to empty upgrade file
jnasbyupgrade Feb 26, 2026
7473aa7
Fix compatibility with PostgreSQL 15+
jnasbyupgrade Apr 6, 2026
34d6fcf
Populate upgrade script from 0.2.1 to 0.3.0
jnasbyupgrade Apr 6, 2026
ab0306c
Merge origin/master into new_functions
jnasbyupgrade Apr 6, 2026
3028c8a
Squashed 'pgxntool/' changes from 639756c..121f0b3
jnasbyupgrade Apr 6, 2026
a4e8746
Pull pgxntool from git@github.com:decibel/pgxntool.git release
jnasbyupgrade Apr 6, 2026
9e73dfb
Update .gitignore after pgxntool-sync
jnasbyupgrade Apr 6, 2026
1763a93
Switch to pgxntool built-in test/build support
jnasbyupgrade Apr 6, 2026
d910a3c
Rename zzz_build.sql to build.sql
jnasbyupgrade Apr 7, 2026
3c33da3
Install rsync in CI before running tests
jnasbyupgrade Apr 7, 2026
cd75dc6
Add upgrade test and populate 0.2.1→0.3.0 upgrade script
jnasbyupgrade Apr 7, 2026
ab5f735
Fix 0.2.1 install script for PG12+ and run upgrade test unconditionally
jnasbyupgrade Apr 7, 2026
d9fd646
Revert 0.2.1.sql changes; fix upgrade test for PG12+ compatibility
jnasbyupgrade Apr 7, 2026
a3c7476
Use explicit version number in PG12+ upgrade test
jnasbyupgrade Apr 7, 2026
84e9a0d
Fix upgrade test threshold: 0.2.1 broken on PG11+ (attmissingval), no…
jnasbyupgrade Apr 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jobs:
test:
strategy:
matrix:
pg: [17, 16, 15, 14, 13, 12, 11, 10, 9.6, 9.5, 9.4, 9.3, 9.2]
pg: [18, 17, 16, 15, 14, 13, 12, 11, 10]
name: 🐘 PostgreSQL ${{ matrix.pg }}
runs-on: ubuntu-latest
container: pgxn/pgxn-tools
Expand All @@ -13,5 +13,7 @@ jobs:
run: pg-start ${{ matrix.pg }}
- name: Check out the repo
uses: actions/checkout@v4
- name: Install rsync
run: apt-get install -y rsync
- name: Test on PostgreSQL ${{ matrix.pg }}
run: pg-build-test
run: make test PGUSER=postgres
21 changes: 16 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,29 +1,40 @@
# Editor files
.*.swp

# Claude Code local settings
.claude/*.local.json

# Explicitly exclude META.json!
!/META.json

# Generated make files
meta.mk
control.mk

# Compiler output
*.o
*.so
.deps/

# built targets
/sql/*--*
!/sql/*--*--*.sql

# test targets
/test/.build/
# Note: Version-specific files (sql/*--*.sql) are now tracked in git and should be committed

# Test artifacts
results/
regression.diffs
regression.out

# Generated sql/ directory for test/build
# Created by make test-build. See README.asc for details.
test/build/sql/

# Auto-generated schedule file for test/install
# Created by make when test/install/*.sql files exist.
test/install/schedule

# Misc
tmp/
.DS_Store

# pg_tle generated files
/pg_tle/
4 changes: 2 additions & 2 deletions META.in.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"name": "cat_tools",

"X_comment": "REQUIRED. Version of the distribution. http://pgxn.org/spec/#version",
"version": "0.2.1",
"version": "0.3.0",

"X_comment": "REQUIRED. Short description of distribution.",
"abstract": "Tools for interfacing with the Postgres catalog",
Expand All @@ -37,7 +37,7 @@
"file": "sql/cat_tools.sql",

"X_comment": "REQUIRED. Version the extension is at.",
"version": "0.2.1",
"version": "0.3.0",

"X_comment": "Optional: \"abstract\": Description of the extension.",
"abstract": "Tools for interfacing with the catalog",
Expand Down
4 changes: 2 additions & 2 deletions META.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"name": "cat_tools",

"X_comment": "REQUIRED. Version of the distribution. http://pgxn.org/spec/#version",
"version": "0.2.1",
"version": "0.3.0",

"X_comment": "REQUIRED. Short description of distribution.",
"abstract": "Tools for interfacing with the Postgres catalog",
Expand All @@ -37,7 +37,7 @@
"file": "sql/cat_tools.sql",

"X_comment": "REQUIRED. Version the extension is at.",
"version": "0.2.1",
"version": "0.3.0",

"X_comment": "Optional: \"abstract\": Description of the extension.",
"abstract": "Tools for interfacing with the catalog",
Expand Down
38 changes: 3 additions & 35 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ all: $B/cat_tools.sql $(versioned_out)
installcheck: $B/cat_tools.sql $(versioned_out)
EXTRA_CLEAN += $B/cat_tools.sql $(versioned_out)

# Install historical version scripts so the upgrade test can start from them
DATA += sql/cat_tools--0.2.1.sql

# TODO: refactor the version stuff into a function
#
# This initially creates $@.tmp before moving it into place atomically. That's
Expand All @@ -41,41 +44,6 @@ else
endif
mv $@.tmp $@

# Support for upgrade test
#
# TODO: Instead of all of this stuff figure out how to pass something to
# pg_regress that will alter the behavior of the test instead.
TEST_BUILD_DIR = test/.build
testdeps: $(TEST_BUILD_DIR)/dep.mk $(TEST_BUILD_DIR)/active.sql
-include $(TEST_BUILD_DIR)/dep.mk

# Ensure dep.mk exists.
$(TEST_BUILD_DIR)/dep.mk: $(TEST_BUILD_DIR)
echo 'TEST_LOAD_SOURCE = new' > $(TEST_BUILD_DIR)/dep.mk

.PHONY: set-test-new
set-test-new: $(TEST_BUILD_DIR)
echo 'TEST_LOAD_SOURCE = new' > $(TEST_BUILD_DIR)/dep.mk

.PHONY: test-upgrade
set-test-upgrade: $(TEST_BUILD_DIR)
echo 'TEST_LOAD_SOURCE = upgrade' > $(TEST_BUILD_DIR)/dep.mk


$(TEST_BUILD_DIR)/active.sql: $(TEST_BUILD_DIR)/dep.mk $(TEST_BUILD_DIR)/$(TEST_LOAD_SOURCE).sql
ln -sf $(TEST_LOAD_SOURCE).sql $@

$(TEST_BUILD_DIR)/upgrade.sql: test/load_upgrade.sql $(TEST_BUILD_DIR) old_version
(echo @generated@ && cat $< && echo @generated@) | sed -e 's#@generated@#-- GENERATED FILE! DO NOT EDIT! See $<#' > $@

$(TEST_BUILD_DIR)/new.sql: test/load_new.sql $(TEST_BUILD_DIR)
(echo @generated@ && cat $< && echo @generated@) | sed -e 's#@generated@#-- GENERATED FILE! DO NOT EDIT! See $<#' > $@

# TODO: figure out vpath
EXTRA_CLEAN += $(TEST_BUILD_DIR)/
$(TEST_BUILD_DIR):
[ -d $@ ] || mkdir -p $@

.PHONY: old_version
old_version: $(DESTDIR)$(datadir)/extension/cat_tools--0.2.0.sql
$(DESTDIR)$(datadir)/extension/cat_tools--0.2.0.sql:
Expand Down
49 changes: 39 additions & 10 deletions README.asc
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ To make use of them, you need to grant `cat_tools__usage` to any roles that need

== Current Status

image:https://badge.fury.io/pg/cat_tools.svg["PGXN version",link="https://badge.fury.io/pg/cat_tools"]
image:https://travis-ci.org/decibel/cat_tools.png["Build Status",link="https://travis-ci.org/decibel/cat_tools"]

This is very much a work in progress. If it doesn't do something you need, please https://github.com/decibel/cat_tools/issues[open an issue]!

=== Supported Versions
Expand All @@ -21,8 +18,13 @@ Works on Postgres 9.3 and above.
* `cat_tools.constraint_type` - Types of constraints (`domain constraint` or `table_constraint`)
* `cat_tools.relation_type` - Types of objects stored in `pg_class`
* `cat_tools.relation_relkind` - Valid values for `pg_class.relkind`
* `cat_tools.routine_type` - Types of routines stored in `pg_proc`
* `cat_tools.routine_argument_mode` - Argument modes for function/procedure parameters
* `cat_tools.routine_volatility` - Volatility levels for functions/procedures`
* `cat_tools.routine_parallel_safety` - Parallel safety levels for functions/procedures
* `cat_tools.routine_argument` - Detailed information about a single function/procedure argument

== Functions
== General Introspection Functions

* `cat_tools.currval(table, column)` - Returns current value for a sequence owned by a column
* `cat_tools.enum_range(regtype)` - Returns valid values for an ENUM as an array
Expand All @@ -32,19 +34,46 @@ Works on Postgres 9.3 and above.
* `cat_tools.pg_extension__get(extension_name name)` - Returns cat_tools.pg_extension_v row for an extension
* `cat_tools.extension__schemas(extension_names text/name[])` - Returns the schemas for the requested functions
* `cat_tools.extension__schemas_unique(extension_names text/name[])` - Returns a unique array of schemas
* `cat_tools.function__arg_types(arguments)` - Accepts full function argument string and returns regtype[] of IN/INOUT arguments
* `cat_tools.function__arg_types_text(arguments)` - Version of `function__arg_types` that returns text
* `cat_tools.object__catalog(object_type)` - Returns catalog table that is used to store `object_type` objects
* `cat_tools.object__reg_type(object_catalog)` - Returns the "reg" pseudotype (ie: regclass) associated with a system catalog (ie: pg_class)
* `cat_tools.regprocedure(function_name, arguments)` - Returns regprocedure for function_name and it's full set of arguments
* `cat_tools.relation__kind(relkind)` - Mapping from `pg_class.relkind` to a `cat_tools.relation_type`
* `cat_tools.relation__relkind(relation_type)` - Mapping from `cat_tools.relation_type` to a `pg_class.relkind` value
* `cat_tools.relation__column_names(relation regclass)` - Returns an array of quoted column names for a relation in ordinal position order
* `cat_tools.relation__is_catalog(relation regclass)` - Returns true if the relation is in the `pg_catalog` schema
* `cat_tools.relation__is_temp(relation regclass)` - Returns true if the relation is a temporary table (lives in a schema that starts with 'pg_temp')

== Routine / Function / Procedure Functions

* `cat_tools.routine__parse_arg_types(arguments)` - Accepts full function argument string and returns regtype[] of IN/INOUT arguments
* `cat_tools.routine__parse_arg_types_text(arguments)` - Version of `routine__parse_arg_types` that returns text
* `cat_tools.routine__parse_arg_names(arguments)` - Accepts full function argument string and returns text[] of IN/INOUT argument names
* `cat_tools.routine__parse_arg_names_text(arguments)` - Version of `routine__parse_arg_names` that returns text
* `cat_tools.routine__arg_types(regprocedure)` - Returns argument types for a function as regtype[]
* `cat_tools.routine__arg_types_text(regprocedure)` - Version of `routine__arg_types` that returns text
* `cat_tools.routine__arg_names(regprocedure)` - Returns argument names for a function as text[]
* `cat_tools.routine__arg_names_text(regprocedure)` - Version of `routine__arg_names` that returns text
* `cat_tools.regprocedure(routine_name, arguments)` - Returns regprocedure for routine_name and it's full set of arguments

== Trigger Functions

* `cat_tools.trigger__args_as_text(text)` - Converts the arguments for a trigger function (as returned by `trigger__parse()`) to text (for backwards compatibility).
* `cat_tools.trigger__get_oid(trigger_table, trigger_name)` - oid of a trigger. Throws error if trigger doesn't exits.
* `cat_tools.trigger__get_oid__loose(trigger_table, trigger_name)` - oid of a trigger. Does _not_ throw error if trigger doesn't exits.
* `cat_tools.trigger__parse(trigger oid)` - Returns information about a trigger
* `cat_tools.trigger__parse(table_name regclass, trigger_name text)` - Returns information about a trigger

== Mapping Functions

* `cat_tools.relation__kind(relkind)` - Mapping from `pg_class.relkind` to a `cat_tools.relation_type`
* `cat_tools.relation__relkind(relation_type)` - Mapping from `cat_tools.relation_type` to a `pg_class.relkind` value
* `cat_tools.routine__type(prokind)` - Mapping from `pg_proc.prokind` to `cat_tools.routine_type`
* `cat_tools.routine__argument_mode(mode)` - Mapping from `pg_proc.proargmodes` element to `cat_tools.routine_argument_mode`
* `cat_tools.routine__volatility(volatile)` - Mapping from `pg_proc.provolatile` to `cat_tools.routine_volatility`
* `cat_tools.routine__parallel_safety(parallel)` - Mapping from `pg_proc.proparallel` to `cat_tools.routine_parallel_safety`

== Deprecated Functions

* `cat_tools.function__arg_types(arguments)` - DEPRECATED: Use `routine__parse_arg_types` instead
* `cat_tools.function__arg_types_text(arguments)` - DEPRECATED: Use `routine__parse_arg_types_text` instead

== Views
WARNING: These views may eventually move into a separate extension!

Expand All @@ -58,4 +87,4 @@ Copyright and License

Cat Tools is released under a https://github.com/decibel/cattools/blob/master/LICENSE[MIT license].

Copyright (c) 2016 Jim Nasby <Jim.Nasby@BlueTreble.com>.
Copyright (c) 2025 Jim Nasby <Jim.Nasby@gmail.com>.
2 changes: 1 addition & 1 deletion cat_tools.control
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
comment = 'Tools for intorfacing with the catalog'
default_version = '0.2.1'
default_version = '0.3.0'
relocatable = false
schema = 'cat_tools'
3 changes: 3 additions & 0 deletions pgxntool/.gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.gitattributes export-ignore
.claude/ export-ignore
*.md export-ignore
.DS_Store export-ignore
*.asc export-ignore
*.adoc export-ignore
*.html export-ignore
1 change: 1 addition & 0 deletions pgxntool/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.*.swp
.claude/*.local.json
Loading
Loading