]> git.openstreetmap.org Git - nominatim.git/commitdiff
make errors from psql in setup fatal
authorSarah Hoffmann <lonvia@denofr.de>
Sat, 12 Apr 2014 11:16:30 +0000 (13:16 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Sun, 13 Apr 2014 14:09:27 +0000 (16:09 +0200)
utils/setup.php

index 8d0a20b8e97e1b6bdc28bd939aa94ce83ca652f5..9e946035c6e4ff8201dd69fa0cf67b19a40d8a27 100755 (executable)
                {
                        pgsqlRunScript('update country_name set partition = 0');
                }
+
+               // the following will be needed by create_functions later but
+               // is only defined in the subsequently called create_tables.
+               // Create dummies here that will be overwritten by the proper
+               // versions in create-tables.
+               pgsqlRunScript('CREATE TABLE place_boundingbox ()');
+               pgsqlRunScript('create type wikipedia_article_match as ()');
        }
 
        if ($aCMDResult['import-data'] || $aCMDResult['all'])
                }
                fclose($ahPipes[1]);
 
-               proc_close($hProcess);
+               $iReturn = proc_close($hProcess);
+               if ($iReturn > 0)
+               {
+                       fail("pgsql returned with error code ($iReturn)");
+               }
                if ($ahGzipPipes)
                {
                        fclose($ahGzipPipes[1]);
                $aDSNInfo = DB::parseDSN(CONST_Database_DSN);
                if (!isset($aDSNInfo['port']) || !$aDSNInfo['port']) $aDSNInfo['port'] = 5432;
                $sCMD = 'psql -p '.$aDSNInfo['port'].' -d '.$aDSNInfo['database'];
+               $sCMD .= ' -v ON_ERROR_STOP=1';
                $aDescriptors = array(
                        0 => array('pipe', 'r'),
                        1 => STDOUT, 
                        $sScript = substr($sScript, $written);
                }
                fclose($ahPipes[0]);
-               proc_close($hProcess);
+               $iReturn = proc_close($hProcess);
+               if ($iReturn > 0)
+               {
+                       fail("pgsql returned with error code ($iReturn)");
+               }
        }
 
        function pgsqlRunRestoreData($sDumpFile)
                }
                fclose($ahPipes[1]);
 
-               proc_close($hProcess);
+               $iReturn = proc_close($hProcess);
+               if ($iReturn > 0)
+               {
+                       fail("pgsql returned with error code ($iReturn)");
+               }
        }
 
        function pgsqlRunDropAndRestore($sDumpFile)
                }
                fclose($ahPipes[1]);
 
-               proc_close($hProcess);
+               $iReturn = proc_close($hProcess);
+               if ($iReturn > 0)
+               {
+                       fail("pgsql returned with error code ($iReturn)");
+               }
        }
 
        function passthruCheckReturn($cmd)