A learning database must be separate from existing data. The launcher creates a new private directory, a new PostgreSQL cluster, a private Unix-socket directory and a named lab database. It never reuses a cluster, reads an inherited DSN or connects to a default production host.
The pure exercise builds a URI for that explicit socket. The real adapter also checks the launcher’s marker. A path naming convention is not itself proof of ownership; only the owned launcher’s lifecycle establishes which cluster it may initialize, stop and remove.
The URI includes the lab user, database, socket path, selected port, finite connection timeout and application name. url.Values encodes values rather than concatenating a possibly ambiguous connection string. sslmode=disable is used only for this private Unix-socket fixture, which has no TCP listener.
The launcher initializes its own cluster with host authentication rejected and local trust inside a0700 directory. It creates a nonsuperuser application role. That local trust policy is appropriate only within the owned fixture boundary; it is not a suggested remote authentication setup.
package main
import ("fmt";"net/url")
func main(){
q:=url.Values{"host":{"/tmp/coderigor-pg-lab-demo/socket"},"port":{"54321"}};fmt.Println(q.Get("host"));fmt.Println(q.Get("port"))
}No command in the lab accepts a production DSN or an existing-cluster argument. The launcher passes explicit socket/port/user/database options, clears inherited PG variables and confirms it stopped the same owned cluster before deleting its directory.
You can inspect psql commands in the README. Use -X to avoid user startup files and ON_ERROR_STOP for scripted assertions. A successful URI parse is only configuration evidence; the capstone separately checks actual connectivity and queries.
package main
import ("fmt";"path/filepath")
func main(){
fmt.Println(filepath.IsAbs("/tmp/coderigor-pg-lab-demo/socket"));fmt.Println(filepath.Clean("/tmp/a/../socket"))
}Implement the strict lab URI and verify its decoded fields. Keep marker/ownership verification in the real adapter separate from this pure function. Next translate the actual data types.