CatalogFromSearchPath returns the catalog from the first search_path entry, or "" when the first entry is an unqualified schema.
(searchPath string)
| 47 | // CatalogFromSearchPath returns the catalog from the first search_path entry, |
| 48 | // or "" when the first entry is an unqualified schema. |
| 49 | func CatalogFromSearchPath(searchPath string) string { |
| 50 | entry := firstSearchPathEntry(searchPath) |
| 51 | if entry == "" { |
| 52 | return "" |
| 53 | } |
| 54 | parts, ok := ParseQualifiedIdentifier(entry) |
| 55 | if !ok || len(parts) < 2 { |
| 56 | return "" |
| 57 | } |
| 58 | return parts[0] |
| 59 | } |
| 60 | |
| 61 | func QuoteIdentifier(s string) string { |
| 62 | return `"` + strings.ReplaceAll(s, `"`, `""`) + `"` |