473,771 Members | 2,392 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 YourEmailAddres sHere" to ma*******@postg resql.org)

Nov 23 '05 #1
9 4069
Alexander Cohen <al**@toomuchsp ace.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******@LinxNe t.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*******@postg resql.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**@toomuchsp ace.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******@LinxNe t.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.d b

backupdate=`dat e +%a_%Y`
/bin/su - postgres -c "/usr/local/pgsql/bin/pg_dump -f
/home/postgres/nsvm_$backupdat e.db nsvm"
echo "Backup at `date` :
nsvm_$backupdat e.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******@LinxNe t.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****@sebasas ia.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.d b

backupdate=`dat e +%a_%Y`
/bin/su - postgres -c "/usr/local/pgsql/bin/pg_dump -f
/home/postgres/nsvm_$backupdat e.db nsvm"
echo "Backup at `date` :
nsvm_$backupdat e.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****@sebasas ia.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.d b

backupdate=`dat e +%a_%Y`
/usr/local/pgsql/bin/pg_dump -f /home/postgres/nsvm_$backupdat e.db
excensio ## <--- the change
echo "Backup at `date` :
nsvm_$backupdat e.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****@sebasas ia.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
7266
by: Peter Olcott | last post by:
www.halting-problem.com
1
2174
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 mean that "pg_ctl reload" also does not reload them? I imagine the statement is specific, and means what it says, but I'm curious anyway.. s'all for now.
1
3819
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 list so please forgive my lazyness. I use Debian Woody Linux and installed postgres (v7.2.1), but I needed a newer version, so decided to try 7.4RC2 (which is not in the news yet, as I
0
1253
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 - this may not have worked with 7.4 either, but I am sure that it worked with 7.3 and earlier. When I run the above command, it returns to the shell immediately.
28
5222
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(); .... and then call the virtual method, why is it that the base class's method is called instead of the overridden method? How do I fix this if I don't know at runtime what the child class is? I'm using Activator.CreateInstance() to load the...
0
383
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 argument: "2/Database3"
1
1512
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
1240
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 has been changed by someone else in order to shorten the shutdown wait time. But I am guessing there is some fundamental reasoning for the default values (60sec) and would like to know what's the side effect if this has been modified. Thanks,
0
2168
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 quickly notice because it goes to stdout (into the log). It'd be nice if it went to stderr as well so we could see it without having to search the log, but that wouldn't work if we wanted to capture stderr in the logs (do normal ERROR messages...
0
9619
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10261
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10103
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9911
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6713
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.