aboutsummaryrefslogtreecommitdiff
path: root/src/bin/scripts/createlang.c
diff options
context:
space:
mode:
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);