NAME

DBIO::PostgreSQL::Introspect::Types - Introspect PostgreSQL types (enums, composites, ranges)

VERSION

version 0.900007

DESCRIPTION

Fetches user-defined type metadata from pg_catalog: enum types (with ordered values), composite types (with attributes), and range types (with subtype). System types are excluded, and so are the types an installed extension owns (a pg_depend row of deptype e): CREATE EXTENSION / DROP EXTENSION own them, so they are not the schema's to create or drop.

METHODS

fetch

my $types = DBIO::PostgreSQL::Introspect::Types->fetch($dbh, $filter);

Returns a hashref keyed by schema.type_name. Each value is a hashref with schema_name, type_name, type_kind (enum, composite, or range), and kind-specific fields:

enum: values (ArrayRef, sorted by enumsortorder; empty for an enum without values)
composite: attributes (ArrayRef of { name, type, ordinal }, and collation where the attribute has one other than its type's default; empty for a composite type without attributes)
range: subtype (subtype name string), and, only where the type sets it, collation, subtype_opclass (an operator class that is not the subtype's default), canonical and subtype_diff (functions)

A collation, operator class or function is written with its schema, each part quoted by the server's rule (pg_catalog.float8mi, pg_catalog."C"), so that the text can be put into a CREATE TYPE as it is. A key the type does not set is not in the entry; the diff takes a missing key and an undefined one for the same ("diff" in DBIO::PostgreSQL::Diff::Type).

AUTHOR

DBIO & DBIx::Class Authors

COPYRIGHT AND LICENSE

Copyright (C) 2026 DBIO Authors Portions Copyright (C) 2005-2025 DBIx::Class Authors Based on DBIx::Class, heavily modified.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.