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

Subscribers

People subscribed via source and target branches

to status/vote changes: