Thank you very much for your answer, the SQL query has been prepared, it works in the search engine and in the database, but when placed in the fragment in the template, messages appear regarding either incorrect ' " or "invalid column name 'Activity'" characters.
Do you have any ideas for the above? I tried every way I know

Below is the query:
SELECT t_object.Object_ID AS "Numer początkowy",
t_object.Name AS "'Nazwa",
t_object.Note AS "Opis",
t_diagramobjects.Sequence AS "Kolejność"
FROM t_object
JOIN t_diagramobjects ON t_object.Object_ID = t_diagramobjects.Object_ID
WHERE t_object.Object_Type = 'Activity'
AND t_diagramobjects.Diagram_ID = '38096'
ORDER BY t_diagramobjects.Sequence;
The above query has been pasted into the fragment settings, and the fragment is used in the appropriate template
Fragment:
custom >
{Numer początkowy}
{Nazwa}
{Opis}
{Kolejność}
< custom
Database: PostgreSQL
EA version: 16.1