How to make the query param be optional in pgsql node?

Describe the problem/error/question

How to make the pgsql node select fields be optional, when use in tools, some param are using as filters, it is optional to pass in. Currently, if a field is set in the select, then it must be pass in. Otherwise, it will return none. However, a lot of time, a field is optional when receiving requests.

e.g. a student table with name and age.

if not specify, then should return all students info, if name or age is specified, then return that specific student.

Currently, if set the field in the node and not specify name or age, then will return null.

The standard ‘Select’ operation in the Postgres node does not support optional filters out of the box.

To achieve optional filters, use the ‘Execute Query’ operation and dynamically build your query and parameters using n8n expressions or a preceding node.

1 Like

Thanks for the reply.

Hope it can add the optional function, which can make it reading data lot easy and safe.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.