Обсуждение: RE: how do I set DateStyle = European in postmaster ?

Поиск
Список
Период
Сортировка

RE: how do I set DateStyle = European in postmaster ?

От
Gary Stainburn
Дата:
-----Original Message-----
From:    Michael Holopainen [SMTP:michael@laserle.fi]
Sent:    Wednesday, July 05, 2000 7:46 AM
Cc:    pgsql-admin@postgresql.org
Subject:    [ADMIN] how do I set DateStyle = European in postmaster ?

>How do I set datestyle to European in server end ?
>
>I tried running postmaster with "-oe" as instructed in one email, but it
>resulted as error it did not accept -oe.
>for moment I all connections set datestyle = European, but it's not
>enough.

Use '-o -e'

the '-o' tells the postmaster to pass whatever is next ('-e') to the back end process.

-----------------------------------------
Gary Stainburn.
Work: http://www.ringways.co.uk mailto:gary.stainburn@ringways.co.uk
REVCOM: http://www.revcom.org.uk mailto:gary.stainburn@revcom.org.uk
-----------------------------------------
Murphy's Laws: (326) If it jams - force it. If it breaks, it needed replacing anyway.
-----------------------------------------


RE: how do I set DateStyle = European in postmaster ?

От
Gary Stainburn
Дата:
-----Original Message-----
From:    Michael Holopainen [SMTP:michael@laserle.fi]
Sent:    Friday, July 07, 2000 7:27 AM
To:    Gary Stainburn
Subject:    Re: [ADMIN] how do I set DateStyle = European in postmaster ?

>Thank you for your help, but
>what is correct postmaster options syntax in (linux) startup script?
>
>Here are the variations I have seen
>
>-oe
>-o -e
>'-o -e'
>-o "-e"
>"-oe"
>
>atleast -oe and -o -e do not work. So I suspect it is -o "-e"
>Am I correct ?

Choices 1 and 5 are the same and wrong.
Choices 2 and 4 are the same and right.
Choice 2 is the one that I use.

Most of this formatting is down to the shell and not postmaster, but
what you should be telling postmaster with the '-o' argument is to pass
the next argument '-e' to the backend process.

What happens when you make a connection to the postmaster, either by
starting psql, DBI, pgaccess, odbc connection etc, is that postmaster
forks another process to actually do the work.  That is why you need to
do it like this.

With choice 1, you have just one argument.  With choice 3 you still only
have one argument because you have enclosed it inside quotes.  When the
shell interprets the line it uses spaces to split the arguments up.
Quotes override this behaviour by keeping everything inside them -
including the spaces - as one argument.
This is why choice 1 = 5 and 2 = 3.

Can you post the script that you use to start the postmaster and I will
have a look at it.  Also, it is always a good idea to Cc: the mailing
list with any follow-ups because you then get other people seeing the
message.

>
>(postgres is in use so, I can't just restart it when I want. So it would
>be good to KNOW excatly what to do, coz when I stop it, I do not have
>time to play with it [I'm sure you know the feeling...
>"can_i_use_the_db_yet, (30 sec later)can_i_use_the_db_yet, etc. "] )

I know exactly what you mean, and to make it worse, I have a 'real-time'
feed from a logger that *expects* it to be there 24x7 and allows very
little latitude - it has enough buffer for a few minutes only, just
about enough time to reboot the PC.

>
>-michael (A)
[snip]

-----------------------------------------
Gary Stainburn.
Work: http://www.ringways.co.uk mailto:gary.stainburn@ringways.co.uk
REVCOM: http://www.revcom.org.uk mailto:gary.stainburn@revcom.org.uk
-----------------------------------------
Murphy's Laws: (326) If it jams - force it. If it breaks, it needed replacing anyway.
-----------------------------------------



RE: how do I set DateStyle = European in postmaster ?

От
Gary Stainburn
Дата:
-----Original Message-----
From:    Michael Holopainen [SMTP:michael@laserle.fi]
Sent:    Friday, July 07, 2000 12:22 PM
To:    Gary Stainburn
Subject:    Re: [ADMIN] how do I set DateStyle = European in postmaster ?

>OK, here is the script (the whole postgres script)
>
>--- >8
>#!/bin/sh
>
>case "$1" in
>'start')
>        su - postgres -c "/usr/local/pgsql/bin/pg_ctl -o \"-S -i\"

Okay, you've got me, I've never seen it done that way before.  Every
setup I've ever seen calls postmaster directly.  However, try these two
options and hopefully one of them should do what you want.  If you wish,
you could combine both of them using the belt and braces notion

su - postgres -c "/usr/local/pgsql/bin/pg_ctl -o \"-S -i -e\" start"
or (all 1 line - remove the '\')
su - postgres -c "export lang=en_GB ; /usr/local/pgsql/bin/pg_ctrl \
    -o \"-S -i -e \" start"

It would be tidier to do

su - postgres -c 'export lang=en_GB ; /usr/local/pgsql/bin/pg_ctrl \
    -o "-S -i -e" start'

again as one line.  Using the single quotes for the outside means that
you don't have to escape the inner quotes and makes the line easier to
read.

>start"
>        ;;
>'stop')
>        su - postgres -c "/usr/local/pgsql/bin/pg_ctl stop"
>        ;;
>*)
>        echo "Usage: $0 { start | stop }"
>        ;;
>esac
>exit 0
>--- >8
>
>I didn't do it, I just need to live with it ;).
>It's pg 7.0 & 2.2.14 (suse 6.4) linux.
>
>All suggestions will be greatly appreaciated , also any ideas why
>postgres stops accepting connections from unix port ?
>When I start pg, I can connect to the base with psql OK. but the next
>day it no longer accept connections from the default port and I need to
>pass -h localhost to be able to connect to database.
>(all above is done while logged in as user 'postgres')
>

Sorry, I can't help here.  Have you looked to see what happens overnight
that could affect it's behaviour as something must be causing it.

>-micahel (A)

-----------------------------------------
Gary Stainburn.
Work: http://www.ringways.co.uk mailto:gary.stainburn@ringways.co.uk
REVCOM: http://www.revcom.org.uk mailto:gary.stainburn@revcom.org.uk
-----------------------------------------
Murphy's Laws: (326) If it jams - force it. If it breaks, it needed replacing anyway.
-----------------------------------------


RE: how do I set DateStyle = European in postmaster ?

От
"Anthony E. Greene"
Дата:
At 13:30 2000-07-07 +0100, Gary Stainburn wrote:
>-----Original Message-----
>From:    Michael Holopainen [SMTP:michael@laserle.fi]
>Sent:    Friday, July 07, 2000 12:22 PM
>To:    Gary Stainburn
>Subject:    Re: [ADMIN] how do I set DateStyle = European in postmaster ?
>
>>OK, here is the script (the whole postgres script)
[snip]

I set the DateStyle in /etc/profile, which works for ISO, but not for
European. That may have to do with locale settings in the RPM I have
installed.

It's a lot simpler if it works for you. Just put this in /etc/profile:

  export PGDATESTYLE='European'

Since the postmaster script uses "su -l" it gets the environment, including
things setup in /etc/profile (assuming the postgres user's shell is bash).


 Tony
 --
 Anthony E. Greene <agreene@pobox.com>
 PGP Key: 0x6C94239D/7B3D BD7D 7D91 1B44 BA26  C484 A42A 60DD 6C94 239D
 Linux: The choice of a GNU Generation.