@@ -2644,6 +2644,74 @@ RETURNS TEXT AS $$
2644
2644
SELECT ok( NOT _got_func($1), 'Function ' || quote_ident($1) || '() should not exist' );
2645
2645
$$ LANGUAGE sql;
2646
2646
2647
+ -- function_checksum_is( function, md5, description )
2648
+ -- We don't have the prototype, so just check the first one found
2649
+ CREATE OR REPLACE FUNCTION function_checksum_is( NAME, text, text )
2650
+ RETURNS TEXT AS $$
2651
+ SELECT is(md5( p.prosrc), $2, $3)
2652
+ FROM tap_funky t
2653
+ JOIN pg_proc p ON (p.oid=t.oid)
2654
+ WHERE t.name=$1
2655
+ AND pg_function_is_visible(t.oid) LIMIT 1;
2656
+ $$ LANGUAGE sql;
2657
+
2658
+ -- function_checksum_is( schema, function, md5, description )
2659
+ CREATE OR REPLACE FUNCTION function_checksum_is( NAME, NAME, text, text )
2660
+ RETURNS TEXT AS $$
2661
+ SELECT is(md5( p.prosrc), $3, $4)
2662
+ FROM tap_funky t
2663
+ JOIN pg_proc p ON (p.oid=t.oid)
2664
+ WHERE t.name = $2
2665
+ AND t.schema=$1 LIMIT 1;
2666
+ $$ LANGUAGE sql;
2667
+
2668
+ -- function_checksum_is( function, args, md5, description )
2669
+
2670
+ CREATE OR REPLACE FUNCTION function_checksum_is( NAME, NAME[], text, text )
2671
+ RETURNS TEXT AS $$
2672
+ SELECT is(md5( p.prosrc), $3, $4)
2673
+ FROM tap_funky t
2674
+ JOIN pg_proc p ON (p.oid=t.oid)
2675
+ WHERE t.name = $1
2676
+ AND pg_function_is_visible(t.oid)
2677
+ AND t.args=array_to_string($2,',');
2678
+ $$ LANGUAGE sql;
2679
+
2680
+ -- function_checksum_is( schema, function, args, md5, description )
2681
+ CREATE OR REPLACE FUNCTION function_checksum_is( NAME, NAME, NAME[], text, text )
2682
+ RETURNS TEXT AS $$
2683
+ SELECT is(md5( p.prosrc), $4, $5)
2684
+ FROM tap_funky t
2685
+ JOIN pg_proc p ON (p.oid=t.oid)
2686
+ WHERE t.name = $2
2687
+ AND t.schema=$1
2688
+ AND t.args=array_to_string($3,',');
2689
+ $$ LANGUAGE sql;
2690
+
2691
+ -- function_checksum_is( function, md5 )
2692
+ CREATE OR REPLACE FUNCTION function_checksum_is( NAME, text)
2693
+ RETURNS TEXT AS $$
2694
+ SELECT function_checksum_is($1,$2,'Function ' || quote_ident($1) || ' Checksum');
2695
+ $$ LANGUAGE sql;
2696
+
2697
+ -- function_checksum_is( schema, function, md5)
2698
+ CREATE OR REPLACE FUNCTION function_checksum_is( NAME, NAME, text)
2699
+ RETURNS TEXT AS $$
2700
+ SELECT function_checksum_is($1,$2,$3,'Function ' || quote_ident($1) || '.' || quote_ident($2) || ' Checksum');
2701
+ $$ LANGUAGE sql;
2702
+
2703
+ -- function_checksum_is( function, args, md5)
2704
+ CREATE OR REPLACE FUNCTION function_checksum_is( NAME, NAME[], text)
2705
+ RETURNS TEXT AS $$
2706
+ SELECT function_checksum_is($1,$2,$3,'Function ' || quote_ident($1) || ' Checksum');
2707
+ $$ LANGUAGE sql;
2708
+
2709
+ -- function_checksum_is( schema, function, args, md5)
2710
+ CREATE OR REPLACE FUNCTION function_checksum_is( NAME, NAME, NAME[], text)
2711
+ RETURNS TEXT AS $$
2712
+ SELECT function_checksum_is($1,$2,$3,$4,'Function ' || quote_ident($1) || '.' || quote_ident($2) || ' Checksum');
2713
+ $$ LANGUAGE sql;
2714
+
2647
2715
CREATE OR REPLACE FUNCTION _pg_sv_type_array( OID[] )
2648
2716
RETURNS NAME[] AS $$
2649
2717
SELECT ARRAY(
0 commit comments