Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I work with PostgreSQL 9.2 and bash script. I have a problem.

My DB is TestDB , Table name is config

and my bash code is

sudo -u postgres psql -c "select count(*) from public.config where var_name='url'"

result is

ERROR: relation "public.config" does not exist

Can anybody help me?

share|improve this question
1  
sudo -u postgres psql TestDB -c "select count(*) from config where var_name='url'" –  cptPH Jul 12 '13 at 11:39
    
Thanks a lot of.It works fine –  mindia Jul 12 '13 at 11:43
2  
@Patrick You should make that an answer, so that it can be accepted. –  Ansgar Wiechers Jul 12 '13 at 11:44
    
@AnsgarWiechers ok i did ;-) –  cptPH Jul 12 '13 at 11:47

1 Answer 1

up vote 3 down vote accepted
sudo -u postgres psql TestDB -c "select count(*) from config where var_name='url'

The Database was missing, so you executed the command into postgres db where you probably don't have that table ;-)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.