Thread: FAQ_MSWIN patch: clarify instructions

FAQ_MSWIN patch: clarify instructions

From
Daniel Convissor
Date:
Greetings:

I'm a long time MySQL/Windows user and have a very popular tutorial page
on the subject:  http://www.analysisandsolutions.com/code/mybasic.htm

I have been wanting to try out PostgreSQL for some time.  The need to do
some cross-platform testing has finally spurred me to take the plunge.
The new 7.4 release via Cygwin has made this a far simpler objective
(thanks to everyone who made this possible!).

While doing the install and during subsequent use, I ran into some
gotchas.  Fortunately, I was able to figure out what was going on and got
everything working... eventually.

I have put together a patch for FAQ_MSWIN which will help future users
avoid these hitches.  I hope this helps.

If y'all need clarification of why these steps were added, don't hesitate
to ask.  I've subscribed to the list, so there's no need to cc me.

Enjoy,

--Dan

--
     FREE scripts that make web and database programming easier
           http://www.analysisandsolutions.com/software/
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7th Ave #4AJ, Brooklyn NY    v: 718-854-0335   f: 718-854-0409

Attachment

Re: FAQ_MSWIN patch: clarify instructions

From
Daniel Convissor
Date:
Hi Folks:

On Thu, Nov 27, 2003 at 01:13:34AM -0500, Daniel Convissor wrote:

> +7.  If you want other users to be able to run PostgreSQL, it is
> +    necessary to ease the permissions on some files.  Adjust the
> +    permissions and paths to suit your requirements.
> +
> +       chmod 755 /usr/bin/pg_* /usr/bin/postgr*
> +       chmod 666 /usr/local/pgsql/data/global/pg_pwd
> +       chmod 666 /usr/local/pgsql/data/global/pg_fsm.cache

Strike those last two lines.  I just did a fresh initdb and there's a lot
more to it than just them.

I did something last time that made it readable by my user account*, but
didn't think to document it.  I'll need to experiment and get back to
y'all on this...  Or, perhaps someone here already knows the routine and
can post it.

* In Windows I have separate administrator and user accounts.  So, I
installed Cygwin and did initdb under the admin account, but want to be
able to access things under my user account.  By the way, I'm just using
pg to do some testing, so I'm not really worried about security on pg at
this point.

Thanks,

--Dan

--
     FREE scripts that make web and database programming easier
           http://www.analysisandsolutions.com/software/
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7th Ave #4AJ, Brooklyn NY    v: 718-854-0335   f: 718-854-0409

Re: FAQ_MSWIN patch: clarify instructions

From
"Leeuw van der, Tim"
Date:
Hiya,

Sorry for my ignorance and perhaps stupid question - my setup own is far
from ideal either.

But why do you want to *run* pg from normal user accounts? Why not have pg
running under it's own account, as a service?
Anyone who can start/stop services can start/stop the database then, and you
don't have to tweak permissions to give access to database-private files to
all users.
And if you're the only user and don't want to create a service, just do
initdb as from your normal user account and start it manually from the
console... That's what I do.


I just wish that su would work on windoze, then it would be much easier to
start pg manually under the same account always...

regards,

--Tim

-----Original Message-----
From: pgsql-cygwin-owner@postgresql.org
[mailto:pgsql-cygwin-owner@postgresql.org]On Behalf Of Daniel Convissor
Sent: donderdag 27 november 2003 9:41
To: pgsql-cygwin@postgresql.org
Subject: Re: [CYGWIN] FAQ_MSWIN patch: clarify instructions


Hi Folks:

On Thu, Nov 27, 2003 at 01:13:34AM -0500, Daniel Convissor wrote:

> +7.  If you want other users to be able to run PostgreSQL, it is
> +    necessary to ease the permissions on some files.  Adjust the
> +    permissions and paths to suit your requirements.
> +
> +       chmod 755 /usr/bin/pg_* /usr/bin/postgr*
> +       chmod 666 /usr/local/pgsql/data/global/pg_pwd
> +       chmod 666 /usr/local/pgsql/data/global/pg_fsm.cache

Strike those last two lines.  I just did a fresh initdb and there's a lot
more to it than just them.

I did something last time that made it readable by my user account*, but
didn't think to document it.  I'll need to experiment and get back to
y'all on this...  Or, perhaps someone here already knows the routine and
can post it.

