Login or Sign Up
Logging in...
Remember me
Log in
Or
Sign Up
Forgot password or user name?
Log in with
Search in titles only
Search in PostgreSQL only
Search
Advanced Search
Forums
Product Launch
Updates
Today's Posts
Member List
Calendar
Home
Forum
Topic
PostgreSQL
Is it possible to execute query in shell script??
Collapse
X
Collapse
Posts
Latest Activity
Photos
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
lakk
New Member
Join Date:
Oct 2010
Posts:
2
#1
Is it possible to execute query in shell script??
Oct 6 '10, 05:11 PM
Having a database created, is it possible to excute queries on this database from a shell script file??
rski
Recognized Expert
Contributor
Join Date:
Dec 2006
Posts:
700
#2
Oct 6 '10, 05:55 PM
You mean something like that
Code:
psql database_name < file.sql
or that
Code:
psql database_name -f file.sql
Comment
Post
Cancel
lakk
New Member
Join Date:
Oct 2010
Posts:
2
#3
Oct 7 '10, 12:00 PM
Can you explain ur answer further..i dont get what you mean..
Comment
Post
Cancel
rski
Recognized Expert
Contributor
Join Date:
Dec 2006
Posts:
700
#4
Oct 7 '10, 06:48 PM
If you have a shell script and you want to call queries from this script you can do it using psql client. Queries you can put into file and use -f paremeter or you can use -c parameter and put queries explicitly
Code:
psql databasename -c "<query>"
Do you understand now?
Comment
Post
Cancel
Previous
template
Next
Working...
Yes
No
OK
OK
Cancel
👍
👎
☕
Comment