NAME
DBIO::PostgreSQL::Introspect::Columns - Introspect PostgreSQL table columns
VERSION
version 0.900007
DESCRIPTION
Fetches column metadata for all tables from pg_catalog.pg_attribute, including data types (via format_type), nullability, default expressions, identity/generated column markers, and enum/composite type names. Relations an installed extension owns are left out by DBIO::PostgreSQL::Introspect::Tables, and their columns with them.
METHODS
fetch
my $columns = DBIO::PostgreSQL::Introspect::Columns->fetch($dbh, $filter);
Returns a hashref keyed by schema.table. Each value is an ArrayRef of column hashrefs ordered by attnum. Each column hashref has keys: column_name, ordinal, data_type, not_null, default_value, identity, generated, is_local, comment, type_category, enum_type, composite_type, type_schema, depends_on_columns.
depends_on_columns is, for a generated column, the other columns of the table its expression reads: an ArrayRef of names, sorted, from the pg_depend rows of the column's default entry (pg_attrdef). It is empty for every other column. PostgreSQL does not alter the type of a column a generated column reads (cannot alter type of a column used by a generated column); DBIO::PostgreSQL::Diff::Column asks it before it changes one.
is_local is true for a column the table defines itself and false for one it only has from a table it inherits from or is a partition of (pg_attribute.attislocal). Every column of a partition is of the second kind. A table that inherits can define a column itself that it inherits as well; that one is true, and it stays behind as the table's own when the table it came from drops it. DBIO::PostgreSQL::Diff::Column reads it for that.
data_type and default_value are written by the server for the session that asks: a type, a function or a sequence in them comes without its schema whenever that session's search_path finds it. A model read with "qualified_names" in DBIO::PostgreSQL::Introspect (the default) reads them under an empty one, so they always come with it: public.mood, public.vector(3), nextval('public.thing_id_seq'::regclass).
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.