PostgreSQL loader script stops on error.
#!/bin/bash
+# exit upon error
+set -e
+
PG_CSV_DIR=${PG_CSV_DIR:-$(pwd)/../../../ldbc_snb_datagen/social_network/}
PG_DB_NAME=${PG_DB_NAME:-ldbcsf1}
PG_USER=${PG_USER:-$USER}
@@ -11,7 +14,7 @@ cat $PG_CSV_DIR/comment_0_0.csv | \
awk -F '|' '{print $1"||"$2"|"$3"|"$4"||"$5"|"$6"|"$7"|"$8"||"$9 $10}' > \
$PG_CSV_DIR/comment_0_0-postgres.csv
-/usr/bin/dropdb $PG_DB_NAME -U $PG_USER
+/usr/bin/dropdb --if-exists $PG_DB_NAME -U $PG_USER
/usr/bin/createdb $PG_DB_NAME -U $PG_USER --template template0 -l "C"
/usr/bin/psql -d $PG_DB_NAME -U $PG_USER -a -f schema.sql
(cat snb-load.sql | sed "s|PATHVAR|$PG_CSV_DIR|g"; echo "\q\n") | /usr/bin/psql -d $PG_DB_NAME -U $PG_USER
