Skip to content
Merged
Changes from all commits
Commits
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
14 changes: 14 additions & 0 deletions CODE_STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ across Postgres-Extensions repos.
the same comment verbatim in adjacent code — write it once and reference
it ("same as above").

## Prefer `%TYPE` over a hardcoded type

When a function parameter, variable, or column exists to hold a copy of
another table's column value, declare it as `table.column%TYPE` instead of
hardcoding the type. This ties the declaration to the column's actual
type, so a future column type change doesn't silently create a mismatch
that a hardcoded type would miss.

Don't "clean up" an existing `%TYPE` reference by replacing it with the
literal type it currently resolves to — that's removing the exact
protection it exists to provide, not simplifying dead weight (see
[Postgres-Extensions/test_factory#18](https://github.com/Postgres-Extensions/test_factory/pull/18),
where this was done and then reverted).

## Don't set `client_min_messages` inside an extension install script

`CREATE EXTENSION`/`ALTER EXTENSION UPDATE` already forces
Expand Down