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
-- requires dblink extension the be installed | |
-- vacuum a schema via dblink | |
create or replace function vacuum_schema(schemaname text) | |
returns void | |
language plpgsql | |
as | |
$func$ | |
declare |
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 |
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
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 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
#!/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
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
with recursive | |
dag (depended_on,dependent) as | |
( | |
values | |
('b2'::text,'d1'::text), | |
('d1','d2'), | |
('d2','d3'), | |
('d3','d4'), | |
('b1','a1'), | |
('b2','a1'), |
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
#!/bin/sh | |
set -e | |
# Based on nealmcb's + ErebusBat's script from http://serverfault.com/questions/211425/ | |
# put this file in etckeeeper's commit.d directory | |
# in the config file set MIRROR_ROOT (somewhere under /etc) MIRROR_FILES and MIRROR_DIRS | |
# the latter two can contain wildcards | |
# all three symbols must be exported or they won't be seen by this script |
OlderNewer