Skip to content

Commit 843679e

Browse files
the1forteJonathan S. Katz
authored andcommitted
Fix setup.sql to be aligned with current PostgreSQL Operator
The examples in the custom setup.sql file lacked some of the steps that had been added to the PostgreSQL Operator since 4.2 was released, and would cause the setup to fail. This brings it into align with the current state of the Operator. Issue: #1506
1 parent dd7f4cd commit 843679e

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

examples/custom-config/setup.sql

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,45 @@
1+
/*
2+
* Copyright 2017 - 2020 Crunchy Data Solutions, Inc.
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*/
15+
116
--- System Setup
217
SET application_name="container_setup";
318

19+
CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
420
CREATE EXTENSION IF NOT EXISTS pgaudit;
521

6-
CREATE USER PGHA_USER LOGIN;
7-
ALTER USER PGHA_USER PASSWORD 'PGHA_USER_PASSWORD';
8-
9-
CREATE DATABASE PGHA_DATABASE;
10-
GRANT ALL PRIVILEGES ON DATABASE PGHA_DATABASE TO PGHA_USER;
22+
CREATE USER "PGHA_USER" LOGIN;
23+
ALTER USER "PGHA_USER" PASSWORD $$PGHA_USER_PASSWORD$$;
1124

1225
CREATE USER testuser2 LOGIN;
1326
ALTER USER testuser2 PASSWORD 'customconfpass';
1427

15-
CREATE DATABASE PGHA_DATABASE;
16-
GRANT ALL PRIVILEGES ON DATABASE PGHA_DATABASE TO testuser2;
28+
CREATE DATABASE "PGHA_DATABASE";
29+
GRANT ALL PRIVILEGES ON DATABASE "PGHA_DATABASE" TO testuser2;
1730

1831
--- PGHA_DATABASE Setup
1932

20-
\c PGHA_DATABASE
33+
\c "PGHA_DATABASE"
2134

35+
CREATE EXTENSION IF NOT EXISTS pg_stat_statements;
2236
CREATE EXTENSION IF NOT EXISTS pgaudit;
2337

24-
CREATE SCHEMA IF NOT EXISTS PGHA_USER;
38+
CREATE SCHEMA IF NOT EXISTS AUTHORIZATION "PGHA_USER";
2539

2640
/* The following has been customized for the custom-config example */
2741

28-
SET SESSION AUTHORIZATION PGHA_USER;
42+
SET SESSION AUTHORIZATION testuser2;
2943

3044
CREATE TABLE custom_config_table (
3145
KEY VARCHAR(30) PRIMARY KEY,

0 commit comments

Comments
 (0)