This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION public.explain_url(query text) | |
RETURNS text | |
LANGUAGE plperlu | |
AS $function$ | |
my $query = shift; | |
elog(ERROR,"not an explain query") unless $query =~ /^\s*explain\s/i; | |
my $rv = spi_exec_query($query); | |
my $nrows = $rv->{processed}; | |
my $text = $query . "\n QUERY PLAN\n-------------------\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package PGBuild::Modules::Dist; | |
use PGBuild::Options; | |
use PGBuild::SCM; | |
use strict; | |
use vars qw($VERSION); $VERSION = 'REL_4.6'; | |
my $hooks = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use YAML; | |
my @formats = qw(Unknown Custom Files Tar Null Directory); | |
my @sections = qw(None PreData Data PostData); | |
my $result = []; | |
my $toc = []; | |
my %globs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION public.viewtables(viewname text) | |
RETURNS SETOF text | |
LANGUAGE plperl | |
AS $function$ | |
my $viewname = shift; | |
my $rv = spi_exec_query("explain (format yaml, verbose) SELECT * FROM $viewname"); | |
my $resp = $rv->{rows}[0]->{'QUERY PLAN'}; | |
my %tbls; | |
while ($resp =~ /Relation Name: (".*")\n\s+Schema: (".*")\n/g) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
do $$ | |
declare | |
rec record; | |
cmd text; | |
begin | |
for rec in | |
select n.nspname, rc.relname as tbl, ic.relname as idx | |
from pg_index i | |
join pg_class ic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create or replace function make_type_list(tablename text, typealias text default null) returns text | |
language plpgsql as | |
$$ | |
declare | |
rec record; | |
crec record; | |
firstrow boolean := true; | |
talias text := ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create or replace function make_select_query (tablename text, tablealias text default null, compact boolean default false) | |
returns text | |
language plpgsql as | |
$$ | |
declare | |
rec record; | |
crec record; | |
firstrow boolean := true; | |
result text := ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create or replace function xml2json (xml) returns text | |
language plperlu as | |
$func$ | |
use XML::XML2JSON; | |
use strict; | |
my $xml = shift; | |
my $XML2JSON = XML::XML2JSON->new(pretty => 0); # 1 for readable json |
NewerOlder