DBIO-PostgreSQL

 view release on metacpan or  search on metacpan

lib/DBIO/PostgreSQL/Diff/Extension.pm  view on Meta::CPAN

operation.

=head1 ATTRIBUTES

=head2 extension_name

The PostgreSQL extension name (e.g. C<pgcrypto>, C<postgis>).

=head2 extension_info

Extension metadata hashref (C<version>, C<schema_name>, C<relocatable>).

=head1 METHODS

=head2 diff

    my @ops = DBIO::PostgreSQL::Diff::Extension->diff($source, $target);

Compares extension hashrefs. Produces C<create>, C<update> (version changed),
or C<drop> operations.

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



sub fetch {
  my ($class, $dbh) = @_;

  my $sql = q{
    SELECT
      e.extname AS extension_name,
      e.extversion AS version,
      n.nspname AS schema_name,
      e.extrelocatable AS relocatable
    FROM pg_catalog.pg_extension e
    JOIN pg_catalog.pg_namespace n ON n.oid = e.extnamespace
    WHERE e.extname != 'plpgsql'
    ORDER BY e.extname
  };

  my $sth = $dbh->prepare($sql);
  $sth->execute;

  my %extensions;
  while (my $row = $sth->fetchrow_hashref) {
    $extensions{ $row->{extension_name} } = {
      extension_name => $row->{extension_name},
      version        => $row->{version},
      schema_name    => $row->{schema_name},
      relocatable    => $row->{relocatable} ? 1 : 0,
    };
  }

  return \%extensions;
}

1;

__END__

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

since it is always present.

=head1 METHODS

=head2 fetch

    my $extensions = DBIO::PostgreSQL::Introspect::Extensions->fetch($dbh);

Returns a hashref keyed by extension name. Each entry has:
C<extension_name>, C<version>, C<schema_name> (the schema the extension's
objects live in), C<relocatable>.

No schema filter is accepted — extensions are database-level objects.

=head1 AUTHOR

DBIO & DBIx::Class Authors

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2026 DBIO Authors



( run in 1.326 second using v1.01-cache-2.11-cpan-84de2e75c66 )