Обсуждение: Two backends at the same time

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

Two backends at the same time

От
Michael Meskes
Дата:
What happens if I run two backends on different ports at the same time on
the same database? Is there any kind of locking done?

No, one backend won't do since one software want US style dates and the
other wants German style dates. There should be no concurrent access but who
knows when I will type the wrong port.

michael
-- 
Michael Meskes                         | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz    | Go Rhein Fire!
Tel.: (+49) 2431/72651                 | Use Debian GNU/Linux!
Email: Michael@Fam-Meskes.De           | Use PostgreSQL!


Re: [HACKERS] Two backends at the same time

От
Sevo Stille
Дата:
Michael Meskes wrote:

> No, one backend won't do since one software want US style dates and the
> other wants German style dates.

SET DateStyle can select date styles per session. There is no need to do
that at backend level.

Sevo


Re: [HACKERS] Two backends at the same time

От
Tom Lane
Дата:
Michael Meskes <meskes@postgreSQL.org> writes:
> What happens if I run two backends on different ports at the same time on
> the same database? Is there any kind of locking done?

You mean two postmasters?  Death and destruction is what will happen.
I believe there's an interlock to prevent this mistake in current
sources, but I don't recall if it was in 6.5.*.

> No, one backend won't do since one software want US style dates and the
> other wants German style dates. There should be no concurrent access but who
> knows when I will type the wrong port.

As Sevo points out, setting DATESTYLE per-session is the right way to do
this.  You might find that setting environment variable PGDATESTYLE on
the client side is a comfortable way to work --- if libpq sees that
variable set, it will issue a SET DATESTYLE command for you during
connection startup.  Works with any libpq-based client, so it's
pretty transparent...
        regards, tom lane


Re: [HACKERS] Two backends at the same time

От
Michael Meskes
Дата:
On Fri, Feb 04, 2000 at 01:01:23PM +0100, Sevo Stille wrote:
> SET DateStyle can select date styles per session. There is no need to do
> that at backend level.

Oops. I should have thought before asking. Sorry.

Michael
-- 
Michael Meskes                         | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz    | Go Rhein Fire!
Tel.: (+49) 2431/72651                 | Use Debian GNU/Linux!
Email: Michael@Fam-Meskes.De           | Use PostgreSQL!


Re: [HACKERS] Two backends at the same time

От
Michael Meskes
Дата:
On Fri, Feb 04, 2000 at 10:17:53AM -0500, Tom Lane wrote:
> You mean two postmasters?  Death and destruction is what will happen.
> I believe there's an interlock to prevent this mistake in current
> sources, but I don't recall if it was in 6.5.*.

I don't think there is one in 6.5.* since I was able to start two.

> As Sevo points out, setting DATESTYLE per-session is the right way to do
> this.  You might find that setting environment variable PGDATESTYLE on
> the client side is a comfortable way to work --- if libpq sees that

Yes, that would be a much better way. If now my perl wasn't so rusty since I
have to set that variable in a CGI script.

Michael
-- 
Michael Meskes                         | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz    | Go Rhein Fire!
Tel.: (+49) 2431/72651                 | Use Debian GNU/Linux!
Email: Michael@Fam-Meskes.De           | Use PostgreSQL!


Re: [HACKERS] Two backends at the same time

От
Thomas Lockhart
Дата:
> If now my perl wasn't so rusty since I
> have to set that variable in a CGI script.

$ENV{"PGDATESTYLE"} = "German";

might do it, but I'm not recalling with certainty that Perl does the
Right Thing in to make the variable visible to children (pretty sure
it does).
                  - Thomas

-- 
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, California


Re: [HACKERS] Two backends at the same time

От
Michael Meskes
Дата:
On Sat, Feb 05, 2000 at 01:51:50AM +0000, Thomas Lockhart wrote:
> $ENV{"PGDATESTYLE"} = "German";
> 
> might do it, but I'm not recalling with certainty that Perl does the
> Right Thing in to make the variable visible to children (pretty sure
> it does).

Yes, that's exactly what I tried and it works.

Michael
-- 
Michael Meskes                         | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz    | Go Rhein Fire!
Tel.: (+49) 2431/72651                 | Use Debian GNU/Linux!
Email: Michael@Fam-Meskes.De           | Use PostgreSQL!