DBIO-PostgreSQL

 view release on metacpan or  search on metacpan

lib/DBIO/PostgreSQL/Introspect/Policies.pm  view on Meta::CPAN


DBIO::PostgreSQL::Introspect::Policies - Introspect PostgreSQL Row Level Security policies

=head1 VERSION

version 0.900001

=head1 DESCRIPTION

Fetches Row Level Security policy metadata from C<pg_catalog.pg_policy>.
Policy command types and USING/WITH CHECK expressions are decoded from
PostgreSQL's internal representation.

=head1 METHODS

=head2 fetch

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

Returns a hashref keyed by C<schema.table>. Each value is a hashref keyed by
policy name. Each policy entry has: C<policy_name>, C<command> (C<SELECT>,

lib/DBIO/PostgreSQL/Introspect/Triggers.pm  view on Meta::CPAN


=head1 VERSION

version 0.900001

=head1 DESCRIPTION

Fetches user-defined trigger metadata from C<pg_catalog.pg_trigger>. Internal
(constraint) triggers are excluded. Timing (C<BEFORE>/C<AFTER>/C<INSTEAD OF>),
event (C<INSERT>/C<UPDATE>/C<DELETE>/C<TRUNCATE>), and orientation
(C<ROW>/C<STATEMENT>) are decoded from the C<tgtype> bitmask.

=head1 METHODS

=head2 fetch

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

Returns a hashref keyed by C<schema.table>. Each value is a hashref keyed by
trigger name. Each trigger entry has: C<trigger_name>, C<definition> (from
C<pg_get_triggerdef>), C<timing>, C<event>, C<orientation>, C<enabled>.

t/33-introspect-normalize.t  view on Meta::CPAN


# Enum with values passed in
my $enum_info3;
my %info3;
DBIO::PostgreSQL::Introspect::Normalize->data_type(\%info3, {
  data_type     => 'role_type',
  type_category => 'e',
  enum_type     => 'role_type',
  type_schema   => 'public',
}, '{admin,user,guest}');
is_deeply($info3{extra}{list}, ['admin', 'user', 'guest'], 'enum values decoded');

# --- default_value ---

sub _norm_default {
  my ($expr, $is_pk) = @_;
  my %info;
  DBIO::PostgreSQL::Introspect::Normalize->default_value(\%info, $expr, $is_pk);
  return \%info;
}



( run in 1.970 second using v1.01-cache-2.11-cpan-600a1bdf6e4 )