summaryrefslogtreecommitdiff
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.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/bin/scripts/createlang.c b/src/bin/scripts/createlang.c
index a36b39bdee..c2153db630 100644
--- a/src/bin/scripts/createlang.c
+++ b/src/bin/scripts/createlang.c
@@ -2,10 +2,10 @@
*
* createlang
*
- * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/bin/scripts/createlang.c,v 1.35 2010/01/02 16:58:00 momjian Exp $
+ * 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);