()
| 1080 | c.sendError("FATAL", "XX000", fmt.Sprintf("failed to detect ducklake catalog attachment: %v", err)) |
| 1081 | return err |
| 1082 | } |
| 1083 | // De-mask: current_database() and the pg_catalog surfaces should reflect |
| 1084 | // the real attached catalog, not the client's connection database name. |
| 1085 | // Standalone has a single backing catalog, so honor whatever is attached. |
| 1086 | catalog := c.database |
| 1087 | if duckLakeAttached { |
| 1088 | catalog = physicalDuckLakeCatalog |
| 1089 | } |
| 1090 | // duckLakeAttached comes from the probe above; passing it keeps |
| 1091 | // sessionmeta from repeating that `duckdb_databases()` query. |
| 1092 | if err := sessionmeta.InitSessionDatabaseMetadataWithAttached(initCtx, c.executor, catalog, nil, duckLakeAttached); err != nil { |
| 1093 | initCancel() |
| 1094 | c.sendError("FATAL", "XX000", fmt.Sprintf("failed to initialize session database metadata: %v", err)) |
| 1095 | return err |
| 1096 | } |
| 1097 | initCancel() |
| 1098 | // Keep c.database aligned with the real catalog so observability surfaces |
| 1099 | // agree with current_database(); record the physical catalog so the |
| 1100 | // transpiler selects the right backend profile (DuckLake). |
| 1101 | c.database = catalog |
| 1102 | c.physicalCatalog = catalog |
| 1103 | c.catalogUseRewrite = duckLakeAttached |
| 1104 | } |
| 1105 | |
| 1106 | // Send initial parameters |
no test coverage detected