-
-
Notifications
You must be signed in to change notification settings - Fork 310
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
Changes from all commits
0e3334a
be2b624
eadcb83
4770ce7
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.
Fresh evidence in the current revision is that the new undefined-function fallback disables
includeOptionalCatalogsas well as comments. On PostgreSQL versions that still support these catalogs here (e.g.pg_foreign_tablefrom 9.1 andpg_matviewsfrom 9.3) but do not haveto_regclassuntil 9.4, the first commented query raises 42883 and this fallback silently drops foreign tables/materialized views from the sidebar instead of only omitting comments.Useful? React with 👍 / 👎.