Skip to content

Commit b7e9d9a

Browse files
committed
Update docs and build for all versions. Clear out unnecessary files.
1 parent 4fa4c8c commit b7e9d9a

File tree

7 files changed

+57
-64
lines changed

7 files changed

+57
-64
lines changed

README.md

Lines changed: 54 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -14,76 +14,74 @@ PgDD has been tested to work for PostgreSQL 10 through 13.
1414

1515
## Upgrading from <= v0.3
1616

17-
Version 0.4.0 was a complete rewrite of the PgDD extension in a new language.
18-
Care has been taken to provide a smooth upgrade experience but
19-
**do not upgrade without testing the upgrade on a test server!**
20-
21-
22-
Versions 0.3 and prior were written as a raw SQL extension, but that method lacked ability to provide version-specific functionality (such as generated columns, procedures, etc.).
17+
Version 0.4.0 was a complete rewrite of the PgDD extension from a raw-SQL
18+
extension to using the [pgx framework](https://github.com/zombodb/pgx).
2319

24-
The last raw SQL version is still available to [download](https://raw.githubusercontent.com/rustprooflabs/pgdd/main/standalone/pgdd_v0_3.sql). This version is no longer maintained and may or may not
25-
work on future Postgres versions.
2620

2721

22+
Upgrading from Raw SQL version of PgDD (v0.3) to the pgx version (v0.4.0) is done with `DROP EXTENSION pgdd; CREATE EXTENSION pgdd;`
23+
Care has been taken to provide a smooth upgrade experience but
24+
**do not install the upgrade without testing the process on a test server!**
2825

29-
## Install from binary
26+
If custom attributes were stored in the `dd` tables you will need to use
27+
`pg_dump` to export the data and reload after recreating the extension
28+
with pgx. If any of the three (3) queries below return a count > 0
29+
this applies to you.
3030

31-
Download the appropriate binary.
3231

33-
```bash
34-
wget https://github.com/rustprooflabs/pgdd/raw/dev/standalone/pgdd_0.4.0-dev_focal_pg13_amd64.deb
32+
```sql
33+
SELECT COUNT(*)
34+
FROM dd.meta_table
35+
WHERE s_name <> 'dd';
36+
SELECT COUNT(*)
37+
FROM dd.meta_column
38+
WHERE s_name <> 'dd';
39+
SELECT COUNT(*)
40+
FROM dd.meta_schema
41+
WHERE s_name <> 'dd';
3542
```
3643

37-
Install.
3844

3945

40-
```bash
41-
sudo dpkg -i ./pgdd_0.4.0-dev_focal_pg13_amd64.deb
42-
```
46+
The last raw SQL version is still available to [download](https://raw.githubusercontent.com/rustprooflabs/pgdd/main/standalone/pgdd_v0_3.sql). This version is no longer maintained and may or may not
47+
work on future Postgres versions.
4348

44-
In your database.
4549

50+
## Install from binary
4651

47-
```sql
48-
CREATE EXTENSION pgdd;
49-
```
52+
Binaries are available for Ubuntu 20.04 (bionic) and Ubuntu 21.04 (hirsute).
5053

54+
Download and install.
5155

52-
## Update
56+
```bash
57+
wget https://github.com/rustprooflabs/pgdd/releases/download/0.4.0.rc2/pgdd_0.4.0.rc2_focal_pg13_amd64.deb
5358

54-
As new [releases](https://github.com/rustprooflabs/pgdd/releases) are
55-
available, download the new binary and install using the above instructions.
59+
sudo dpkg -i ./pgdd_0.4.0.rc2_focal_pg13_amd64.deb
60+
```
5661

62+
In your database.
5763

58-
Then, in your database.
5964

6065
```sql
61-
ALTER EXTENSION pgdd UPDATE;
66+
CREATE EXTENSION pgdd;
6267
```
6368

64-
----
65-
66-
**WARNING**
67-
68-
Postgres sessions started before the`UPDATE EXTENSION` command will
69-
continue to see the old version of PgDD. New sessions will see the
70-
updated extension.
71-
72-
If the following query returns true, disconnect and reconnect to
73-
the database with PgDD to use the latest installed version.
74-
69+
Check version.
7570

7671
```sql
77-
SELECT CASE WHEN version <> dd.version() THEN True
78-
ELSE False
79-
END AS pgdd_needs_reload
80-
FROM pg_catalog.pg_available_extension_versions
81-
WHERE name = 'pgdd' AND installed
72+
SELECT extname, extversion
73+
FROM pg_catalog.pg_extension
74+
WHERE extname = 'pgdd'
8275
;
8376
```
8477

85-
86-
----
78+
```
79+
┌─────────┬────────────┐
80+
│ extname │ extversion │
81+
╞═════════╪════════════╡
82+
│ pgdd │ 0.4.0.rc2 │
83+
└─────────┴────────────┘
84+
```
8785

8886

8987
## Use Data Dictionary
@@ -93,12 +91,13 @@ could be psql, DBeaver, PgAdmin, or Python code... all you need
9391
is a place to execute SQL code and see the results.
9492

9593
The main interaction with PgDD is through the views in the `dd` schema.
94+
9695
The `dd.views` query can be used to query the views within a database.
9796

9897
```sql
9998
SELECT s_name, v_name, description
10099
FROM dd.views
101-
WHERE s_name = 'dd';
100+
;
102101
```
103102

104103
```bash
@@ -122,30 +121,26 @@ The highest level of querying provided by `pgdd` is at the schema level.
122121
This provides counts of tables, views and functions along with the size on disk of the objects within the schema.
123122

124123
```sql
125-
SELECT *
124+
SELECT s_name, table_count, view_count, function_count,
125+
size_plus_indexes, description
126126
FROM dd.schemas
127127
WHERE s_name = 'dd';
128128
```
129129

130130
Yields results such as this.
131131

132132
```bash
133-
┌─[ RECORD 1 ]──────┬────────────────────────────────────────────────────────────┐
134-
│ s_name │ dd │
135-
│ owner │ postgres │
136-
│ data_source │ Manually maintained │
137-
│ sensitive │ f │
138-
│ description │ Data Dictionary from https://github.com/rustprooflabs/pgdd │
139-
│ system_object │ f │
140-
│ table_count │ 3 │
141-
│ view_count │ 5 │
142-
│ function_count │ 7 │
143-
│ size_pretty │ 48 kB │
144-
│ size_plus_indexes │ 144 kB │
145-
│ size_bytes │ 49152 │
146-
└───────────────────┴────────────────────────────────────────────────────────────┘
133+
┌─[ RECORD 1 ]──────┬────────────────────────────────────────────────────────────────────────────────┐
134+
│ s_name │ dd │
135+
│ table_count │ 3 │
136+
│ view_count │ 5 │
137+
│ function_count │ 6 │
138+
│ size_plus_indexes │ 144 kB │
139+
│ description │ Schema for Data Dictionary objects. See https://github.com/rustprooflabs/pgdd │
140+
└───────────────────┴────────────────────────────────────────────────────────────────────────────────┘
147141
```
148142

143+
149144
### Tables
150145

151146
The `dd.tables` view to examine tables created and populated by `pgbench`.
@@ -159,7 +154,6 @@ SELECT t_name, size_pretty, rows, bytes_per_row
159154
ORDER BY size_bytes DESC;
160155
```
161156

162-
Returns:
163157

164158
```bash
165159
┌──────────────────┬─────────────┬──────────┬───────────────┐

build/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ LOGDIR=${BASE}/target/logs
2323
ARTIFACTDIR=${BASE}/target/artifacts
2424
PGXVERSION=0.2.0-beta.1
2525

26-
#PG_VERS=("pg10" "pg11" "pg12" "pg13")
27-
PG_VERS=("pg12" "pg13")
26+
PG_VERS=("pg10" "pg11" "pg12" "pg13")
27+
#PG_VERS=("pg13")
2828

2929
echo $BASE
3030
echo $VERSION

pgdd--0.4.0-dev.jpg

-86.8 KB
Binary file not shown.

pgdd--0.4.0-rc2.jpg

86.8 KB
Loading

sql/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pgx generated SQL files go in this folder.

sql/pgdd--0.3--0.3.1.sql

Lines changed: 0 additions & 1 deletion
This file was deleted.

sql/pgdd--0.3.1--0.4.0-dev.sql

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)