* In Windows I have separate administrator and user accounts.  So, I
installed Cygwin and did initdb under the admin account, but want to be
able to access things under my user account.  By the way, I'm just using
pg to do some testing, so I'm not really worried about security on pg at
this point.

Thanks,

--Dan

--
     FREE scripts that make web and database programming easier
           http://www.analysisandsolutions.com/software/
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7th Ave #4AJ, Brooklyn NY    v: 718-854-0335   f: 718-854-0409

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

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

Re: FAQ_MSWIN patch: clarify instructions

From
Daniel Convissor
Date:
Hi Tim:

On Thu, Nov 27, 2003 at 03:26:06AM -0600, Leeuw van der, Tim wrote:

> But why do you want to *run* pg from normal user accounts? Why not have pg
> running under it's own account, as a service?

Legitimate question.  Because I'm not using pg as my main database system.
I'm just doing some quick tests.  It's not worth the hastle and overhead.

Enjoy,

--Dan

--
     FREE scripts that make web and database programming easier
           http://www.analysisandsolutions.com/software/
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7th Ave #4AJ, Brooklyn NY    v: 718-854-0335   f: 718-854-0409

Re: FAQ_MSWIN patch: clarify instructions

From
"Leeuw van der, Tim"
Date:
Hi Daniel,

Same for me of course, as I explained. But because of that I ran initdb from
my normal user account, not from an admin account.

regards,

--Tim

-----Original Message-----
From: pgsql-cygwin-owner@postgresql.org
[mailto:pgsql-cygwin-owner@postgresql.org]On Behalf Of Daniel Convissor
Sent: donderdag 27 november 2003 18:39
To: pgsql-cygwin@postgresql.org
Subject: Re: [CYGWIN] FAQ_MSWIN patch: clarify instructions


Hi Tim:

On Thu, Nov 27, 2003 at 03:26:06AM -0600, Leeuw van der, Tim wrote:

> But why do you want to *run* pg from normal user accounts? Why not have pg
> running under it's own account, as a service?

Legitimate question.  Because I'm not using pg as my main database system.
I'm just doing some quick tests.  It's not worth the hastle and overhead.

Enjoy,

--Dan

--
     FREE scripts that make web and database programming easier
           http://www.analysisandsolutions.com/software/
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7th Ave #4AJ, Brooklyn NY    v: 718-854-0335   f: 718-854-0409

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

Re: FAQ_MSWIN patch: clarify instructions

From
Daniel Convissor
Date:
Hi Tim:

On Thu, Nov 27, 2003 at 02:07:00PM -0500, Leeuw van der, Tim wrote:
>
> Same for me of course, as I explained. But because of that I ran initdb from
> my normal user account, not from an admin account.

I'm guessing you installed Cygwin from your user account as well.

Enjoy,

--Dan

TIP 99:  Delete unnecessary portions of prior posts.

--
     FREE scripts that make web and database programming easier
           http://www.analysisandsolutions.com/software/
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7th Ave #4AJ, Brooklyn NY    v: 718-854-0335   f: 718-854-0409

Re: FAQ_MSWIN patch: clarify instructions

From
Jason Tishler
Date:
On Thu, Nov 27, 2003 at 03:26:06AM -0600, Leeuw van der, Tim wrote:
> I just wish that su would work on windoze, then it would be much
> easier to start pg manually under the same account always...

Just setup ssh, then you can use something like the following to emulate
su:

    $ ssh postgres@localhost

Jason

--
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6

Re: FAQ_MSWIN patch: clarify instructions

From
"Leeuw van der, Tim"
Date:
Hm, thanks for the tip. I set up ssh some time ago but never really used it
much, never thought of trying this. And it works! <g>

thanks,

--Tim

-----Original Message-----
From: Jason Tishler [mailto:jason@tishler.net]
Sent: vrijdag 28 november 2003 1:05
To: Leeuw van der, Tim
Cc: 'Daniel Convissor'; pgsql-cygwin@postgresql.org
Subject: Re: [CYGWIN] FAQ_MSWIN patch: clarify instructions


On Thu, Nov 27, 2003 at 03:26:06AM -0600, Leeuw van der, Tim wrote:
> I just wish that su would work on windoze, then it would be much
> easier to start pg manually under the same account always...

Just setup ssh, then you can use something like the following to emulate
su:

    $ ssh postgres@localhost

