electric-sql / electric

Sync little subsets of your Postgres data into local apps and services.
https://electric-sql.com
Apache License 2.0
6.41k stars 154 forks source link

too many arguments on function json_object #1311

Closed barbalex closed 3 months ago

barbalex commented 5 months ago

I am using a table called app_state instead of a local state library: https://github.com/barbalex/ps/blob/f13c7dd7ef28dfc6048033431ce0eabde77bd25c/db/migrations/01-tables.sql#L1160-L1235

As every physical table can be filtered in the application, I now wanted to add a jsonb field for every table (each field containing the active filter criteria for this table). These 42 fields brought the total amount of jsonb fields in the app_state table to 49.

I then dropped the backend, rebuilt it, migrated the db, built the client and started the app.

And got this error: too many arguments on function json_object.

It seems this could be related to sqlite limiting the number of arguments: https://www.sqlite.org/limits.html#Maximum%20Number%20Of%20Arguments:~:text=Maximum%20Number%20Of%20Arguments%20On%20A%20Function

When I reduce the number of jsonb fields in my table to 47, things work again.

Maybe I can circumvent this problem by using postgres locally instead of sqlite. Will try sometime.

linear[bot] commented 5 months ago

VAX-1886 too many arguments on function json_object

barbalex commented 5 months ago

I now migrated the project to pglite. Seems that with that only 100 arguments can be passed to "a function":

error: cannot pass more than 100 arguments to a function

So I had to further reduce the number of columns of my app_states table.

KyleAMathews commented 3 months ago

👋 we've been working the last month on a rebuild of the Electric server over at a temporary repo https://github.com/electric-sql/electric-next/

You can read more about why we made the decision at https://next.electric-sql.com/about

We're really excited about all the new possibilities the new server brings and we hope you'll check it out soon and give us your feedback.

We're now moving the temporary repo back here. As part of that migration we're closing all the old issues and PRs. We really appreciate you taking the time to investigate and report this issue!