Skip to content
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

Add support for wide tables #4116

Merged
merged 20 commits into from
Jan 16, 2025
Merged

Add support for wide tables #4116

merged 20 commits into from
Jan 16, 2025

Conversation

Anish9901
Copy link
Member

@Anish9901 Anish9901 commented Jan 7, 2025

Fixes #4113

Technical details

We were using jsonb_build_object() to dynamically build SQL for listing records, listing record summaries and grouping records from a table, this causes issues when the number of arguments for jsonb_build_object() exceed postgres' default maximum limit which is 100.

This PR fixes this issue by using to_jsonb() instead.

Upon merging of this PR, mathesar will support:

  • Listing records for a table with more than 100 columns
  • Retrieving summaries of linked records for tables with over 100 linked columns
  • Grouping data by more than 100 columns in a table

Screenshots

Screenshot 2025-01-08 at 3 08 19 AM

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the develop branch of the repository
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no
    visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@kgodey kgodey added this to the v0.2.0 (beta release) milestone Jan 7, 2025
@zackkrida zackkrida added the pr-status: revision A PR awaiting follow-up work from its author after review label Jan 13, 2025
@Anish9901 Anish9901 requested a review from mathemancer January 15, 2025 23:12
@Anish9901 Anish9901 assigned mathemancer and unassigned Anish9901 Jan 15, 2025
@Anish9901 Anish9901 added pr-status: review A PR awaiting review and removed pr-status: revision A PR awaiting follow-up work from its author after review labels Jan 15, 2025
@Anish9901 Anish9901 marked this pull request as ready for review January 15, 2025 23:13
Copy link
Contributor

@mathemancer mathemancer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We chatted about this in a call. I think it's ready to merge!

I'll be refactoring the relevant section of code in the near future, so any issues I have can be sorted out at that point.

@@ -4653,63 +4653,63 @@ $$ LANGUAGE SQL STABLE;
CREATE OR REPLACE FUNCTION
msar.build_results_jsonb_array_expr(
cte_name text,
columns text[],
order_by_expr text
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Realizing now that I missed this in a previous PR review: We should no longer be passing SQL expressions as parameters to functions.

@mathemancer mathemancer added this pull request to the merge queue Jan 16, 2025
Merged via the queue into develop with commit 60ccc50 Jan 16, 2025
70 checks passed
@mathemancer mathemancer deleted the support_widetables branch January 16, 2025 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-status: review A PR awaiting review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wide tables encounter psycopg error on table view in 0.2.0-testing.1
4 participants