Merge lp:~stub/launchpad/postgresql-9.1-db into lp:launchpad/db-devel

Proposed by Stuart Bishop
Status: Merged
Approved by: Stuart Bishop
Approved revision: no longer in the source branch.
Merged at revision: 11350
Proposed branch: lp:~stub/launchpad/postgresql-9.1-db
Merge into: lp:launchpad/db-devel
Diff against target: 44 lines (+40/-0)
1 file modified
database/schema/patch-2209-00-5.sql (+40/-0)
To merge this branch: bzr merge lp:~stub/launchpad/postgresql-9.1-db
Reviewer Review Type Date Requested Status
Stuart Bishop (community) db Approve
Review via email: mp+91772@code.launchpad.net

Description of the change

= Summary =

Some minor database changes are required for the PostgreSQL 9.1 transition.

== Proposed fix ==

== Pre-implementation notes ==

== Implementation details ==

== Tests ==

== Demo and Q/A ==

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  database/schema/patch-2209-00-5.sql

To post a comment you must log in.
Revision history for this message
Stuart Bishop (stub) :
review: Approve (db)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'database/schema/patch-2209-00-5.sql'
--- database/schema/patch-2209-00-5.sql 1970-01-01 00:00:00 +0000
+++ database/schema/patch-2209-00-5.sql 2012-02-07 07:37:27 +0000
@@ -0,0 +1,40 @@
1SET client_min_messages = ERROR;
2
3-- Compatibility code. During transition, we need code that runs with
4-- both PostgreSQL 8.4 and 9.1.
5
6-- This used to be a simple SQL function, but PG 9.1 grew an extra
7-- column to pg_stat_activity. We can revert once PG 8.4
8-- compatibility is not needed.
9-- SELECT
10-- datid, datname, procpid, usesysid, usename,
11-- CASE
12-- WHEN current_query LIKE '<IDLE>%'
13-- OR current_query LIKE 'autovacuum:%'
14-- THEN current_query
15-- ELSE
16-- '<HIDDEN>'
17-- END AS current_query,
18-- waiting, xact_start, query_start,
19-- backend_start, client_addr, client_port
20-- FROM pg_catalog.pg_stat_activity;
21--
22CREATE OR REPLACE FUNCTION activity()
23RETURNS SETOF pg_stat_activity
24VOLATILE SECURITY DEFINER SET search_path = public
25LANGUAGE plpgsql AS $$
26DECLARE
27 a pg_stat_activity%ROWTYPE;
28BEGIN
29 FOR a IN SELECT * FROM pg_stat_activity LOOP
30 IF a.current_query NOT LIKE '<IDLE>%'
31 AND a.current_query NOT LIKE 'autovacuum:%' THEN
32 a.current_query := '<HIDDEN>';
33 END IF;
34 RETURN NEXT a;
35 END LOOP;
36END;
37$$;
38
39
40INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 0, 5);

Subscribers

People subscribed via source and target branches

to status/vote changes: