dbt2-shell script problem - Mailing list pgsql-hackers

From Jonas J
Subject dbt2-shell script problem
Date
Msg-id 68962a631001111318k7eb9628ek198951e1aff489f8@mail.gmail.com
Whole thread Raw
Responses Re: dbt2-shell script problem  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Hi guys,<br /><br />I get the dbt2 project from the git tree. And i'm trying to make it work with postgres. The problem
isin one of the dbt2 shell scripts. Since I dont understand of Shell Script Programing, here is my problem: (I will
postthe script on the end)<br /><br />1 - I executed:<br />  dbt2-pgsql-load-db -d /tmp/fodao<br />2 - I got the
error:<br/><br />dbt2-pgsql-load-db -d /tmp/fodao<br />[: 77: x: unexpected operator<br />[: 77: no: unexpected
operator<br/>Loading customer table...<br /> COPY customer FROM '/tmp/fodao/.data' WITH NULL AS '';<br />ERROR:  could
notopen file "/tmp/fodao/.data" for reading: No such file or directory<br /><br />3 - I think the correct place should
be'/tmp/fodao/customer.data' instead of "/tmp/fodao/.data"<br /><br />Can anyone help me with this Bash Script ??<br
/><br/>Mant thanks in advace,<br />Jonas<br /><br />--- here comes the scrip:<br />#!/bin/sh<br /><br />#<br /># This
fileis released under the terms of the Artistic License.<br /># Please see # the file LICENSE, included in this
package,for details.<br /> #<br /># Copyright (C) 2002-2008 Mark Wong & Open Source Development Labs, Inc.<br
/>#<br/><br />if [ -z ${DBNAME} ]; then<br />    echo "DBNAME not defined."<br />    exit 1<br />fi<br /><br
/>BACKGROUND="no"<br/><br /> usage()<br />{<br />    echo "usage: `basename $0` -d <dir> [-b] [-l <port>]
[-t]"<br/>    echo "  <dir> is where the data files are."<br />}<br /><br />while getopts "bd:l:t" OPT; do<br />
   case ${OPT} in<br />    b)<br />        BACKGROUND="yes"<br />        ;;<br />    d)<br />       
DBDATA=${OPTARG}<br/>        ;;<br />    l)<br />        PORT=${OPTARG}<br />        ;;<br />    t)<br />       
TABLESPACES_FLAG="-t"<br/>         ;;<br />    esac<br />done<br /><br />if [ "x${DBDATA}" = "x" ]; then<br />   
usage<br/>    exit 1<br />fi<br /><br />if [ ! "x${PORT}" = "x" ]; then<br />    PORTARG="-p ${PORT}"<br /> fi<br /><br
/>#Load tables<br /># This background stuff is honestly kinda ugly. IMO the right way to do this<br /># is to utilize
make-j<br /><br />load_table2() {<br />    $1 "$2" || exit 1<br />    $1 "$3" || exit 1<br /> }<br /><br />load_table()
{<br/>    table=$1<br />    if [ "x$2" == "x" ]; then<br />        file=$table.data<br />    else<br />       
file=$2.data<br/>    fi<br /><br />    local sql="COPY $table FROM '${DBDATA}/$file' WITH NULL AS '';"<br />     local
cmd="psql${PORTARG} -e -d ${DBNAME} -c "<br />    if [ "${BACKGROUND}" == "yes" ]; then<br />        echo "Loading
$tabletable in the background..."<br />        load_table2 "${cmd}" "${sql}" "VACUUM ANALYZE $table;" &<br />    
else<br/>        echo "Loading $table table..."<br />        ${cmd} "${sql}" || exit 1<br />    fi<br />}<br /><br
/>load_tablecustomer<br />load_table district<br />load_table history<br />load_table item<br />load_table new_order<br
/>load_table order_line<br />load_table orders order<br />load_table stock<br />load_table warehouse<br /><br />wait<br
/><br/># load C or pl/pgsql implementation of the stored procedures<br />#if true; then<br /># 
${DIR}/dbt2-pgsql-load-stored-procs-l ${PORT} -t c|| exit 1<br /> #else<br />#  ${DIR}/dbt2-pgsql-load-stored-procs -l
${PORT}-t plpgsql || exit 1<br />#fi<br /><br />exit 0<br /><br /><br /><br /><br /><br /><br /><br /> 

pgsql-hackers by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: Compression Library and Usages
Next
From: Dimitri Fontaine
Date:
Subject: Re: Compression Library and Usages