Queries
Postgres queries can be saved as variables which when used will be executed in run-time. Output can be checked by testing the query
Using queries variables
-
Referencing queries inside other queries: Query values can be used in run-time inside another query by utilizing the syntax below:
select * from city where city_id={{[pm_query_id:21][0].city_id]};
{{}}
is used to utilize the variable[]
is used to define thepm_query_id
of desired query
-
Using app constants inside query
select * from city where city_id={{[pm_query_id:22][[pm_query_id:35][0].city_id].city_id}}
or city_id={{[pm_app_constant_id:4].value}}; -
Using arguments inside query
select * from city where city_id={{arg1}} or city_id={{arg2}};