Skip to content

Commit 790ddd6

Browse files
authored
Merge pull request #2051 from EnterpriseDB/release/2021-11-18
Release/2021 11 18
2 parents e2f4981 + 5a74b10 commit 790ddd6

File tree

10 files changed

+316
-184
lines changed

10 files changed

+316
-184
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,3 +383,7 @@ Option 2: on GitHub
383383

384384
1. Edit a file on GitHub.
385385
2. Submit changes as a PR on a new branch.
386+
387+
### Style Guide for EDB contributors
388+
389+
See [EDB documentation style guide](https://enterprisedb.atlassian.net/wiki/spaces/DCBC/pages/2387870239/Documentation+Style+Guide).
Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
| Product | Key | Tag |
2-
|------------------------------|---------------------------------------------------------|------------------------------------|
3-
| barman | barman | product/barman/*version* |
4-
| Backup and Recovery Tool | bart | product/bart/*version* |
5-
| BDR | bdr | product/bdr/*version* |
6-
| Connectors | *name*-connector, where *name* is jdbc, net, odbc, or ocl | product/*name*-connector/*version* |
7-
| EDB Cloud | edbcloud | product/edbcloud/*version* |
8-
| EDB Postgres Advanced Server | epas | product/epas/*version* |
9-
| Failover Manager | efm | product/efm/*version* |
10-
| Foriegn Data Wrappers | *name*-fdw, where *name* is hadoop, mongo, or mysql | product/*name*-fdw/*version* |
11-
| HARP | harp | product/harp/*version* |
12-
| Migration Portal | mp | product/mp/*version* |
13-
| Migration Toolkit | mtk | product/mtk/*version* |
14-
| Postgres Enterprise Manager | pem | product/pem/*version* |
15-
| pgBackrest | backrest | product/backrest/*version* |
16-
| PgBouncer | pgbouncer | product/pgbouncer/*version* |
1+
| Product | Key | Tag | PM/PO |
2+
|------------------------------|---------------------------------------------------------|------------------------------------| ----- |
3+
| barman | barman | product/barman/*version* | Adam Wright |
4+
| Backup and Recovery Tool | bart | product/bart/*version* | Adam Wright, Robert Haas |
5+
| BDR | bdr | product/bdr/*version* | John Dalton |
6+
| Connectors | *name*-connector, where *name* is jdbc, net, odbc, or ocl | product/*name*-connector/*version* |Eric McCormack (JDBC), Zahid Khan (OCI, ODBC) |
7+
| EDB Cloud | edbcloud | product/edbcloud/*version* | Aislinn Wright |
8+
| EDB Postgres Advanced Server | epas | product/epas/*version* | Robert Haas |
9+
| Failover Manager | efm | product/efm/*version* | John Dalton, Robert Bissett (Bobby) |
10+
| Foriegn Data Wrappers | *name*-fdw, where *name* is hadoop, mongo, or mysql | product/*name*-fdw/*version* | Jeevan Chalke |
11+
| HARP | harp | product/harp/*version* | John Dalton |
12+
| Migration Portal | mp | product/mp/*version* | Prashant Argawal |
13+
| Migration Toolkit | mtk | product/mtk/*version* | Prashant Argawal
14+
| Postgres Enterprise Manager | pem | product/pem/*version* | Anthony Waite, Ashesh Vashi |
15+
| pgBackrest | backrest | product/backrest/*version* | Adam Wright |
16+
| PgBouncer | pgbouncer | product/pgbouncer/*version* | |
1717
| pgPool-II | pgpool | product/pgpool/*version* |
1818
| PostGIS | postgis | product/postgis/*version* |
1919
| PostgreSQL | pgsql | product/pgsql/*version* |
20-
| Replication Manager | repmgr | product/repmgr/*version* |
21-
| Replication Server | eprs | product/eprs/*version* |
22-
| Slony | slony | product/slony/*version* |
20+
| Replication Manager | repmgr | product/repmgr/*version* | John Dalton |
21+
| Replication Server | eprs | product/eprs/*version* | Jphn Dalton |
22+
| Slony | slony | product/slony/*version* | |

product_docs/docs/biganimal/release/using_cluster/06_demonstration_oracle_compatibility.mdx

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
---
22
title: "Demonstration of Oracle SQL compatible functions and syntax"
3-
navTitle: "Demo: Oracle SQL compatibility"
3+
navTitle: "Oracle SQL compatibility"
4+
showInteractiveBadge: true
45
---
56

67
BigAnimal lets you run Oracle SQL queries in the cloud via [EDB Postgres Advanced Server](https://www.enterprisedb.com/docs/epas/latest/epas_compat_ora_dev_guide/). This topic demonstrates two Oracle SQL-syntax queries running unmodified on a BigAnimal test cluster, populated with the [Chinook sample database](https://github.com/lerocha/chinook-database).
78

89
Watch the video, or load up psql and follow along below!
910

1011
<figure class="embed-responsive embed-responsive-16by9">
11-
<iframe src="https://www.youtube.com/embed/lV4QQ53kgew"
12+
<iframe src="https://www.youtube.com/embed/lV4QQ53kgew"
1213
title="Video recording of this demonstration"
13-
class="embed-responsive-item"
14-
frameborder="0"
14+
class="embed-responsive-item"
15+
frameborder="0"
1516
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
1617
</figure>
1718

@@ -37,20 +38,20 @@ postgres://demo:[email protected]:54
3738
In case you're unfamiliar with [PostgreSQL connection URIs](https://www.postgresql.org/docs/current/libpq-connect.html#id-1.7.3.8.3.6), let's break that down:
3839

3940
- `demo` is the user role we're connecting as. This is a user set up with select privileges on the database.
40-
- `password` is the password for this user.
41+
- `password` is the password for this user.
4142
!!! Warning Passwords in connection strings.
4243
This example illustrates a complete connection URL, including the password. This is fine for a demonstration,
43-
and may also be acceptable for applications configuration if access to the configuration is limited.
44+
and may also be acceptable for applications configuration if access to the configuration is limited.
4445
Avoid this practice for admin, superuser, or other roles used interactively - psql will prompt for a password
45-
if none is supplied.
46-
- `p-c64p9a3h5vfavr7tfrjg.qsbilba3hlgp1vqr.biganimal.io` is the host name for the Advanced Server cluster on BigAnimal that I'm connecting to.
46+
if none is supplied.
47+
- `p-c64p9a3h5vfavr7tfrjg.qsbilba3hlgp1vqr.biganimal.io` is the host name for the Advanced Server cluster on BigAnimal that I'm connecting to.
4748
- `5432` is the usual PostgreSQL port number.
4849
- `chinook` is the name of the database.
4950
- `sslmode=require` ensures that we establish a secure connection.
5051

5152
With that in hand, we can launch psql:
5253

53-
```shell
54+
```shell
5455
psql postgres://demo:[email protected]:5432/chinook?sslmode=require
5556
__OUTPUT__
5657
psql (13.0 (Debian 13.0-1.pgdg100+1), server 13.4.8 (Debian 13.4.8-1+deb10))
@@ -86,7 +87,7 @@ __OUTPUT__
8687
...
8788
```
8889

89-
There's an employee table, let's examine its definition:
90+
There's an employee table, let's examine its definition:
9091

9192
```
9293
\d+ employee
@@ -117,17 +118,17 @@ other employees who may in turn report to still *other* employees.
117118

118119
## Demo #1: exposing an organization hierarchy with `CONNECT BY`
119120

120-
Let's construct a [hierarchical query](https://www.enterprisedb.com/docs/epas/latest/epas_compat_ora_dev_guide/03_advanced_concepts/05_hierarchical_queries/) to expose this [chain of command](https://en.wikipedia.org/wiki/Chain_of_command).
121+
Let's construct a [hierarchical query](https://www.enterprisedb.com/docs/epas/latest/epas_compat_ora_dev_guide/03_advanced_concepts/05_hierarchical_queries/) to expose this [chain of command](https://en.wikipedia.org/wiki/Chain_of_command).
121122

122123
Modern SQL would use a recursive CTE for this, as those are widely supported. But Oracle has, for decades, supported an alternative mechanism for querying hierarchy in the form of `CONNECT BY` - let's put that into action:
123124

124125
```sql
125126
SELECT firstname, lastname, (
126-
SELECT LISTAGG(lastname, ', ')
127-
FROM employee rt
128-
START WITH rt.employeeid=e.reportsto
127+
SELECT LISTAGG(lastname, ', ')
128+
FROM employee rt
129+
START WITH rt.employeeid=e.reportsto
129130
CONNECT BY employeeid = PRIOR reportsto
130-
) AS "chain of command"
131+
) AS "chain of command"
131132
FROM employee e;
132133
__OUTPUT__
133134
firstname | lastname | chain of command
@@ -148,11 +149,11 @@ Now, the `LISTAGG()` function was introduced in Oracle 11g Release 2. Very few d
148149

149150
```sql
150151
SELECT firstname, lastname, (
151-
SELECT string_agg(lastname, ', ')
152-
FROM employee rt
153-
START WITH rt.employeeid=e.reportsto
152+
SELECT string_agg(lastname, ', ')
153+
FROM employee rt
154+
START WITH rt.employeeid=e.reportsto
154155
CONNECT BY employeeid = PRIOR reportsto
155-
) AS "chain of command"
156+
) AS "chain of command"
156157
FROM employee e;
157158
__OUTPUT__
158159
firstname | lastname | chain of command
@@ -168,20 +169,20 @@ __OUTPUT__
168169
(8 rows)
169170
```
170171

171-
But [the semantics of the two functions are different for even slightly less-trivial uses](https://www.enterprisedb.com/blog/how-workaround-oracle-listagg-function-postgresql), specifically when using the grouping construct.
172+
But [the semantics of the two functions are different for even slightly less-trivial uses](https://www.enterprisedb.com/blog/how-workaround-oracle-listagg-function-postgresql), specifically when using the grouping construct.
172173

173-
Let's demonstrate that.
174+
Let's demonstrate that.
174175

175176
## Demo #2: group concatenation with `LISTAGG`
176177

177178
As we saw above, this database has "album" and "track" tables containing metadata on digital recordings. We can use some analytic functions, including `LISTAGG`, to put together a report on average track storage requirements for albums with "baby" in the title.
178179

179180
```sql
180-
SELECT UNIQUE title,
181+
SELECT UNIQUE title,
181182
ROUND(AVG(bytes) OVER (PARTITION BY mediatypeid)/1048576 ) media_avg_mb,
182-
LISTAGG(t.name || ' (' || ROUND(bytes/1048576) || ' mb)', chr(10))
183+
LISTAGG(t.name || ' (' || ROUND(bytes/1048576) || ' mb)', chr(10))
183184
WITHIN GROUP (ORDER BY trackid)
184-
OVER (PARTITION BY title) track_list
185+
OVER (PARTITION BY title) track_list
185186
FROM track t
186187
JOIN album USING (albumid)
187188
JOIN mediatype USING (mediatypeid)
@@ -208,11 +209,11 @@ __OUTPUT__
208209
If we try replacing `LISTAGG` with `string_agg` in this example, it's going to fail - the [expression syntax for `string_agg`](https://www.postgresql.org/docs/current/sql-expressions.html#SYNTAX-AGGREGATES) is different.
209210

210211
```sql
211-
SELECT UNIQUE title,
212+
SELECT UNIQUE title,
212213
ROUND(AVG(bytes) OVER (PARTITION BY mediatypeid)/1048576 ) media_avg_mb,
213-
string_agg(t.name || ' (' || ROUND(bytes/1048576) || ' mb)', chr(10))
214+
string_agg(t.name || ' (' || ROUND(bytes/1048576) || ' mb)', chr(10))
214215
WITHIN GROUP (ORDER BY trackid)
215-
OVER (PARTITION BY title) track_list
216+
OVER (PARTITION BY title) track_list
216217
FROM track t
217218
JOIN album USING (albumid)
218219
JOIN mediatype USING (mediatypeid)
@@ -225,13 +226,13 @@ LINE 3: string_agg(t.name || ' (' || ROUND(bytes/1048576) || ...
225226
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
226227
```
227228

228-
Now, this isn't terribly difficult to correct, but it requires restructuring the query to replace the grouping construct - such work can quickly accumulate errors. Fortunately, [EDB Postgres Advanced Server](https://www.enterprisedb.com/docs/epas/latest/)
229-
supports [`LISTAGG`](https://www.enterprisedb.com/docs/epas/latest/epas_compat_reference/02_the_sql_language/03_functions_and_operators/11_aggregate_functions/#listagg) AND `string_agg`,
229+
Now, this isn't terribly difficult to correct, but it requires restructuring the query to replace the grouping construct - such work can quickly accumulate errors. Fortunately, [EDB Postgres Advanced Server](https://www.enterprisedb.com/docs/epas/latest/)
230+
supports [`LISTAGG`](https://www.enterprisedb.com/docs/epas/latest/epas_compat_reference/02_the_sql_language/03_functions_and_operators/11_aggregate_functions/#listagg) AND `string_agg`,
230231
so this query doesn't need to change when migrating from Oracle.
231232

232233
## Compatibility preserves the value of your existing work
233234

234-
In both of the examples shown here, you probably would not use the functions and syntax demonstrated for new work; there are
235+
In both of the examples shown here, you probably would not use the functions and syntax demonstrated for new work; there are
235236
better, more familiar or at least more widely-available equivalents provided natively by PostgreSQL (and many other databases). But by supporting them, EDB Advanced Server gives you the ability to reuse existing logic with minimal modification, allowing
236237
you to focus your time and expertise on solving new problems.
237238

Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading

0 commit comments

Comments
 (0)