When writing ad hoc queries or plpgsql code it is often handy to operate with small text snippets as the building blocks. PgAdmin has no Templates feature, but Favourites is very close to it. What is missing - the ability to quickly apply (inject) some snippet in the cursor position, preferably without touching the mouse.
Suggested implementation allows to type desired favourite's name right into the text area and press a hotkey (I think it should be F2 or some other single button - for speed). The word under cursor gets searched among favourite's names and if found - is replaced with favourite's contents. Cursor gets positioned after it, and we are ready to type further. For expample, if I have to write some typical query like: SELECT COUNT(*) FROM table1 WHERE column1 IS DISTINCT FROM 100; Using my Favourites I have to type just: scf<F2>table1 w<F2>column1 idf<F2>100;
Also if I often address ad hoc queries to some specific tables with long names, I can make templates for them: sfbcah<F2> = SELECT * FROM billing.client_attr_hist And so on.
For convenience all these quick and short favourites can be stored in a separate subfolder. After some preparation and training one can make his everyday SQL typing much more pleasant :)
Also this patch adds a "proposed" file name for queries whose origin is INITIAL. Query texts passed to the constructor are always based on some object (DDL, SELECT, INSERT on it and so on). If the user chooses to save such a query, the filename probably will contain object's name. Well, if not - the user will type in his own name with same number of keystrokes. In my experience it works just fine in many cases, for example, saving DDLs to SVN.