-
-
Notifications
You must be signed in to change notification settings - Fork 305
feat(plugins): show table and column comments in sidebar and grid #1782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import Foundation | ||
|
|
||
| public extension String { | ||
| var nilIfEmpty: String? { | ||
| isEmpty ? nil : self | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -79,6 +79,7 @@ extension QueryExecutionCoordinator { | |
| var columnDefaults: [String: String?] = [:] | ||
| var columnForeignKeys: [String: ForeignKeyInfo] = [:] | ||
| var columnNullable: [String: Bool] = [:] | ||
| var columnComments: [String: String] = [:] | ||
| for (index, colType) in columnTypes.enumerated() { | ||
| if case .enumType(_, let values) = colType, let vals = values, index < columns.count { | ||
| columnEnumValues[columns[index]] = vals | ||
|
|
@@ -91,6 +92,7 @@ extension QueryExecutionCoordinator { | |
| columnDefaults = metadata.columnDefaults | ||
| columnForeignKeys = metadata.columnForeignKeys ?? [:] | ||
| columnNullable = metadata.columnNullable | ||
| columnComments = metadata.columnComments | ||
| foreignKeysFetched = metadata.columnForeignKeys != nil | ||
| for (col, vals) in metadata.columnEnumValues { | ||
| columnEnumValues[col] = vals | ||
|
|
@@ -100,6 +102,7 @@ extension QueryExecutionCoordinator { | |
| columnDefaults = existing.columnDefaults | ||
| columnForeignKeys = existing.columnForeignKeys | ||
| columnNullable = existing.columnNullable | ||
| columnComments = existing.columnComments | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a new result has no parsed schema metadata (for example, after previously displaying a commented table in the same tab and then running Useful? React with 👍 / 👎. |
||
| foreignKeysFetched = existing.foreignKeysFetched | ||
| for (col, vals) in existing.columnEnumValues where columnEnumValues[col] == nil { | ||
| columnEnumValues[col] = vals | ||
|
|
@@ -114,6 +117,7 @@ extension QueryExecutionCoordinator { | |
| columnForeignKeys: columnForeignKeys, | ||
| columnEnumValues: columnEnumValues, | ||
| columnNullable: columnNullable, | ||
| columnComments: columnComments, | ||
| foreignKeysFetched: foreignKeysFetched | ||
| ) | ||
| parent.setActiveTableRows(newTableRows, for: existingTabId) | ||
|
|
@@ -333,7 +337,8 @@ extension QueryExecutionCoordinator { | |
| rows.updateDisplayMetadata( | ||
| columnDefaults: parsed.columnDefaults, | ||
| columnForeignKeys: parsed.columnForeignKeys, | ||
| columnNullable: parsed.columnNullable | ||
| columnNullable: parsed.columnNullable, | ||
| columnComments: parsed.columnComments | ||
| ) | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For PostgreSQL 9.1–9.3 connections, this base
fetchTablesquery now fails before any tables are listed becauseto_regclass(text)is only available starting in PostgreSQL 9.4, while this driver still treats 9.1/9.3 catalogs as supported viaPostgreSQLCapabilities(hasForeignTablesCatalogat 90_100 andhasMaterializedViewsCatalogat 90_300). In that environment, opening a schema will error instead of showing tables; use apg_class/pg_namespacejoin or gate this expression by server version.Useful? React with 👍 / 👎.