@@ -31,12 +31,12 @@ begin
3131 constraint = coalesce(" constraint" , ' ' ),
3232 table = coalesce(" table" , ' ' ),
3333 schema = coalesce(" schema" , ' ' ),
34- datatype = pg_typeof(value);
34+ datatype = pg_typeof(value):: text ;
3535 return null ::bool;
3636end;
3737$$;
3838
39- -- TEST
39+ -- TEST FUNCTION
4040do $$
4141 DECLARE
4242 i int not null default 0 ;
@@ -92,15 +92,25 @@ do $$
9292 END;
9393$$;
9494
95- /*
96- --explain
95+ -- ----------------------------------------------------------------------------------------------------------------------
96+ -- USE EXAMPLE 1
97+ select case finger
98+ when 1 then ' one'
99+ when 2 then ' two'
100+ when 3 then ' three'
101+ when 4 then ' four'
102+ when 5 then ' five'
103+ else raise_exception(finger)::text
104+ end
105+ from unnest(array[1 , 2 , 3 , 4 , 5 ]::int []) as hand(finger);
106+ 107+ -- USE EXAMPLE 2
97108select i
98- from generate_series(1, 3000000 ) as x(i)
109+ from generate_series(1 , 300 ) as x(i)
99110where case when clock_timestamp() - statement_timestamp() < ' 1s'
100111 then true
101112 else raise_exception(i)
102113 end
103114order by i;
104- */
105115
106- -- https://stackoverflow.com/questions/24882630/equivalent-or-alternative-method-for-raise-exception-statement-for-function-in-l
116+ -- TODO https://stackoverflow.com/questions/24882630/equivalent-or-alternative-method-for-raise-exception-statement-for-function-in-l
0 commit comments