Jason

--
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6

Re: FAQ_MSWIN patch: clarify instructions

From
Bruce Momjian
Date:
Should any part of this patch be applied?

---------------------------------------------------------------------------

Daniel Convissor wrote:
> Greetings:
>
> I'm a long time MySQL/Windows user and have a very popular tutorial page
> on the subject:  http://www.analysisandsolutions.com/code/mybasic.htm
>
> I have been wanting to try out PostgreSQL for some time.  The need to do
> some cross-platform testing has finally spurred me to take the plunge.
> The new 7.4 release via Cygwin has made this a far simpler objective
> (thanks to everyone who made this possible!).
>
> While doing the install and during subsequent use, I ran into some
> gotchas.  Fortunately, I was able to figure out what was going on and got
> everything working... eventually.
>
> I have put together a patch for FAQ_MSWIN which will help future users
> avoid these hitches.  I hope this helps.
>
> If y'all need clarification of why these steps were added, don't hesitate
> to ask.  I've subscribed to the list, so there's no need to cc me.
>
> Enjoy,
>
> --Dan
>
> --
>      FREE scripts that make web and database programming easier
>            http://www.analysisandsolutions.com/software/
>  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
>  4015 7th Ave #4AJ, Brooklyn NY    v: 718-854-0335   f: 718-854-0409

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faqs/FAQ.html

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: FAQ_MSWIN patch: clarify instructions

From
Jason Tishler
Date:
On Fri, Nov 28, 2003 at 03:34:46PM -0500, Bruce Momjian wrote:
> Should any part of this patch be applied?

IMO, no.  See below...

On Thu, Nov 27, 2003 at 01:13:34AM -0500, Daniel Convissor wrote:
> -    3c.  Start up the postmaster.  Use a command similar to the
> -         following:
> +         You must be logged on as the user that installed Cygwin in
> +         order for this command to work.

The above is not true if your Cygwin environment is set up correctly.
Unfortunately, a change in Windows security and a deficiency in Cygwin's
setup.exe exacerbates this problem.

> +         When referring to paths outside of Cygwin's root, PostgreSQL
> +         expects the paths to use the "/cygdrive/<drive>/<dir>" syntax
> +         rather than the Windows like syntax of "<drive>:/<dir>."
> +         Example:
> +
> +            /cygdrive/d/pgsql/data
> +

IMO, the above is extraneous detail.

> -            postmaster -D /usr/local/pgsql/data
> +    3c.  Set the PGDATA environment variable.  Example commands would be:
> +
> +            PGDATA=/usr/local/pgsql/data
> +            export PGDATA
> +
> +    3d.  Start up the server:
> +
> +            pg_ctl start

IMO, the above is only a "style" change.

>           This will start the postmaster, and if successful you will
>           see some initial log entries, and an entry "LOG: database
> @@ -58,6 +72,38 @@
>      refer to the README document included with Cygwin PostgreSQL.  It
>      is installed in the /usr/share/doc/Cygwin directory.
>
> +6.  If you don't want to run the programs as a service, the following
> +    steps are helpful:
> +
> +    6a.  Add the following lines to the .profile file in your home
> +         directory.  This will make it easier to start the server when
> +         desired.  Of course, adjust the paths as needed:
> +
> +            ipc-daemon2 &

IMO, starting ipc-daemon2 from a user's .profile is a bad approach to
achieve this goal.  Use the service approach or Windows startup folder
instead.

> +            PGDATA=/usr/local/pgsql/data
> +            export PGDATA
> +
> +    6b.  To start the server, use this command:
> +
> +            pg_ctl start
> +
> +    6c.  Before exiting your Cygwin shell prompt, make sure to stop
> +         the PostgreSQL server using the following command:
> +
> +            pg_ctl stop

IMO, the above is a rehash of information already in the FAQ.

> +         This procedure can be automated by putting that command inside
> +         the .bash_logout file in your home directory.  You will need to
> +         create that file if it does not yet exist.

IMO, the above is extraneous detail.

> +7.  If you want other users to be able to run PostgreSQL, it is
> +    necessary to ease the permissions on some files.  Adjust the
> +    permissions and paths to suit your requirements.
> +
> +       chmod 755 /usr/bin/pg_* /usr/bin/postgr*
> +       chmod 666 /usr/local/pgsql/data/global/pg_pwd
> +       chmod 666 /usr/local/pgsql/data/global/pg_fsm.cache
> +

