On Sat, May 4, 2013 at 01:17:44PM -0400, Bruce Momjian wrote:
> Yes, I see it is wrong now. I came up with this new query:
>
> SELECT to_hex(EXTRACT(EPOCH FROM backend_start)::integer) || '.' ||
> regexp_replace('0000' || to_hex(pid), '^0*(.*....)$', '\1')
> FROM pg_stat_activity;
>
> It removes some leading zeros, but guarantees 4 digits.
>
> I have updated to that new query to our docs too. Is there a better
> regex for this?
OK, I thought of a better one:
SELECT to_hex(EXTRACT(EPOCH FROM backend_start)::integer) || '.' ||
regexp_replace('0000' || '0133e3', '^0*(.{4,})$', '\1')
FROM pg_stat_activity;
--
Bruce Momjian <[email protected]> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ It's impossible for everything to be true. +
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers