Query Segment WITH clause support

Feature(s) impacted

I’m trying to create a segment using a query with “with” clause to simplify my query,
and it breaks for me every time I try to use the “with” clause inside my query.

I attached a simple query with “with” clause that doesn’t work for me.

Do you support this type of sql syntax?
see attached photo for example

I’m currently working with postgresql witch supports this syntax .

Observed behavior

Forest admin view fails when choosing this segment with status 422 in the logs.

Expected behavior

I expect query section to support “with” clause in the query.

Failure Logs


  • Project name: Empathy
  • Team name: All team( for example: Care Ops)
  • Environment name: dev
  • Agent (forest package) name & version: forest-express-sequelize: 8.4.8
  • Database type: postgresql
  • Recent changes made on your end if any: …

Hello @Avishai_Lippner :wave:,

Do you have more details about the error in your server logs and in your browser console :thinking:?

Kind regards,


Sure things,

Here are the browser logs:

Logs from console:

Hope it helps with the investigation

Thank you it will help, I’m going to test it on my side :+1:

After investigation we do not support WITH Clause in this segment :pensive:. I will add the feature request to our productboard :pray:. However, you can usually try to make this query using a smart segment: Smart Segments - Developer guide. I tested it on my side and it’s work with your sql code in example.

Kind regards,


1 Like

Hi @Florian_Gonzales

Thanks for checking this case out.
and thanks for the tip with the smart segment, it actually made the trick, I inserted the sql query as mentioned on the link you’ve shared and it worked, so thank you!

1 Like