NAME

DBIx::QuickORM::Dialect::PostgreSQL - PostgreSQL dialect for DBIx::QuickORM.

DESCRIPTION

The PostgreSQL-specific DBIx::QuickORM::Dialect. Introspects schema metadata from information_schema and the pg_* catalogs, drives transactions and savepoints via the DBD::Pg driver, supports async queries, and maps logical types (such as uuid) to native ones.

SYNOPSIS

my $dialect = DBIx::QuickORM::Dialect::PostgreSQL->new(dbh => $dbh, db_name => $name);

PUBLIC METHODS

$driver = $dialect->dbi_driver
$name = $dialect->dialect_name
$value = $dialect->quote_binary_data
$bool = $dialect->supports_returning_update
$bool = $dialect->supports_returning_insert
$bool = $dialect->supports_returning_delete
$bool = $dialect->async_supported
$bool = $dialect->async_cancel_supported

Feature flags and constants describing the PostgreSQL dialect.

$dialect->async_prepare_args

Bind args to issue a statement asynchronously.

$result = $dialect->async_result(%params)
$bool = $dialect->async_ready(%params)
$dialect->async_cancel(%params)

Async query lifecycle: collect a result, check readiness, or cancel.

$dialect->start_txn(%params)
$dialect->commit_txn(%params)
$dialect->rollback_txn(%params)
$dialect->create_savepoint(%params)
$dialect->commit_savepoint(%params)
$dialect->rollback_savepoint(%params)

Transaction and savepoint control via DBD::Pg. Each accepts an optional dbh parameter, defaulting to the dialect's own handle; savepoint methods take a savepoint name.

$stype = $dialect->supports_type($type)

Returns the native type name for a supported logical type (e.g. uuid, jsonb), or nothing. Note: json requires PostgreSQL 9.2+ and jsonb 9.4+.

$version = $dialect->db_version

The PostgreSQL server version.

PUBLIC METHODS

$tables = $dialect->build_tables_from_db(%params)

Introspects all tables and views visible through the connection's search_path and returns a hashref of name to schema-table object. When the same table name exists in more than one schema on the path, the first match in search_path order wins, mirroring how PostgreSQL itself resolves unqualified names.

($pk, $unique, $links) = $dialect->build_table_keys_from_db($table, %params)

Introspects a table's primary key, unique keys, and foreign-key links from the pg_constraint catalog, scoped to the table's schema (the table_schema param, or the first search_path schema containing the table).

$columns = $dialect->build_columns_from_db($table, %params)

Introspects a table's columns from information_schema.columns, scoped to the table's schema (the table_schema param, or the first search_path schema containing the table), and returns a hashref of column name to column object.

PRIVATE METHODS

$bool = $dialect->_col_field_to_bool($val)

Normalizes an information_schema truthy/falsey string (YES/NO, etc.) to a 1/0 boolean.

PUBLIC METHODS

$indexes = $dialect->build_indexes_from_db($table, %params)

Introspects a table's indexes from the pg_index/pg_attribute catalogs, scoped to the table's schema (the table_schema param, or the first search_path schema containing the table), and returns an arrayref of index specs.

PRIVATE METHODS

$schemas = $dialect->_search_path_schemas

Arrayref of schema names visible to the connection, in search_path priority order (the session's temp schema first when one exists), excluding the system catalogs.

$schema_or_undef = $dialect->_table_schema($table)

The first schema in search_path order that contains the named table, or undef when none does.

@idents = $dialect->_split_identifiers($list)

Split a comma-separated identifier list from pg_get_constraintdef output, stripping double quotes from each identifier.

$ident = $dialect->_unquote_identifier($ident)

Strip surrounding double quotes (and unescape doubled inner quotes) from an identifier captured out of pg_get_constraintdef output.

$table = $dialect->_referenced_table($target)

The (unquoted) table name from a REFERENCES target, dropping any schema qualification.

SOURCE

The source code repository for DBIx::QuickORM can be found at https://github.com/exodist/DBIx-QuickORM.

MAINTAINERS

Chad Granum <exodist@cpan.org>

AUTHORS

Chad Granum <exodist@cpan.org>

COPYRIGHT

Copyright Chad Granum <exodist7@gmail.com>.

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

See https://dev.perl.org/licenses/