IMO, the above is a bad approach to achieve this goal.  Use the service
approach instead.

Jason

--
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6

Re: FAQ_MSWIN patch: clarify instructions

From
Daniel Convissor
Date:
Hi Jason, et al:

What the reply calls "extraneous detail" are details that tripped me up --
and as I can see from being on this list for just a few days, several
other people as well.

After grep'ing for some phrases you've mentioned, I see now see that part
of the confusion is the multiplicity of readme and faq files.

   /usr/share/doc/Cygwin/postgresql-7.4.README
   /usr/share/doc/postgresql-7.4/README
   /usr/share/doc/postgresql-7.4/FAQ_MSWIN
   /usr/share/doc/postgresql-7.4/INSTALL
   ...etc...

Now I see most of the extraneous things I suggested are contained in
postgresql-7.4.README.

This brings up the following...

None of these files -- including specific locations and names -- are
mentioned by the docs at http://www.postgresql.org/docs/

Each of these documents make vague references to the other documents,
rather than providing exact names.  Also, these references are made only
in some circumstances, not all that are relevant -- or perhaps better, up
at the top of each document.

The documents contain overlapping information.

It seems FAQ_MSWIN is superfluous.  The bits of information there that
aren't in postgresql-7.4.README should be moved to postgresql-7.4.README.

Here are some replies to specific points...


On Mon, Dec 01, 2003 at 10:49:09AM -0500, Jason Tishler wrote:
> On Thu, Nov 27, 2003 at 01:13:34AM -0500, Daniel Convissor wrote:
> > -    3c.  Start up the postmaster.  Use a command similar to the
> > -         following:
> > +         You must be logged on as the user that installed Cygwin in
> > +         order for this command to work.
>
> The above is not true if your Cygwin environment is set up correctly.
> Unfortunately, a change in Windows security and a deficiency in Cygwin's
> setup.exe exacerbates this problem.

Please elaborate.  Also, the FAQ should elaborate.


> > +         When referring to paths outside of Cygwin's root, PostgreSQL
> > +         expects the paths to use the "/cygdrive/<drive>/<dir>" syntax
> > +         rather than the Windows like syntax of "<drive>:/<dir>."
> > +         Example:
> > +
> > +            /cygdrive/d/pgsql/data
>
> IMO, the above is extraneous detail.

But it's not.  Some programs under Cygwin need the "c:/dir" syntax and
others need the "/cygdrive/d/dir" syntax.  This issue caused me to waste
time during my install.  I'm sure other people have and will continue to
needlessly waste their time too.  There's no reason for this to happen
when it can be quickly explained here.

$ initdb -D d:/pgfoo
The files belonging to this database system will be owned by user "droot".
This user must also own the server process.

The database cluster will be initialized with locale C.

creating directory d:/pgfoo... ok
creating directory d:/pgfoo/base... ok
creating directory d:/pgfoo/global... ok
creating directory d:/pgfoo/pg_xlog... ok
creating directory d:/pgfoo/pg_clog... ok
selecting default max_connections... 10
selecting default shared_buffers... 50
creating configuration files... ok
creating template1 database in d:/pgfoo/base/1... FATAL:
"/home/droot/d:/pgfoo"
 is not a valid data directory
DETAIL:  File "/home/droot/d:/pgfoo/PG_VERSION" is missing.

initdb: failed
initdb: removing data directory "d:/pgfoo"



> > -            postmaster -D /usr/local/pgsql/data
> > +    3c.  Set the PGDATA environment variable.  Example commands would be:
> > +
> > +            PGDATA=/usr/local/pgsql/data
> > +            export PGDATA
> > +
> > +    3d.  Start up the server:
> > +
> > +            pg_ctl start
>
> IMO, the above is only a "style" change.

Yeah.  But doesn't learning this style here makes long term usage easier?

Thanks,

--Dan

--
     FREE scripts that make web and database programming easier
           http://www.analysisandsolutions.com/software/
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7th Ave #4AJ, Brooklyn NY    v: 718-854-0335   f: 718-854-0409

Re: FAQ_MSWIN patch: clarify instructions

From
Jason Tishler
Date:
Daniel,

Sorry for the sluggish response time, but I was traveling on business
all of last week.

