mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Show index columns in the correct order in RE-SQL. Fixes #1842
This commit is contained in:
committed by
Dave Page
parent
686237413c
commit
1431dfcb01
@@ -27,4 +27,5 @@ FROM (
|
||||
LEFT OUTER JOIN pg_operator op ON (op.oid = c.conexclop[i.attnum])
|
||||
LEFT JOIN pg_attribute a ON (a.attrelid = i.indexrelid AND a.attnum = i.attnum)
|
||||
LEFT OUTER JOIN pg_collation coll ON a.attcollation=coll.oid
|
||||
LEFT OUTER JOIN pg_namespace nspc ON coll.collnamespace=nspc.oid;
|
||||
LEFT OUTER JOIN pg_namespace nspc ON coll.collnamespace=nspc.oid
|
||||
ORDER BY i.attnum;
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
{###
|
||||
We need outer SELECT & dummy column to preserve the ordering
|
||||
because we lose ordering when we use UNION
|
||||
###}
|
||||
SELECT * FROM (
|
||||
{% for n in range(colcnt|int) %}
|
||||
{% if loop.index != 1 %}
|
||||
UNION SELECT pg_get_indexdef({{ cid|string }}, {{ loop.index|string }}, true) AS column
|
||||
UNION SELECT pg_get_indexdef({{ cid|string }}, {{ loop.index|string }}, true) AS column, {{ n }} AS dummy
|
||||
{% else %}
|
||||
SELECT pg_get_indexdef({{ cid|string }} , {{ loop.index|string }} , true) AS column
|
||||
SELECT pg_get_indexdef({{ cid|string }} , {{ loop.index|string }} , true) AS column, {{ n }} AS dummy
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
) tmp
|
||||
ORDER BY dummy
|
||||
Reference in New Issue
Block a user