Hi developers! Hi Dave!
Testing the pgAdmin III 1.8.0 RC1 (Oct 9 2007, rev: 6725). Client Win
XP. Host: Debian Etch / PG 8.2.4
The phenomenon:
When applying a filter in the table grid, sorting stops to work sometimes.
I have seen this before, but could not reproduce it. This time I logged
the SQL statements and found the cause.
Explanation:
I work with varying filters to edit data in big tables. For this purpose
I sometimes comment out parts of the filter to reuse them later. Herein
lies the catch: pgadmin appends the "ORDER BY" clause without a newline,
so it gets commented out, if the filter ends with a comment.
Steps to reproduce:
Open edit grid on table foo, sort it by foo_id, and apply a filter:
foo_id > 5000
-- and foo <> 'sometxt'
The second (and last) line is commented out, for later use. pgAdmin
sends this query to the server:
SELECT * FROM foo WHERE foo_id > 5000
-- and foo <> 'sometxt' ORDER BY foo_id ASC
Fix:
Make sure there is a newline before appending the ORDER BY clause.
Regards
Erwin