473,387 Members | 1,388 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

pg_ctl problem

(sorry for the double post if there is one - i sent the mail to the
lisyt from the wrong address)

Hi,

Im passing this in the commmand line to start up the PostgreSQL server:

../pg_ctl start -w -D /Volumes/GROUCH\ 2/Database3

but its always giving me this error:

../postmaster: invalid argument: "2/Database3"

so i tried passing this: ( added quotes to the problematic database
path )

../pg_ctl start -w -D "/Volumes/GROUCH\ 2/Database3"

and i still get the same error.

Can i not pass a path with spaces in it?
How should i pass this command to the command line in order to get the
server up and running?

thanks!

--
Alexander Cohen
http://www.toomuchspace.com
(819) 348-9237
(819) 432-3443
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 23 '05 #1
9 4016
Alexander Cohen <al**@toomuchspace.com> wrote:
[snip]
so i tried passing this: ( added quotes to the problematic database
path )

./pg_ctl start -w -D "/Volumes/GROUCH\ 2/Database3"

and i still get the same error.

Can i not pass a path with spaces in it?
Possibly with enough "escaping," you could do it. pg_ctl is itself a
shell script. So when it expands the argument to the -D switch, at
least one set of quotes will be lost. (Btw: The back-slash wasn't
really necessary.)
How should i pass this command to the command line in order to get the
server up and running?


You might be able to find some combination of escape sequences,
repeated escape sequences, etc., etc., to get it to work. But then, if
pg_ctl is subsequently changed to alter the way that argument is
processed: You're screwed.

I hate to answer a question with a question, but if ever there was a
case where doing so would appear legitimate, this, IMO, would have to
be it. So... Why in God's name are you trying to do this? Why not
just get rid of the space and save yourself the current, and possibly
future, grief?

--
Jim Seymour | Spammers sue anti-spammers:
js******@LinxNet.com | http://www.LinxNet.com/misc/spam/slapp.php
http://jimsun.LinxNet.com | Please donate to the SpamCon Legal Fund:
| http://www.spamcon.org/legalfund/

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #2
> I hate to answer a question with a question, but if ever there was a
case where doing so would appear legitimate, this, IMO, would have to
be it. So... Why in God's name are you trying to do this? Why not
just get rid of the space and save yourself the current, and possibly
future, grief?


because this is an app for users and they might have spaces in their
path.

Alex
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #3
Alexander Cohen <al**@toomuchspace.com> wrote:

[snip]
Why not
just get rid of the space and save yourself the current, and possibly
future, grief?


because this is an app for users and they might have spaces in their
path.


*Users* are starting up postmaster? *shrug* ISTM you're left with the
following choices:

1. Work at it until you've figured-out just the right
combination of shell escapes to get the path though pg_ctl's
"cooking." The prior caveat applies: If pg_ctl is modified
relative to that switch's argument handling, it'll break again.

2. Modify pg_ctl so the argument, in all its processing, is
preserved with embedded spaces. Of course, the next release of
pgsql would require re-doing it if pg_ctl is changed.

