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

Database enum breaks built in filter all columns, all views including Builder #15104

Open
1 task done
JohnnyMarnell opened this issue Dec 2, 2024 · 5 comments
Open
1 task done
Labels
bb-filtering Filtering data bug Something isn't working data env - production Bug found in production externaldb Relating to datasource plus firestorm Data/Infra/Revenue Team

Comments

@JohnnyMarnell
Copy link

Checklist

  • I have searched budibase discussions and github issues to check if my issue already exists

Hosting

  • Cloud
    • Tenant ID: partsorder.budibase.app

Describe the bug
In custom Budibase views built as well as built in Datasource table view pages in Data, clicking on magnifying glass and typing anything yields:

There was a problem loading your grid
Table updated externally, please re-fetch - operator does not exist: <any enum type> ~~* unknown

To Reproduce
Steps to reproduce the behavior:

  1. Create or use any existing Postgres SQL datasource and table with an ENUM type, e.g. CREATE TYPE public.fruit_enum AS ENUM ('APPLE', 'BANANA');
  2. Re-fetch
  3. Click on Magnifying glass in column header in Data -> Postgres SQL -> table view (or any custom page using this) and type.
  4. See error

Expected behavior
Filtering works, as for text fields (maybe casting ::text would fix?). Would also be great if these quick filters defaulted to matching substring anywhere, as opposed to prefix / start.

Screenshots
image

App Export
If possible - please attach an export of your budibase application for debugging/reproduction purposes.

Desktop (please complete the following information):

  • OS: Mac Sonoma 14.16
  • Chrome
  • Tried multiple Budibase app versions, e.g. latest + 3.2.11
@JohnnyMarnell JohnnyMarnell added the bug Something isn't working label Dec 2, 2024
Copy link

linear bot commented Dec 2, 2024

@ConorWebb96 ConorWebb96 self-assigned this Dec 10, 2024
Copy link
Contributor

ConorWebb96 commented Dec 11, 2024

Hey @JohnnyMarnell,

Do you have the table create scripts? I wasn't able to replicate this myself.

Screenshot 2024-12-11 at 08.27.00.png

Screenshot 2024-12-11 at 08.28.23.png

Can you also include the version of Postgres you are using?

@ConorWebb96 ConorWebb96 removed their assignment Dec 11, 2024
@JohnnyMarnell
Copy link
Author

Hi thanks for taking a look, the problem is happenning with any postgres enum, looks like you have status and test already. e.g.:

CREATE TYPE staus AS ENUM ('pending', 'processing');

In your screenshot views above, if you click the icon next to status and test column headers so it turns to a magnifying glass to filter, do you get the error?

@ConorWebb96 ConorWebb96 added externaldb Relating to datasource plus env - production Bug found in production bb-filtering Filtering data firestorm Data/Infra/Revenue Team data and removed awaiting response labels Dec 19, 2024
@ConorWebb96
Copy link
Contributor

ConorWebb96 commented Dec 19, 2024

@JohnnyMarnell,

Thanks for the clarity. I was able to replicate it.

Attaching a simple database create script for our engineers.

Postgres

CREATE SEQUENCE IF NOT EXISTS orders_order_id_seq;
DROP TYPE IF EXISTS "public"."order_status";
CREATE TYPE "public"."order_status" AS ENUM ('pending', 'processing', 'shipped', 'delivered', 'cancelled');
CREATE TABLE "public"."orders" (
    "order_id" int4 NOT NULL DEFAULT nextval('orders_order_id_seq'::regclass),
    "status" "public"."order_status",
    PRIMARY KEY ("order_id")
);

@JohnnyMarnell
Copy link
Author

Thanks for looking! When I snoop the underlying SQL query with tshark, I can see it's trying order_status ilike $1, and I think adding a cast to text for enum types would get around this as in order_status::text ilike $1.

By the way, it looks like Like conditional filtering on columns for SQL table data sources works with partial match "in" behavior (e.g. "o" matches "foo"), whereas these column magnifying glasses require prefix matching (e.g. "fo" matches "foo", but not "o"). Looks like they use same ilike under the hood (maybe the former surrounds with '%'?), it would be great if the column magnifying glass worked the same!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bb-filtering Filtering data bug Something isn't working data env - production Bug found in production externaldb Relating to datasource plus firestorm Data/Infra/Revenue Team
Projects
None yet
Development

No branches or pull requests

2 participants