Thread: pipe line error (psql command)
Hi all.
I got some error about psql pipeline.
I input the command in shell script below :
“shp2pgsql –d –w –I –s 987987(custom srid) test.shp test | psql –h testhost –d testdb”
The problem is, when I check the table list and geometry_columns table, that it doesn’t have schema_name “public”.
It’s like “select AddGeometryColumn(‘’,’test’,’the_geom’,987987,’MULTIPOLYGON’,2);”
There’s no ‘public’…
Before “|”, it doesn’t have an error. I confirmed the output messege by using “echo”.
If I copy the command before “|” like “shp2pgsql –d –w –I –s 987987 test.shp test”, and then typing by keyboard the “| psql –h testhost –d testdb”
It is working well including ‘public’. It’s occurred error only after executing shell script like $./test.sh
How can I do? What should I change or something to do?
Thanks in advanced.
Kevin Lee.
Best Regards.
On Sunday, April 24, 2011 8:01:23 pm Hyung Joo Lee wrote: > Hi all. > > I got some error about psql pipeline. > > I input the command in shell script below : > > "shp2pgsql -d -w -I -s 987987(custom srid) test.shp test | psql -h testhost > -d testdb" > > The problem is, when I check the table list and geometry_columns table, > that it doesn't have schema_name "public". What schema name does it have? > > It's like "select > AddGeometryColumn('','test','the_geom',987987,'MULTIPOLYGON',2);" I am sure what you are trying to show with the above? > > There's no 'public'... Try the command below : SHOW search_path ; > > Before "|", it doesn't have an error. I confirmed the output messege by > using "echo". > > If I copy the command before "|" like "shp2pgsql -d -w -I -s 987987 > test.shp test", and then typing by keyboard the "| psql -h testhost -d > testdb" > > It is working well including 'public'. It's occurred error only after > executing shell script like $./test.sh > > How can I do? What should I change or something to do? Well shell scripts have a restricted $PATH, which would one difference. Without more information it is hard to tell. In other words the rest of the script, who you are running the script as, who you are connecting to the database as? > > > Thanks in advanced. > > Kevin Lee. > Best Regards. -- Adrian Klaver adrian.klaver@gmail.com
I had a similar problem. When executing my shp2pgsql command within a bash shell script it failed and provided me with the valid options. Adrian Klaver, with a couple of emails back and forth, identified my error. I had not been using single and double quotes to assign my 'command' to a variable and then tried 'executing' the contents of the variable. This was done for my beginner level progress monitoring and logging. Adrian noticed a tick (`) or back quote is needed instead of the single or double quote. My scripts are now singing along nicely. Thank you Adrian. Jerry -- View this message in context: http://postgresql.1045698.n5.nabble.com/pipe-line-error-psql-command-tp4337702p4365141.html Sent from the PostgreSQL - general mailing list archive at Nabble.com.