Skip to content

Commit

Permalink
Rename files and add description (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfvanek authored Oct 15, 2024
1 parent 0fcb826 commit 0535344
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 4 deletions.
5 changes: 4 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ Each database structure check starts with an SQL query to the pg_catalog.
psui.indexrelid::regclass::text as index_name,
```
4. All query results must be ordered in some way.
5. Do not forget to update `README.md`.
5. All queries must have a brief description.
Links to documentation or articles with detailed descriptions are welcome.
6. Name of the sql-file with query must correspond to diagnostic name in [Java project](https://github.com/mfvanek/pg-index-health).
7. Do not forget to update `README.md`.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ For more information please see [PostgreSQL Versioning Policy](https://www.postg
11. Tables without [description](https://www.postgresql.org/docs/current/sql-comment.html) ([sql](https://github.com/mfvanek/pg-index-health-sql/blob/master/sql/tables_without_description.sql)).
12. Columns without [description](https://www.postgresql.org/docs/current/sql-comment.html) ([sql](https://github.com/mfvanek/pg-index-health-sql/blob/master/sql/columns_without_description.sql)).
13. Columns with [json](https://www.postgresql.org/docs/current/datatype-json.html) type ([sql](https://github.com/mfvanek/pg-index-health-sql/blob/master/sql/columns_with_json_type.sql)).
14. Columns of [serial types](https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-SERIAL) that are not primary keys ([sql](https://github.com/mfvanek/pg-index-health-sql/blob/master/sql/non_primary_key_columns_with_serial_types.sql)).
14. Columns of [serial types](https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-SERIAL) that are not primary keys ([sql](https://github.com/mfvanek/pg-index-health-sql/blob/master/sql/columns_with_serial_types.sql)).
15. Functions without [description](https://www.postgresql.org/docs/current/sql-comment.html) ([sql](https://github.com/mfvanek/pg-index-health-sql/blob/master/sql/functions_without_description.sql)).
16. Indexes [with boolean](https://habr.com/ru/companies/tensor/articles/488104/) ([sql](https://github.com/mfvanek/pg-index-health-sql/blob/master/sql/indexes_with_boolean.sql)).
17. Tables with [not valid constraints](https://habr.com/ru/articles/800121/) ([sql](https://github.com/mfvanek/pg-index-health-sql/blob/master/sql/check_not_valid_constraints.sql)).
17. Tables with [not valid constraints](https://habr.com/ru/articles/800121/) ([sql](https://github.com/mfvanek/pg-index-health-sql/blob/master/sql/not_valid_constraints.sql)).
18. B-tree indexes [on array columns](https://habr.com/ru/articles/800121/) ([sql](https://github.com/mfvanek/pg-index-health-sql/blob/master/sql/btree_indexes_on_array_columns.sql)).
19. [Sequence overflow](https://habr.com/ru/articles/800121/) ([sql](https://github.com/mfvanek/pg-index-health-sql/blob/master/sql/sequence_overflow.sql)).
20. Primary keys with [serial types](https://wiki.postgresql.org/wiki/Don't_Do_This#Don.27t_use_serial) ([sql](https://github.com/mfvanek/pg-index-health-sql/blob/master/sql/primary_keys_with_serial_types.sql)).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

-- Finds columns of serial types (smallserial/serial/bigserial)
-- that are not primary keys (or primary and foreign keys at the same time).
--
-- Based on https://dba.stackexchange.com/questions/90555/postgresql-select-primary-key-as-serial-or-bigserial/
select
col.attrelid::regclass::text as table_name,
Expand Down
3 changes: 2 additions & 1 deletion sql/columns_without_description.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
* Licensed under the Apache License 2.0
*/

-- Finds columns that don't have a description. See also https://www.postgresql.org/docs/current/sql-comment.html
-- Finds columns that don't have a description.
-- See also https://www.postgresql.org/docs/current/sql-comment.html
select
t.oid::regclass::text as table_name,
col.attname::text as column_name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
* Licensed under the Apache License 2.0
*/

-- Finds not validated constraints
--
-- Based on query from https://habr.com/ru/articles/800121/
select
c.conrelid::regclass::text as table_name, -- Name of the table
c.conname as constraint_name, -- Name of the constraint
Expand Down
3 changes: 3 additions & 0 deletions sql/sequence_overflow.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
* Licensed under the Apache License 2.0
*/

-- Finds sequences that may overflow in the near future
--
-- Based on query from https://habr.com/ru/articles/800121/
with
all_sequences as (
select
Expand Down

0 comments on commit 0535344

Please sign in to comment.