aboutsummaryrefslogtreecommitdiff
path: root/src/bin/scripts/createlang.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2011-03-05 14:03:06 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2011-03-05 14:03:06 -0500
commitba0c93a0f46ca70cae47a8817067c1e98482979f (patch)
tree98686028d05eb9ca1d81a00bde94b057dbe7d6f3 /src/bin/scripts/createlang.c
parentc0f2b2e256a3e98c2a066cee8623b7ab156b7f9c (diff)
downloadpostgresql-ba0c93a0f46ca70cae47a8817067c1e98482979f.tar.gz
postgresql-ba0c93a0f46ca70cae47a8817067c1e98482979f.zip
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.
Diffstat (limited to 'src/bin/scripts/createlang.c')
-rw-r--r--src/bin/scripts/createlang.c10
1 files changed, 9 insertions, 1 deletions
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);