On Tue, Dec 09, 2003 at 10:52:18PM -0500, Daniel Convissor wrote:
> What the reply calls "extraneous detail" are details that tripped me
> up -- and as I can see from being on this list for just a few days,
> several other people as well.

IMO, my README should *not* be a Cygwin tutorial, user's guide, FAQ,
etc.  Better versions than I have the time, energy, and ability to
produce already exist.  For example:

    http://cygwin.com/cygwin-ug-net/
    http://cygwin.com/faq.html

> After grep'ing for some phrases you've mentioned, I see now see that part
> of the confusion is the multiplicity of readme and faq files.
>
>    /usr/share/doc/Cygwin/postgresql-7.4.README

The above is my README which I have full control over.

>    /usr/share/doc/postgresql-7.4/README
>    /usr/share/doc/postgresql-7.4/FAQ_MSWIN
>    /usr/share/doc/postgresql-7.4/INSTALL

The above are part of the standard PostgreSQL distribution which I can
only submit patches against.

> Now I see most of the extraneous things I suggested are contained in
> postgresql-7.4.README.

Yes.

> This brings up the following...
>
> None of these files -- including specific locations and names -- are
> mentioned by the docs at http://www.postgresql.org/docs/
>
> Each of these documents make vague references to the other documents,
> rather than providing exact names.  Also, these references are made only
> in some circumstances, not all that are relevant -- or perhaps better, up
> at the top of each document.
>
> The documents contain overlapping information.
>
> It seems FAQ_MSWIN is superfluous.  The bits of information there that
> aren't in postgresql-7.4.README should be moved to postgresql-7.4.README.

I'm sorry but I don't have the time or motivation to resolve the above
right now.

> Here are some replies to specific points...
>
> On Mon, Dec 01, 2003 at 10:49:09AM -0500, Jason Tishler wrote:
> > On Thu, Nov 27, 2003 at 01:13:34AM -0500, Daniel Convissor wrote:
> > > -    3c.  Start up the postmaster.  Use a command similar to the
> > > -         following:
> > > +         You must be logged on as the user that installed Cygwin in
> > > +         order for this command to work.
> >
> > The above is not true if your Cygwin environment is set up correctly.
> > Unfortunately, a change in Windows security and a deficiency in Cygwin's
> > setup.exe exacerbates this problem.
>
> Please elaborate.  Also, the FAQ should elaborate.

Please search the archives (include the Cygwin one) for the details.  I
attempted to resolve this issue, but was unsuccessful.  Ultimately, this
will (or should be resolved) when an ntsec patch is finally applied to
Cygwin's setup.exe.

> > > +         When referring to paths outside of Cygwin's root, PostgreSQL
> > > +         expects the paths to use the "/cygdrive/<drive>/<dir>" syntax
> > > +         rather than the Windows like syntax of "<drive>:/<dir>."
> > > +         Example:
> > > +
> > > +            /cygdrive/d/pgsql/data
> >
> > IMO, the above is extraneous detail.
>
> But it's not.  Some programs under Cygwin need the "c:/dir" syntax and
> others need the "/cygdrive/d/dir" syntax.
> [snip]

The above is not true.  No Cygwin programs require the "c:/dir" syntax
-- all can use the "/cygdrive/d/dir" syntax.

> > > -            postmaster -D /usr/local/pgsql/data
> > > +    3c.  Set the PGDATA environment variable.  Example commands would be:
> > > +
> > > +            PGDATA=/usr/local/pgsql/data
> > > +            export PGDATA
> > > +
> > > +    3d.  Start up the server:
> > > +
> > > +            pg_ctl start
> >
> > IMO, the above is only a "style" change.
>
> Yeah.  But doesn't learning this style here makes long term usage easier?

Maybe, but the focus of my README is to describe the differences between
a Cygwin and Unix PostgreSQL install -- it's not to be a complete
PostgreSQL tutorial.  Likewise for FAQ_MSWIN.

Jason

--
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6

Re: FAQ_MSWIN patch: clarify instructions

From
Peter Eisentraut
Date:
Daniel Convissor wrote:
> It seems FAQ_MSWIN is superfluous.  The bits of information there
> that aren't in postgresql-7.4.README should be moved to
> postgresql-7.4.README.

That won't fly because the former document is for users who are trying
to compile PostgreSQL from source.