3. Talk pgsql's developers into fixing the "problem."
(If you fix it, as in #2, you could submit a patch.)

4. Tell your users not to do that. Spaces in pathnames are
pure evil anyway. A problem generally only found with end-users
using (only) point-n-drool tools.

Personally, looking at pg_ctl's code, I think #1 is exceedingly
unlikely to succeed. #2 (and, by extension, #3) looks kind of
iffy, too.

Good luck.

--
Jim Seymour | Spammers sue anti-spammers:
js******@LinxNet.com | http://www.LinxNet.com/misc/spam/slapp.php
http://jimsun.LinxNet.com | Please donate to the SpamCon Legal Fund:
| http://www.spamcon.org/legalfund/

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #4
> *Users* are starting up postmaster? *shrug* ISTM you're left with the
following choices:
Users of the application that can start up the postmaster of course.
Some poeple dont like using the command line. :P

1. Work at it until you've figured-out just the right
combination of shell escapes to get the path though pg_ctl's
"cooking." The prior caveat applies: If pg_ctl is modified
relative to that switch's argument handling, it'll break again.

2. Modify pg_ctl so the argument, in all its processing, is
preserved with embedded spaces. Of course, the next release of
pgsql would require re-doing it if pg_ctl is changed.

3. Talk pgsql's developers into fixing the "problem."
(If you fix it, as in #2, you could submit a patch.)

4. Tell your users not to do that. Spaces in pathnames are
pure evil anyway. A problem generally only found with end-users
using (only) point-n-drool tools.

Personally, looking at pg_ctl's code, I think #1 is exceedingly
unlikely to succeed. #2 (and, by extension, #3) looks kind of
iffy, too.


im probably going to try all of them until i find something that
succeeds. I might just pass it all to the postmaster directly.

thanks!
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #5
Postgresql 7.3.4
RH 8.0

Hello all,

The client requirements are that from the website(a coldfusionmx app), they
could backup and restore the database from the list of backups available.
All i've given to work on is just that to allow user to select backup to
restore and also to allow user to perform a manual database backup.

Here's how the "manual backup" process goes. When user clicks on "Backup
Database Now", a row is inserted to a table (app_dbactionb) to trigger off
the pg_dump. Problem is an error msg appeared when i insert test data into
table:

"standard in must be a tty."

Below are the functions and trigger concerned:
###################################
CREATE TRIGGER autobackup
AFTER INSERT ON app_dbactionb
FOR EACH ROW
EXECUTE PROCEDURE initbackup ();
CREATE FUNCTION initbackup () RETURNS "trigger" AS '
begin
perform Backup ();
return NEW;
end;
' LANGUAGE 'plpgsql';
CREATE FUNCTION backup () RETURNS integer
AS '
system("/home/postgres/testbackupdb");
return 0;
'LANGUAGE plperlu;
###################################

Below is the testbackupdb (chmod 777, owner postgres):

#!/bin/bash
#File is named according to abbreviation of week name (Sun...Sat)
#e.g. nsvm_Mon_2004.db

backupdate=`date +%a_%Y`
/bin/su - postgres -c "/usr/local/pgsql/bin/pg_dump -f
/home/postgres/nsvm_$backupdate.db nsvm"
echo "Backup at `date` :
nsvm_$backupdate.db">>/home/postgres/nsvm_backup_log
I really appreciate any form of advice and feedback on this error. Please
let me know too, if there are more efficient ways to allow user to backup
from a webpage :) Thank you all for the time.
Best regards,
siew hui

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #6
js******@LinxNet.com (Jim Seymour) writes:
2. Modify pg_ctl so the argument, in all its processing, is
preserved with embedded spaces. Of course, the next release of
pgsql would require re-doing it if pg_ctl is changed. 3. Talk pgsql's developers into fixing the "problem."
(If you fix it, as in #2, you could submit a patch.)


It did look to me like pg_ctl was a few quotes shy of a load. If
someone wants to submit a patch to fix this, it'd be accepted.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #7
Hi again,

Is it possible that there is a permission problem etc that don't allow
plperlu function that calls a pg_dump command? I am still stumped, trying to
solve the problem of "Standard in must be a tty" whenever i triggered the
plperlu function :(

Any advice is greatly appreciated. Thank you in advance.

best regards,
siew hui
----- Original Message -----
From: "Siew Hui, Wong" <sh****@sebasasia.com>
Sent: Friday, April 09, 2004 11:27 AM
Subject: [GENERAL] Error in function to pg_dump: Standard in must be a tty

Postgresql 7.3.4
RH 8.0

Hello all,

The client requirements are that from the website(a coldfusionmx app), they could backup and restore the database from the list of backups available.
All i've given to work on is just that to allow user to select backup to
restore and also to allow user to perform a manual database backup.

Here's how the "manual backup" process goes. When user clicks on "Backup
Database Now", a row is inserted to a table (app_dbactionb) to trigger off
the pg_dump. Problem is an error msg appeared when i insert test data into
table:

"standard in must be a tty."

Below are the functions and trigger concerned:
###################################
CREATE TRIGGER autobackup
AFTER INSERT ON app_dbactionb
FOR EACH ROW
EXECUTE PROCEDURE initbackup ();
CREATE FUNCTION initbackup () RETURNS "trigger" AS '
begin
perform Backup ();
return NEW;
end;
' LANGUAGE 'plpgsql';
CREATE FUNCTION backup () RETURNS integer
AS '
system("/home/postgres/testbackupdb");
return 0;
'LANGUAGE plperlu;
###################################

Below is the testbackupdb (chmod 777, owner postgres):

#!/bin/bash
#File is named according to abbreviation of week name (Sun...Sat)
#e.g. nsvm_Mon_2004.db

backupdate=`date +%a_%Y`
/bin/su - postgres -c "/usr/local/pgsql/bin/pg_dump -f
/home/postgres/nsvm_$backupdate.db nsvm"
echo "Backup at `date` :
nsvm_$backupdate.db">>/home/postgres/nsvm_backup_log
I really appreciate any form of advice and feedback on this error. Please
let me know too, if there are more efficient ways to allow user to backup
from a webpage :) Thank you all for the time.
Best regards,
siew hui


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #8
"Siew Hui, Wong" <sh****@sebasasia.com> writes:
Is it possible that there is a permission problem etc that don't allow
plperlu function that calls a pg_dump command? I am still stumped, trying to
solve the problem of "Standard in must be a tty" whenever i triggered the
plperlu function :(


I'd guess that that complaint is coming from /bin/su because it's not
finding anyplace to ask for the password. But why are you trying to su
to postgres at all? Anything the backend launches will be running as
the postgres user to start with.

The entire project seems fatally flawed anyway ... you can't seriously
think it's a good idea to launch a complete-database pg_dump after every
row insertion. Quite aside from the performance implications, you
won't even manage to achieve what you presumably want, because the
pg_dump run is executed before the row-inserting transaction commits,
and so it won't include that new row.

I'd counsel thinking about launching periodic pg_dumps via a cron job,
or some such, instead. Also see the various replication tools that are
available.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #9
hi tom,

Based on your suggestion, I deleted the fragment "/bin/su - postgres -c"
from the bash script and it worked! Thanks for the pointer.

But for the way i go about fulfilling the user's reqs, I apologised if it
didn't come out clearly in the first post :) Let me try again.

A broker firm, the user needs to update the prices etc daily. If any mistake
happen in the updates, they would want to revert to the latest backup and
redo.

Hence, i am to create something that allows the user (from a webpage) to
manually backup and/or restore database of any backup date. So, the page
shows a list of backups for the last 7 days to be selected for restorating
and also a button for there-and-then manual backup of database.

For daily auto backup.i've already scheduled cronjob and it went well.

This is the new script that i've implemented which i have 'chown' to
postgres:

#!/bin/bash
#File is named according to abbreviation of week name (Sun...Sat)
#e.g. nsvm_Mon_2004.db

backupdate=`date +%a_%Y`
/usr/local/pgsql/bin/pg_dump -f /home/postgres/nsvm_$backupdate.db
excensio ## <--- the change
echo "Backup at `date` :
nsvm_$backupdate.db">>/home/postgres/nsvm_backup_log
Again, i appreciate any suggestions for more efficient ways. Thanks again !
best regards,
siew hui

----- Original Message -----
From: "Tom Lane" <tg*@sss.pgh.pa.us>
Sent: Monday, April 12, 2004 1:27 PM
Subject: Re: [GENERAL] Error in function to pg_dump: Standard in must be a
tty

"Siew Hui, Wong" <sh****@sebasasia.com> writes:
Is it possible that there is a permission problem etc that don't allow
plperlu function that calls a pg_dump command? I am still stumped, trying to solve the problem of "Standard in must be a tty" whenever i triggered the plperlu function :(


I'd guess that that complaint is coming from /bin/su because it's not
finding anyplace to ask for the password. But why are you trying to su
to postgres at all? Anything the backend launches will be running as
the postgres user to start with.

The entire project seems fatally flawed anyway ... you can't seriously
think it's a good idea to launch a complete-database pg_dump after every
row insertion. Quite aside from the performance implications, you
won't even manage to achieve what you presumably want, because the
pg_dump run is executed before the row-inserting transaction commits,
and so it won't include that new row.

I'd counsel thinking about launching periodic pg_dumps via a cron job,
or some such, instead. Also see the various replication tools that are
available.

regards, tom lane


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

117
by: Peter Olcott | last post by:
www.halting-problem.com
1
by: Allen Landsidel | last post by:
Here's maybe a silly question, but I haven't seen it asked or answered so.. For those settings in the .conf file that say "this doesn't take effect until the database is restarted".. does that...
1
by: Szûcs Gábor | last post by:
Dear Gurus, I have a similar problem as discussed in http://archives.postgresql.org/pgsql-novice/2003-06/msg00321.php This probably should go to pgsql-novice too, but I'm not a member of that...
0
by: mvh | last post by:
I had been rotating my log files with the equivalent of pg_ctl -w -s | flog /var/log/pgsql 2>&1 where 'flog' is a logfile rotation program... and this no longer seems to work with 7.4.1 -...
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
0
by: Alexander Cohen | last post by:
Hi, Im passing this in the commmand line to start up the PostgreSQL server: ../pg_ctl start -w -D /Volumes/GROUCH\ 2/Database3 but its always giving me this error: ../postmaster: invalid...
1
by: Alexander Cohen | last post by:
Has anyone attempted to write a version of pg_ctl in C code? Is it in the works anywhere? thanks! -- Alexander Cohen http://www.toomuchspace.com (819) 348-9237 (819) 432-3443
2
by: muteki | last post by:
Hi, I would like to know is the wait_seconds inside the pg_ctl script changable? If not, do you know what would happen if someone changed it from 60 sec to 7 sec? I found that my configuration...
0
by: Ed L. | last post by:
On 7.4.6 and earlier, we use apache's log rotation program as follows: pg_ctl start | rotatelogs ... If we have a configuration failure, say a bad parameter in postgresql.conf, we often don't...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.