On Wed, Oct 12, 2011 at 19:36, Tom Lane <t...@sss.pgh.pa.us> wrote: > Magnus Hagander <mag...@hagander.net> writes: >> On Wed, Oct 12, 2011 at 17:40, Tom Lane <t...@sss.pgh.pa.us> wrote: >>> The only thing the \echo approach will cost us is a few more lines of C >>> code in execute_extension_script(), and I think it's more than worth >>> that given the evident scope of the problem. > >> +1. > > PFA, a sample patch for this --- I've only bothered to change one script > file here, but will of course do the rest if there are no further > objections. The technique actually works even better than I expected, > because of the seemingly nowhere documented fact that \quit in a script > file doesn't terminate psql, only processing of the script. So what > I get is > > regression=# \i ~/postgres/share/extension/cube--1.0.sql > Use "CREATE EXTENSION cube" to load this file. > regression=# > > which is about as good as one could hope for.
Looks great to me. I guess the failure scenario is if someone has an extension from 9.1.2 and tries to load it into 9.1.1 or earlier, in which case they will get a syntax error or somehing when trying to run the CREATE EXTENSION command, right? I doubt that's something worth dealing with - it's a lot less likely to happen. We might want to document this for other third-party extension developers to use as a trick as well? -- Magnus Hagander Me: http://www.hagander.net/ Work: http://www.redpill-linpro.com/ -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers