Re: regexp_replace to remove sql comments - Mailing list pgsql-general

From Mike
Subject Re: regexp_replace to remove sql comments
Date
Msg-id 5631531A.2030305@wolman.co.uk
Whole thread Raw
In response to Re: regexp_replace to remove sql comments  (Marc Mamin <M.Mamin@intershop.de>)
Responses Re: regexp_replace to remove sql comments
List pgsql-general
Thanks with a bit of moving stuff about I think thats sorted it - in
case anyone every needs it:

   SELECT
    query,
      trim(regexp_replace(
         regexp_replace(
            regexp_replace(query,'\/\*.+\*\/','','g'),
         '--[^\r\n]*', ' ', 'g')
      , '\s+', ' ', 'g')) as q
    FROM public.pg_stat_statements
    WHERE dbid IN (SELECT oid FROM pg_database WHERE datname =
  current_database())

  order by query

Thanks again,

Mike.

On 28/10/2015 22:43, Marc Mamin wrote:
> ', '\/\*.+\*\/','','g'):



pgsql-general by date:

Previous
From: Marc Mamin
Date:
Subject: Re: regexp_replace to remove sql comments
Next
From: Tom Lane
Date:
Subject: Re: regexp_replace to remove sql comments