MCPcopy Create free account
hub / github.com/PostHog/duckgres / loadExtensionsWith

Function loadExtensionsWith

server/server.go:1374–1405  ·  view source on GitHub ↗

loadExtensionsWith is LoadExtensions over a duckLakeSQLExecer so the catalog-attachment paths can run INSTALL/LOAD under per-step deadlines via attachStepExecer (a hung extension LOAD is one of the documented activation stalls — see shouldInstallExtension).

(db duckLakeSQLExecer, extensions []string)

Source from the content-addressed store, hash-verified

1372 slog.Warn("Failed to recreate pg_class_full for DuckLake.", "error", err)
1373 // Non-fatal: continue with DuckDB-based pg_class_full
1374 }
1375
1376 // Recreate pg_namespace to source from DuckLake metadata.
1377 // This ensures OIDs match pg_class_full for JOINs (e.g., Metabase table discovery).
1378 if err := recreatePgNamespaceForDuckLake(db); err != nil {
1379 slog.Warn("Failed to recreate pg_namespace for DuckLake.", "error", err)
1380 // Non-fatal: continue with DuckDB-based pg_namespace
1381 }
1382 }
1383 if err := AttachDeltaCatalog(db, cfg.DuckLake, duckLakeSem); err != nil {
1384 if cfg.DuckLake.DeltaCatalogEnabled {
1385 return fmt.Errorf("delta catalog configured but attachment failed: %w", err)
1386 }
1387 slog.Warn("Failed to attach Delta catalog.", "user", username, "error", err)
1388 }
1389 // Initialize information_schema compatibility views in memory.main
1390 // Must be done AFTER attaching DuckLake (so views can reference ducklake.information_schema)
1391 // but BEFORE setting DuckLake as default (so views are created in memory.main, not ducklake.main)
1392 if err := initInformationSchema(db, duckLakeMode); err != nil {
1393 slog.Warn("Failed to initialize information_schema.", "user", username, "error", err)
1394 // Continue anyway - basic queries will still work
1395 }
1396
1397 // Now set DuckLake as the default catalog so all user queries use it
1398 if duckLakeMode {
1399 if err := setDuckLakeDefault(db); err != nil {
1400 return fmt.Errorf("failed to set DuckLake as default: %w", err)
1401 }
1402 }
1403
1404 // Widen httpfs's retry budget now that the ATTACH calls above have loaded
1405 // httpfs (DuckLake auto-loads it on the first S3 touch). See
1406 // applyHTTPFSRetryBudget for why this can't run in ConfigureMainDB.
1407 applyHTTPFSRetryBudget(db)
1408 applyParquetPrefetchPolicy(db, cfg.DisableParquetPrefetching)

Callers 3

LoadExtensionsFunction · 0.85
AttachDuckLakeFunction · 0.85
AttachDeltaCatalogFunction · 0.85

Calls 3

parseExtensionNameFunction · 0.85
shouldInstallExtensionFunction · 0.85
ExecMethod · 0.65

Tested by

no test coverage detected