MCPcopy Index your code
hub / github.com/ddev/ddev / GetPostgresDataPath

Method GetPostgresDataPath

pkg/ddevapp/db.go:165–177  ·  view source on GitHub ↗

GetPostgresDataPath returns the path where PostgreSQL actually stores data files This differs from GetPostgresDataDir for PostgreSQL 18+ where files are in a version-specific subdirectory

()

Source from the content-addressed store, hash-verified

163// GetPostgresDataPath returns the path where PostgreSQL actually stores data files
164// This differs from GetPostgresDataDir for PostgreSQL 18+ where files are in a version-specific subdirectory
165func (app *DdevApp) GetPostgresDataPath() string {
166 if app.Database.Type != nodeps.Postgres {
167 return ""
168 }
169
170 if slices.Contains([]string{nodeps.Postgres9, nodeps.Postgres10, nodeps.Postgres11, nodeps.Postgres12, nodeps.Postgres13, nodeps.Postgres14, nodeps.Postgres15, nodeps.Postgres16, nodeps.Postgres17}, app.Database.Version) {
171 return "/var/lib/postgresql/data"
172 }
173
174 // Postgres 18+ stores actual data files in version-specific subdirectory
175 // See https://github.com/docker-library/postgres/pull/1259
176 return "/var/lib/postgresql/" + app.Database.Version + "/docker"
177}

Callers 4

TestGetPostgresDataPathFunction · 0.95
RestoreSnapshotMethod · 0.95
RenderComposeYAMLMethod · 0.95
getBackupCommandFunction · 0.80

Calls

no outgoing calls

Tested by 1

TestGetPostgresDataPathFunction · 0.76