Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Add missing psql function domain (thanks sjuxax)
  • Loading branch information
ketralnis committed Oct 18, 2010
1 parent 7c8ea0b commit f81c926
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sql/functions.sql
Expand Up @@ -36,9 +36,13 @@ create or replace function ip_network(ip text) returns text as $$
select substring($1 from E'[\\d]+\.[\\d]+\.[\\d]+')
$$ language sql immutable;

create or replace function base_url(url texT) returns text as $$
create or replace function base_url(url text) returns text as $$
select substring($1 from E'(?i)(?:.+?://)?(?:www[\\d]*\\.)?([^#]*[^#/])/?')
$$ language sql immutable;

create or replace function domain(url text) returns text as $$
select substring($1 from E'(?i)(?:.+?://)?(?:www[\\d]*\\.)?([^#/]*)/?')
$$ language sql immutable;

create view active as
select pg_stat_activity.procpid, (now() - pg_stat_activity.query_start) as t, pg_stat_activity.current_query from pg_stat_activity where (pg_stat_activity.current_query <> '<IDLE>'::text) order by (now() - pg_stat_activity.query_start);

0 comments on commit f81c926

Please sign in to comment.