Andrew Dunstan adunstan

View vacuum_schema.sql
1 2 3 4 5 6 7 8 9 10
-- 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
View json_utf8_pix.patch
1 2 3 4 5 6 7 8 9 10
diff --git a/src/backend/utils/adt/json.c b/src/backend/utils/adt/json.c
index aaf99bd..2092b60 100644
--- a/src/backend/utils/adt/json.c
+++ b/src/backend/utils/adt/json.c
@@ -646,6 +646,7 @@ json_lex_string(JsonLexContext *lex)
{
char *s;
int len;
+ int hi_surrogate = -1;
View explain_url.sql
1 2 3 4 5 6 7 8 9 10
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";
View Dist.pm
1 2 3 4 5 6 7 8 9 10
package PGBuild::Modules::Dist;
 
use PGBuild::Options;
use PGBuild::SCM;
 
use strict;
 
use vars qw($VERSION); $VERSION = 'REL_4.6';
 
my $hooks = {
View dumpToc.pl
1 2 3 4 5 6 7 8 9 10
#!/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;
View viewtables.sql
1 2 3 4 5 6 7 8 9 10
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)
{
View setcluster.sql
1 2 3 4 5 6 7 8 9 10
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
View make_type_list.sql
1 2 3 4 5 6 7 8 9 10
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 := '';
View skeleton_query.sql
1 2 3 4 5 6 7 8 9 10
create or replace function make_select_query (tablename text, tablealias text default null)
returns text
language plpgsql as
$$
 
declare
rec record;
crec record;
firstrow boolean := true;
result text := '';
View gist:803432
1 2 3 4 5 6 7 8 9 10
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
Something went wrong with that request. Please try again.