| Goal | Find cases where you store images and other media as files outside the database and store in the database only paths to the files. |
|---|---|
| Notes | The test creates a user-defined function that should be dropped in the end (see the garbage collection). The query relies on user data that has been registered in a column. |
| Type | Problem detection (Each row in the result could represent a flaw in the design) |
| Reliability | Medium (Medium number of false-positive results) |
| License | MIT (opens in new tab) |
| Fixing Suggestion | Consider storing files within the database. |
| Data Source | INFORMATION_SCHEMA+system catalog |
| SQL Query |
|
Categories
This query is classified under the following categories:
Data at the database logical level
Queries of this category provide information about data in base tables.
Database design antipatterns
Queries of this category provide information about possible occurrences of SQL database design antipatterns.
Read user data
Queries of this category have to read data from user tables.
Structure of base tables
Queries of this category provide information about the structuring of base tables at the database conceptual level
| Name | Description |
|---|---|
| Data at the database logical level | Queries of this category provide information about data in base tables. |
| Database design antipatterns | Queries of this category provide information about possible occurrences of SQL database design antipatterns. |
| Read user data | Queries of this category have to read data from user tables. |
| Structure of base tables | Queries of this category provide information about the structuring of base tables at the database conceptual level |
Further reading and related materials:
This is one of the antipatterns from the Bill Karwin's book of SQL antipatterns. See Chapter 12: Phantom Files.
| Reference |
|---|
| This is one of the antipatterns from the Bill Karwin's book of SQL antipatterns. See Chapter 12: Phantom Files. |
| https://stackoverflow.com/questions/54500/storing-images-in-postgresql |