Skip to content

Commit 942608a

Browse files
Merge pull request #1072 from EnterpriseDB/content/pem/8.0.1/format-fix-for-upgrade-guide
Formatting for a note is fixed in PEM Upgrade guide Former-commit-id: e42a637
2 parents c441e83 + f808ece commit 942608a

File tree

4 files changed

+67
-70
lines changed

4 files changed

+67
-70
lines changed

product_docs/docs/pem/8.0.1/pem_upgrade/02_upgrading_backend_database.mdx

Lines changed: 53 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -12,57 +12,56 @@ The update process described in this section uses the `pg_upgrade` utility to mi
1212
!!! Note
1313
If the source PEM Server is lower than the 7.16 version, then you need to replace the following functions before you run `pg_upgrade`:
1414

15-
````
16-
- The `abstime`, `reltime`, and `tinterval` datatypes are depreacated from Postgres version 12 or later, hence to replace those dataypes with `timestamptz` data type use below command:
17-
18-
```text
19-
DO
20-
$$
21-
DECLARE
22-
rec record;
23-
cnt integer;
24-
BEGIN
25-
-- Check for the deprecated type in our user info probe
26-
SELECT count(*) INTO cnt
27-
FROM pem.probe_column
28-
WHERE sql_data_type = ‘abstime’ AND internal_name = ‘valuntil’;
29-
IF cnt = 0 THEN
30-
RETURN;
31-
END IF;
32-
ALTER TABLE pemdata.user_info
33-
ALTER COLUMN valuntil SET DATA TYPE timestamptz;
34-
ALTER TABLE pemhistory.user_info
35-
ALTER COLUMN valuntil SET DATA TYPE timestamptz;
36-
-- Now update the pem.probe_column itself
37-
UPDATE pem.probe_column
38-
SET sql_data_type = ‘timestamptz’
39-
WHERE sql_data_type = ‘abstime’ AND internal_name = ‘valuntil’;
40-
END;
41-
$$ LANGUAGE ‘plpgsql’;
42-
```
43-
44-
- Replace the below function to avoid any alert errors:
45-
46-
```text
47-
CREATE OR REPLACE FUNCTION pem.check_alert_params_array_size(
48-
template_id pem.alert_template.id%type, params text[]
49-
)
50-
RETURNS bool AS $FUNC$
51-
DECLARE
52-
res bool := TRUE;
53-
BEGIN
54-
/*
55-
* During restoring the pem database, it does not maintain the order while
56-
* inserting data in the table, and uses the sort table based on the
57-
* names.
58-
* Hence - we need to check the foreign key constraint is present before
59-
* validating these values.
60-
*/
61-
IF EXISTS(
62-
SELECT 1 FROM information_schema.table_constraints
63-
WHERE constraint_name='alert_template_id_fkey' AND
64-
table_name='alert' AND table_schema='pem'
65-
) THEN
15+
- The `abstime`, `reltime`, and `tinterval` datatypes are deprecated from Postgres version 12 or later, hence to replace those dataypes with `timestamptz` data type use below command:
16+
17+
```text
18+
DO
19+
$$
20+
DECLARE
21+
rec record;
22+
cnt integer;
23+
BEGIN
24+
-- Check for the deprecated type in our user info probe
25+
SELECT count(*) INTO cnt
26+
FROM pem.probe_column
27+
WHERE sql_data_type = ‘abstime’ AND internal_name = ‘valuntil’;
28+
IF cnt = 0 THEN
29+
RETURN;
30+
END IF;
31+
ALTER TABLE pemdata.user_info
32+
ALTER COLUMN valuntil SET DATA TYPE timestamptz;
33+
ALTER TABLE pemhistory.user_info
34+
ALTER COLUMN valuntil SET DATA TYPE timestamptz;
35+
-- Now update the pem.probe_column itself
36+
UPDATE pem.probe_column
37+
SET sql_data_type = ‘timestamptz’
38+
WHERE sql_data_type = ‘abstime’ AND internal_name = ‘valuntil’;
39+
END;
40+
$$ LANGUAGE ‘plpgsql’;
41+
```
42+
43+
- Replace the below function to avoid any alert errors:
44+
45+
```text
46+
CREATE OR REPLACE FUNCTION pem.check_alert_params_array_size(
47+
template_id pem.alert_template.id%type, params text[]
48+
)
49+
RETURNS bool AS $FUNC$
50+
DECLARE
51+
res bool := TRUE;
52+
BEGIN
53+
/*
54+
* During restoring the pem database, it does not maintain the order while
55+
* inserting data in the table, and uses the sort table based on the
56+
* names.
57+
* Hence - we need to check the foreign key constraint is present before
58+
* validating these values.
59+
*/
60+
IF EXISTS(
61+
SELECT 1 FROM information_schema.table_constraints
62+
WHERE constraint_name='alert_template_id_fkey' AND
63+
table_name='alert' AND table_schema='pem'
64+
) THEN
6665
/*
6766
* Need to use the IS TRUE construct outside the main query, because
6867
* otherwise if there's no template by that ID then the query would return
@@ -83,10 +82,9 @@ BEGIN
8382
$SQL$ INTO res USING template_id, params;
8483
END IF;
8584
RETURN res;
86-
END
87-
$FUNC$ LANGUAGE 'plpgsql';
88-
```
89-
````
85+
END
86+
$FUNC$ LANGUAGE 'plpgsql';
87+
```
9088

9189
`pg_upgrade` supports a transfer of data between servers of the same type. For example, you can use `pg_upgrade` to move data from a PostgreSQL 9.6 backend database to a PostgreSQL 11 backend database, but not to an Advanced Server 11 backend database. If you wish to migrate to a different type of backend database (i.e from a PostgreSQL server to Advanced Server), see [Moving the Postgres Enterprise Manager Server](03_moving_pem_server).
9290

product_docs/docs/pem/8.0.1/pem_upgrade/03_moving_pem_server.mdx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ Before starting the server migration, you should ensure that the firewalls betwe
8080
8181
Note that invoking the `pg_dump` utility will not interrupt current database users.
8282
83-
!!! Note
84-
If the source PEM Server is lower than the 7.16 version, then you need to replace the following functions before you run `pg_dump` to take backup:
83+
!!! Note
84+
If the source PEM Server is lower than the 7.16 version, then you need to replace the following functions before you run `pg_dump` to take backup:
8585
86-
````
87-
- The ``abstime``, ``reltime``, and ``tinterval`` datatypes are depreacated from Postgres version 12 or later, hence to replace those dataypes with ``timestamptz`` data type use below command:
86+
87+
- The ``abstime``, ``reltime``, and ``tinterval`` datatypes are deprecated from Postgres version 12 or later, hence to replace those dataypes with ``timestamptz`` data type use below command:
8888
8989
```text
9090
DO
@@ -112,7 +112,7 @@ Before starting the server migration, you should ensure that the firewalls betwe
112112
$$ LANGUAGE ‘plpgsql’;
113113
```
114114

115-
- Replace the below function to avoid any alert errors:
115+
- Replace the below function to avoid any alert errors:
116116

117117
```text
118118
CREATE OR REPLACE FUNCTION pem.check_alert_params_array_size(
@@ -157,7 +157,6 @@ Before starting the server migration, you should ensure that the firewalls betwe
157157
END
158158
$FUNC$ LANGUAGE 'plpgsql';
159159
```
160-
````
161160

162161

163162
5. Move the Backup to the Target Host

product_docs/docs/pem/8.0/pem_upgrade/02_upgrading_backend_database.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ legacyRedirectsGenerated:
88

99
If you are updating both PEM components and the PEM backend database, you should perform PEM component updates (the server and Agent) before updating the backend database. For more information about updating PEM component software, see [Upgrading a PEM Installation](01_upgrading_pem_installation/#upgrading_pem_installation).
1010

11-
!!! Note
12-
From PEM 8.0 onwards, the PostgreSQL or EPAS version 11 or higher are only supported as backend database server. Hence if your backend database server is lower than version 11 then first you need to upgrade your backend database server and then upgrade the PEM components.
11+
!!! Note
12+
From PEM 8.0 onwards, the PostgreSQL or EPAS version 11 or higher are only supported as backend database server. Hence if your backend database server is lower than version 11 then first you need to upgrade your backend database server and then upgrade the PEM components.
1313

1414
The update process described in this section uses the `pg_upgrade` utility to migrate from one version of the backend server to a more recent version. `pg_upgrade` facilitates migration between any version of Postgres (version 9.5 or later), and any subsequent release of Postgres that is supported on the same platform.
1515

1616
!!! Note
17-
If the source PEM Server is lower than the 7.16 version, then you need to replace the following functions before you run `pg_upgrade`:
17+
If the source PEM Server is lower than the 7.16 version, then you need to replace the following functions before you run `pg_upgrade`:
1818

19-
- The `abstime`, `reltime`, and `tinterval` datatypes are depreacated from Postgres version 12 or later, hence to replace those dataypes with `timestamptz` data type use below command:
19+
- The `abstime`, `reltime`, and `tinterval` datatypes are deprecated from Postgres version 12 or later, hence to replace those dataypes with `timestamptz` data type use following command:
2020

2121
```text
2222
DO
@@ -44,7 +44,7 @@ If the source PEM Server is lower than the 7.16 version, then you need to replac
4444
$$ LANGUAGE ‘plpgsql’;
4545
```
4646

47-
- Replace the below function to avoid any alert errors:
47+
- Replace the below function to avoid any alert errors:
4848

4949
```text
5050
CREATE OR REPLACE FUNCTION pem.check_alert_params_array_size(

product_docs/docs/pem/8.0/pem_upgrade/03_moving_pem_server.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ Before starting the server migration, you should ensure that the firewalls betwe
8484
8585
Note that invoking the `pg_dump` utility will not interrupt current database users.
8686
87-
!!! Note
88-
If the source PEM Server is lower than the 7.16 version, then you need to replace the following functions before you run ``pg_dump`` to take backup:
87+
!!! Note
88+
If the source PEM Server is lower than the 7.16 version, then you need to replace the following functions before you run ``pg_dump`` to take backup:
8989
90-
- The ``abstime``, ``reltime``, and ``tinterval`` datatypes are depreacated from Postgres version 12 or later, hence to replace those dataypes with ``timestamptz`` data type use below command:
90+
- The ``abstime``, ``reltime``, and ``tinterval`` datatypes are depreacated from Postgres version 12 or later, hence to replace those dataypes with ``timestamptz`` data type use below command:
9191
9292
```text
9393
DO
@@ -115,7 +115,7 @@ Before starting the server migration, you should ensure that the firewalls betwe
115115
$$ LANGUAGE ‘plpgsql’;
116116
```
117117

118-
- Replace the below function to avoid any alert errors:
118+
- Replace the below function to avoid any alert errors:
119119

120120
```text
121121
CREATE OR REPLACE FUNCTION pem.check_alert_params_array_size(

0 commit comments

Comments
 (0)