From ba0c93a0f46ca70cae47a8817067c1e98482979f Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 5 Mar 2011 14:03:06 -0500 Subject: Convert createlang/droplang to use CREATE/DROP EXTENSION. In createlang this is a one-line change. In droplang there's a whole lot of cruft that can be discarded since the extension mechanism now manages removal of the language's support functions. Also, add deprecation notices to these two programs' reference pages, since per discussion we may toss them overboard altogether in a release or two. --- src/bin/scripts/createlang.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/bin/scripts/createlang.c') diff --git a/src/bin/scripts/createlang.c b/src/bin/scripts/createlang.c index 3c68400528a..c2153db630e 100644 --- a/src/bin/scripts/createlang.c +++ b/src/bin/scripts/createlang.c @@ -188,7 +188,15 @@ main(int argc, char *argv[]) } PQclear(result); - printfPQExpBuffer(&sql, "CREATE LANGUAGE \"%s\";\n", langname); + /* + * In 9.1 and up, assume that languages should be installed using CREATE + * EXTENSION. However, it's possible this tool could be used against an + * older server, and it's easy enough to continue supporting the old way. + */ + if (PQserverVersion(conn) >= 90100) + printfPQExpBuffer(&sql, "CREATE EXTENSION \"%s\";\n", langname); + else + printfPQExpBuffer(&sql, "CREATE LANGUAGE \"%s\";\n", langname); if (echo) printf("%s", sql.data); -- cgit v1.2.3