SELECT l.*, lanname AS name, quote_ident(usename) AS owner
 FROM pg_language l
 JOIN pg_user u ON (u.usesysid = l.lanowner)},
+        SQL2       => q{
+SELECT l.*, lanname AS name
+FROM pg_language l
+    },
     },
     type => {
         SQL       => q{
 
         for (@catalog_items) {
             my $name = $_->[0];
-            $dbinfo->{$name} = find_catalog_info($name, $x);
+            $dbinfo->{$name} = find_catalog_info($name, $x, $dbver{$x});
         }
 
         ## TODO:
 
     ## Grab information from one or more catalog tables
     ## Convert into a happy hashref and return it
+    ## Arguments: three
+    ## 1. Type of object
+    ## 2. Database number
+    ## 3. Version information for the database
+    ## Returns: large hashref of information
 
     ## What type of catalog object this is
     my $type = shift;
     ## Which database to run this against
     my $dbnum = shift or die;
 
+    ## The version information
+    my $dbver = shift or die;
+
     ## The SQL we use
-    my $SQL = $ci->{SQL} or die;
+    my $SQL = $ci->{SQL} or die "No SQL found for type '$type'\n";
+
+    ## Switch to alternate SQL for different versions
+    if ($type eq 'language') {
+        if (int $dbver->{major} <= 8.2) {
+            $SQL = $ci->{SQL2};
+        }
+    }
 
     if (exists $ci->{exclude}) {
         if ('temp_schemas' eq $ci->{exclude}) {
 
     $dbh->do('CREATE DATABASE ardala');
     $dbh->do('CREATE LANGUAGE plpgsql');
     $dbh->do('CREATE LANGUAGE plperlu');
+       $dbh->do("CREATE SCHEMA $fakeschema");
     $dbh->{AutoCommit} = 0;
     $dbh->{RaiseError} = 1;
 
     my $dbh = $self->{dbh} || die;
     $name ||= $fakeschema;
 
+       return;
     if (! exists $self->{keep_old_schema}) {
         $SQL = 'SELECT count(*) FROM pg_namespace WHERE nspname = ' . $dbh->quote($name);
         my $count = $dbh->selectall_arrayref($SQL)->[0][0];