[Ellipsis] BUG: Postgres column comments appear as (NULL) #2192
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
Issue: resolves #2183
Implementation:
Step 1: Modify the 'listTableColumns' function to fetch column comments
In the '/apps/studio/src/lib/db/clients/postgresql.ts' file, modify the 'listTableColumns' function to fetch the column comments from the Postgres database. Add 'column_comment' to the SELECT clause of the SQL query. Map the 'column_comment' field to the 'comment' property of the returned objects. Make sure to handle any errors and edge cases, and to adhere to the existing code style and conventions.
Step 2: Modify the 'tableData' computed property to include column comments
In the '/apps/studio/src/components/TableSchema.vue' file, modify the 'tableData' computed property to include the column comments in the data passed to the Tabulator component. Make sure to handle any errors and edge cases, and to adhere to the existing code style and conventions.
Step 3: Test the changes
Thoroughly test the changes to ensure that they work as expected and don't break any existing functionality. Test the 'listTableColumns' function and the 'tableData' computed property with different inputs and scenarios. Make sure that the column comments in the Postgres table structure view are correctly displayed and not showing as
(NULL)
.Report:
Modify the 'listTableColumns' function to fetch column comments
Modified the 'listTableColumns' function in the '/apps/studio/src/lib/db/clients/postgresql.ts' file to fetch the column comments from the Postgres database. Added 'column_comment' to the SELECT clause of the SQL query and mapped the 'column_comment' field to the 'comment' property of the returned objects. Also modified the 'tableData' computed property in the '/apps/studio/src/components/tableinfo/TableSchema.vue' file to include the column comments in the data passed to the Tabulator component.Modify the 'tableData' computed property to include column comments
Verified that the 'tableData' computed property in the 'TableSchema.vue' file already includes the column comments in the data passed to the Tabulator component. However, it's possible that the issue might be in the way the Tabulator component handles the data.Test the changes
Verified that the 'tableData' computed property in the 'TableSchema.vue' file already includes the column comments in the data passed to the Tabulator component. However, it's possible that the issue might be in the way the Tabulator component handles the data.Something look wrong?: If this Pull Request doesn't contain the expected changes, add more information to #2183. Then, try again. For more information, check the documentation.