postgresqlpgrouting

pgrouting error when trying to dump data into database


I was just following this tutorial HERE, its about, pgrouting, When I run the following command:

psql -U user -d postgres -f ~/Desktop/pgrouting-workshop/data/sampledata_routing.sql

I get an error saying the following:

/var/lib/postgresql/Desktop/pgrouting-workshop/data/sampledata_routing.sql: No such file or directory

On my desktop I do have a folder pgrouting-workshop, which does contain the folder data and the sql dump file.

So why am I getting this error?


Solution

  • Because your Desktop isn't in the postgres user's home directory, located at /var/lib/postgresql, but is instead located at /home/myusername/Desktop?

    Presumably the psql command you're running is under a sudo -u postgres -i shell, so ~/ means the postgres user's home directory.

    Use ~myusername/Desktop/blahblah. Note that the postgres user may not have permission to access it; you can chmod go+x ~ ~/Desktop (run as your user, not postgres) to change that.