I've started playing with a structure based on the description in this message: http://groups.google.com/groups?hl=en&lr=lang_en&ie=UTF-8&oe=UTF-8&safe=off&selm=1043257402.83856.112.camel%40jester&rnum=21 Basically, it consists of a very simple schema to tell PSQL what \? commands are available, and the query to use to fetch the information. - User types \d<command>. Psql (as a last resort after the checks in command.c) will query the database to see if the \d<command> exists with the number of arguments the user has supplied. - If it exists (regular expression match of what the user typed as <command> against column cmd_expression), it pulls out the SQL, prepares it via PREPARE, EXECUTES it, and displays the results. See schema and simple psql.patch attached. Caching, etc. could be done to speed things up -- not to mention keeping the plans around, but this was a quick hack. 2 sample commands are included. \dqtest (prints out a row of junk), \dqdb (prints db listing -- like \l), and \dqdb <arg> (prints db listing -- but with a LIKE match on the dbname). Thoughts or remarks? It allows all versions of psql using that table to pick up available commands for the database (old psql, new db gets commands for new db) but translations for column headers, etc. will be wonky as they're still tied to psql. -- Rod Taylor <rbt@rbt.ca> PGP Key: http://www.rbt.ca/rbtpub.asc
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера