I'm using sql parameter's and I have a query that I'd like to use for two similar queries. The first uses two where clauses the other uses only one of the clauses is there a symbol I can use for the second query to always equal true?
For example:
SELECT path, markdown
FROM public."Comment"
where path = 'relative/path/' AND markdown = 'here I am';
Second example:
SELECT path, markdown
FROM public."Comment"
where path = '/other/relative/path/' AND markdown = ALL;
All
being a stand in for some symbol in the query that would make it effectively only search based on the path (because the markdown where clause would return true on all columns).
markdown
column nullable?where markdown = markdown
would work if it never containsnull
valueswhere path = 'relative/path/' AND markdown Like 'here I am'
? Then you could just substitute%
as the string literal. Though I don't know what the performance implications of doing that in Postgres are.