PostgreSQL UUID relationship filtering fails: relationship._id rejected and UUID filter uses ILIKE
Checklist
- I have searched budibase discussions and github issues to check if my issue already exists
Related issues/work found include #18787, #16123 and PR #19127, but I can still reproduce this on a newer build with an external PostgreSQL datasource.
Hosting
- Self
- Method: docker single image
- Budibase Version: v3.43.0-cloud.2
- App Version: v3.43.0-cloud.2
Describe the bug
I am using an external PostgreSQL/Supabase datasource with native PostgreSQL uuid primary and foreign keys.
Two relevant tables:
persons- primary key:
person_id uuid
- primary key:
candidate_profiles- primary key:
candidate_profile_id uuid - foreign key:
person_id uuid -> persons.person_id
- primary key:
I defined this relationship in Budibase:
- One row in:
persons - Primary key:
person_id - To many rows in:
candidate_profiles - Foreign key:
person_id
The relationship is visible in Budibase, but filtering fails in two different ways.
- Filtering a Data Provider by the related Budibase
_id
Using:
persons._id → Equals → valid related Budibase _id
immediately gives:
Invalid filter field: persons._id
Example valid Budibase _id exported from the related persons row:
%5B'f69df1ee-4c9e-561b-a24d-1af57af203bf'%5D
The underlying PostgreSQL person_id for that same row is:
f69df1ee-4c9e-561b-a24d-1af57af203bf
- Filtering directly on the native UUID foreign-key column
If I filter/search the external SQL table using person_id, the grid fails with:
operator does not exist: uuid ~~* unknown
This appears to mean Budibase is applying a text/ILIKE operation to a native PostgreSQL uuid column.
Re-fetching the external table does not resolve the issue.
The same PostgreSQL role used by Budibase can query the data directly without any problem.
For example:
select candidate_profile_id, person_id from public.candidate_profiles where person_id = 'f69df1ee-4c9e-561b-a24d-1af57af203bf'::uuid;
correctly returns:
candidate_profile_id: 603e1cf2-b411-5fc7-b8d2-5d4e36939cfc
person_id: f69df1ee-4c9e-561b-a24d-1af57af203bf
To Reproduce
- Connect Budibase to an external PostgreSQL database.
- Import two tables using native PostgreSQL UUID primary keys.
- Have the second table contain a UUID foreign key to the first table.
- Define a one-to-many relationship in Budibase using those keys.
- Create a Data Provider using the child table.
- Add a filter using
relationship_name._idequals a valid related Budibase_id. - Observe:
Invalid filter field: relationship_name._id. - Alternatively, open the external SQL table and filter/search the native UUID foreign-key column.
- Observe:
operator does not exist: uuid ~~* unknown.
Expected behavior
A related row should be filterable without requiring a custom SQL query.
I would expect at least one of these approaches to work:
- Filtering the relationship using
relationship_name._id, especially since relationship_idfiltering was added in PR #19127.
or
- Equality filtering directly against the native PostgreSQL UUID foreign-key column.
Budibase should not apply a text/ILIKE operator to a PostgreSQL uuid column.
Screenshots
I can attach screenshots showing:
Invalid filter field: persons._idoperator does not exist: uuid ~~* unknown- The relationship configuration
App Export
I can provide an app export if required.
The external database itself cannot be included, but I can provide a minimal PostgreSQL schema for reproduction.
Desktop
- OS: Nobara Linux
- Browser: Chromium-based browser
- Version: current
Additional context
Self-hosted Docker single-image installation:
budibase/budibase:latest
Environment reports:
BUDIBASE_VERSION=v3.43.0-cloud.2
The PostgreSQL datasource is Supabase/PostgreSQL.
The Budibase database role has working SELECT permissions and appropriate RLS policies. Direct PostgreSQL queries using the same role return the expected records.
Related:
- #18787 — Allow data providers to filter on related
_id - #16123 — Filtering a Data Provider on a Relationship
_iddoes not work - PR #19127 — Relationship filtering by
_id
Since PR #19127 should already be included in this Budibase version, this may be a regression or an external PostgreSQL + native UUID edge case.
Source: Budibase/budibase