Skip to content

Commit 535e344

Browse files
committed
Install libossp-uuid16 for PostgreSQL uuid-ossp extension
The prebuilt PostgreSQL 18 binary includes uuid-ossp.so which links against libossp-uuid.so.16. Install the system package so the extension can be loaded at runtime. https://claude.ai/code/session_018koD7tHEa2W5cXbiPPYatB
1 parent 50cafe2 commit 535e344

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

cmd/sqlc-test-setup/main.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,12 @@ func installAptProxy() error {
174174
func installPostgreSQL() error {
175175
log.Println("--- Installing PostgreSQL ---")
176176

177+
// Install runtime dependencies needed by PostgreSQL extensions (e.g.
178+
// uuid-ossp requires libossp-uuid16).
179+
if err := installPgDeps(); err != nil {
180+
return fmt.Errorf("installing postgresql dependencies: %w", err)
181+
}
182+
177183
// Check if already installed in our directory
178184
if _, err := os.Stat(pgBin("postgres")); err == nil {
179185
out, err := runOutput(pgBin("postgres"), "--version")
@@ -239,6 +245,16 @@ func installPostgreSQL() error {
239245
return nil
240246
}
241247

248+
// installPgDeps installs shared libraries required by PostgreSQL extensions at
249+
// runtime (e.g. libossp-uuid16 for uuid-ossp).
250+
func installPgDeps() error {
251+
log.Println("installing postgresql runtime dependencies")
252+
if err := run("sudo", "apt-get", "install", "-y", "--no-install-recommends", "libossp-uuid16"); err != nil {
253+
return fmt.Errorf("apt-get install libossp-uuid16: %w", err)
254+
}
255+
return nil
256+
}
257+
242258
// supportedPlatforms returns a comma-separated list of supported platforms.
243259
func supportedPlatforms() string {
244260
platforms := make([]string, 0, len(pgBinaries))

0 commit comments

Comments
 (0)