mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-22 08:46:39 -06:00
Properly sort rows by the pkey when viewing first/last 100. Fixes #2007
This commit is contained in:
parent
dbff4f7977
commit
53481023fa
@ -353,11 +353,11 @@ class TableCommand(GridCommand):
|
||||
if sql_filter is None:
|
||||
sql = render_template("/".join([self.sql_path, 'objectquery.sql']), object_name=self.object_name,
|
||||
nsp_name=self.nsp_name, pk_names=pk_names, cmd_type=self.cmd_type,
|
||||
limit=self.limit)
|
||||
limit=self.limit, primary_keys=primary_keys)
|
||||
else:
|
||||
sql = render_template("/".join([self.sql_path, 'objectquery.sql']), object_name=self.object_name,
|
||||
nsp_name=self.nsp_name, pk_names=pk_names, cmd_type=self.cmd_type,
|
||||
sql_filter=sql_filter, limit=self.limit)
|
||||
sql_filter=sql_filter, limit=self.limit, primary_keys=primary_keys)
|
||||
|
||||
return sql
|
||||
|
||||
|
@ -3,9 +3,9 @@ SELECT * FROM {{ conn|qtIdent(nsp_name, object_name) }}
|
||||
{% if sql_filter %}
|
||||
WHERE {{ sql_filter }}
|
||||
{% endif %}
|
||||
{% if pk_names %}
|
||||
ORDER BY {{ pk_names }}
|
||||
{% if cmd_type == 1 or cmd_type == 3 %}ASC {% elif cmd_type == 2 %}DESC {% endif %}
|
||||
{% if primary_keys %}
|
||||
ORDER BY {% for p in primary_keys %}{{p}}{% if cmd_type == 1 or cmd_type == 3 %} ASC{% elif cmd_type == 2 %} DESC{% endif %}
|
||||
{% if not loop.last %}, {% else %} {% endif %}{% endfor %}
|
||||
{% endif %}
|
||||
{% if limit > 0 %}
|
||||
LIMIT {{ limit }}
|
||||
|
Loading…
Reference in New Issue
Block a user