Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: CI
on: [push, pull_request]
jobs:
test:
strategy:
matrix:
pg: [18, 17, 16, 15, 14, 13, 12, 11, 10]
name: 🐘 PostgreSQL ${{ matrix.pg }}
runs-on: ubuntu-latest
container: pgxn/pgxn-tools
steps:
- name: Start PostgreSQL ${{ matrix.pg }}
run: pg-start ${{ matrix.pg }}
- name: Check out the repo
uses: actions/checkout@v4
- name: Test on PostgreSQL ${{ matrix.pg }}
run: make test PGUSER=postgres
13 changes: 8 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# 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/
Expand All @@ -27,3 +27,6 @@ regression.out
# Misc
tmp/
.DS_Store

# pg_tle generated files
/pg_tle/
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

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
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'
78 changes: 78 additions & 0 deletions pgxntool/.claude/commands/commit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
description: Create a git commit following project standards and safety protocols
allowed-tools: Bash(git status:*), Bash(git log:*), Bash(git add:*), Bash(git diff:*), Bash(git commit:*), Bash(make test:*)
---

# commit

Create a git commit following all project standards and safety protocols for pgxntool-test.

**CRITICAL REQUIREMENTS:**

1. **Git Safety**: Never update `git config`, never force push to `main`/`master`, never skip hooks unless explicitly requested

2. **Commit Attribution**: Do NOT add "Generated with Claude Code" to commit message body. The standard Co-Authored-By trailer is acceptable per project CLAUDE.md.

3. **Testing**: ALL tests must pass before committing:
- Run `make test`
- Check the output carefully for any "not ok" lines
- Count passing vs total tests
- **If ANY tests fail: STOP. Do NOT commit. Ask the user what to do.**
- There is NO such thing as an "acceptable" failing test
- Do NOT rationalize failures as "pre-existing" or "unrelated"

**WORKFLOW:**

1. Run in parallel: `git status`, `git diff --stat`, `git log -10 --oneline`

2. Check test status - THIS IS MANDATORY:
- Run `make test 2>&1 | tee /tmp/test-output.txt`
- Check for failing tests: `grep "^not ok" /tmp/test-output.txt`
- If ANY tests fail: STOP immediately and inform the user
- Only proceed if ALL tests pass

3. Analyze changes and draft concise commit message following this repo's style:
- Look at `git log -10 --oneline` to match existing style
- Be factual and direct (e.g., "Fix BATS dist test to create its own distribution")
- Focus on "why" when it adds value, otherwise just describe "what"
- List items in roughly decreasing order of impact
- Keep related items grouped together
- **In commit messages**: Wrap all code references in backticks - filenames, paths, commands, function names, variables, make targets, etc.
- Examples: `helpers.bash`, `make test-recursion`, `setup_sequential_test()`, `TEST_REPO`, `.envs/`, `01-meta.bats`
- Prevents markdown parsing issues and improves clarity

4. **PRESENT the proposed commit message to the user and WAIT for approval before proceeding**

5. After receiving approval, stage changes appropriately using `git add`

6. **VERIFY staged files with `git status`**:
- If user did NOT specify a subset: Confirm ALL modified/untracked files are staged
- If user specified only certain files: Confirm ONLY those files are staged
- STOP and ask user if staging doesn't match intent

7. After verification, commit using `HEREDOC` format:
```bash
git commit -m "$(cat <<'EOF'
Subject line (imperative mood, < 72 chars)

Additional context if needed, wrapped at 72 characters.

Co-Authored-By: Claude <noreply@anthropic.com>
EOF
)"
```

8. Run `git status` after commit to verify success

9. If pre-commit hook modifies files: Check authorship (`git log -1 --format='%an %ae'`) and branch status, then amend if safe or create new commit

**REPOSITORY CONTEXT:**

This is pgxntool-test, a test harness for the pgxntool framework. Key facts:
- Tests live in `tests/` directory
- `.envs/` contains test environments (gitignored)

**RESTRICTIONS:**
- DO NOT push unless explicitly asked
- DO NOT commit files with actual secrets (`.env`, `credentials.json`, etc.)
- Never use `-i` flags (`git commit -i`, `git rebase -i`, etc.)
19 changes: 19 additions & 0 deletions pgxntool/.claude/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"permissions": {
"allow": [
"Bash(cat:*)",
"Bash(make test:*)",
"Bash(tee:*)",
"Bash(echo:*)",
"Bash(git show:*)",
"Bash(git log:*)",
"Bash(ls:*)",
"Bash(find:*)",
"Bash(git checkout:*)",
"Bash(head:*)"
],
"additionalDirectories": [
"../pgxntool-test/"
]
}
}
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