Обсуждение: two or more pg installations running as the same user

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

two or more pg installations running as the same user

От
"Grzegorz Jaśkiewicz"
Дата:
hey folks,

I am thinking about testing enviroment here, and gotta setup temporary instalation of postgres for that. More than one, because software operates on few different connections, to different databases.
I know I can do it under same user, just by changing PGDATA/PGPORT before initdb gets to run. But will it be safe otherwise ?


--
GJ

Syntac error

От
Timo Erbach
Дата:
Hello,

I've defined the following function and get an syntac error whle compiling.
Whats the fault?

CREATE FUNCTION "myscheme"."authenticate" () RETURNS
"pg_catalog"."refcursor" AS
$body$
DECLARE
    curAccessRights refcursor;

BEGIN
    OPEN curAccessRights FOR
        SELECT * from myscheme."tblUsers";

    RETURN curAccessRights;
END;
$body$
LANGUAGE 'sql'

Regards Timo

Re: Syntac error

От
"A. Kretschmer"
Дата:
am  Tue, dem 25.11.2008, um 12:41:32 +0100 mailte Timo Erbach folgendes:
> Hello,
>
> I've defined the following function and get an syntac error whle compiling.
> Whats the fault?
>
> CREATE FUNCTION "myscheme"."authenticate" () RETURNS
> "pg_catalog"."refcursor" AS
> $body$
> DECLARE
>    curAccessRights refcursor;
> ...
> $body$
> LANGUAGE 'sql'

You can't use declare in this language, use plpgsql instead.


Regards, Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

Re: Syntac error

От
Timo Erbach
Дата:
Hi Andreas,

thank you!
I did install plpsql and now everything is fine.

Regards Timo

A. Kretschmer schrieb:
> am  Tue, dem 25.11.2008, um 12:41:32 +0100 mailte Timo Erbach folgendes:
>
>> Hello,
>>
>> I've defined the following function and get an syntac error whle compiling.
>> Whats the fault?
>>
>> CREATE FUNCTION "myscheme"."authenticate" () RETURNS
>> "pg_catalog"."refcursor" AS
>> $body$
>> DECLARE
>>    curAccessRights refcursor;
>> ...
>> $body$
>> LANGUAGE 'sql'
>>
>
> You can't use declare in this language, use plpgsql instead.
>
>
> Regards, Andreas
>


Re: two or more pg installations running as the same user

От
"Filip Rembiałkowski"
Дата:


2008/11/25 Grzegorz Jaśkiewicz <gryzman@gmail.com>
hey folks,

I am thinking about testing enviroment here, and gotta setup temporary instalation of postgres for that. More than one, because software operates on few different connections, to different databases.
I know I can do it under same user, just by changing PGDATA/PGPORT before initdb gets to run. But will it be safe otherwise ?

yes, no problem with that. for me it was just:

initdb -D /tmp/data1
vim /tmp/data1/postgresql.conf +/port
pg_ctl start -D /tmp/data1

initdb -D /tmp/data2
vim /tmp/data2/postgresql.conf +/port
pg_ctl start -D /tmp/data2


 



--
GJ



--
Filip Rembiałkowski

Re: two or more pg installations running as the same user

От
Rafael Martinez
Дата:
Filip Rembiałkowski wrote:
>
>
> 2008/11/25 Grzegorz Jaśkiewicz <gryzman@gmail.com
> <mailto:gryzman@gmail.com>>
>
>     hey folks,
>
>     I am thinking about testing enviroment here, and gotta setup
>     temporary instalation of postgres for that. More than one, because
>     software operates on few different connections, to different databases.
>     I know I can do it under same user, just by changing PGDATA/PGPORT
>     before initdb gets to run. But will it be safe otherwise ?
>
>
> yes, no problem with that. for me it was just:
>

Hello

Another method we use to run multiple postgresql clusters and multiple
versions on the same server is to install extra IPs on the server using
the same (default) port.

If you use this method, it is very important that you define the right
listen_addresses values and different unix_socket_directory values for
each cluster running on the same server.

We connect mostly via tcp/ip and not via sockets, this way the clients
do not have to remember the port running their databases.

Of course the initdb and start steps are the same as Filip has commented.

regards,
--
 Rafael Martinez, <r.m.guerrero@usit.uio.no>
 Center for Information Technology Services
 University of Oslo, Norway

 PGP Public Key: http://folk.uio.no/rafael/

Re: two or more pg installations running as the same user

От
Chris
Дата:
Grzegorz Jas'kiewicz wrote:
> hey folks,
>
> I am thinking about testing enviroment here, and gotta setup temporary
> instalation of postgres for that. More than one, because software
> operates on few different connections, to different databases.
> I know I can do it under same user, just by changing PGDATA/PGPORT
> before initdb gets to run. But will it be safe otherwise ?

Yep.

If they are different versions of postgres (eg 8.2/8.3), make sure you
initdb with the right one :)

--
Postgresql & php tutorials
http://www.designmagick.com/


Re: two or more pg installations running as the same user

От
"Grzegorz Jaśkiewicz"
Дата:
On Tue, Nov 25, 2008 at 10:29 PM, Chris <dmagick@gmail.com> wrote:

If they are different versions of postgres (eg 8.2/8.3), make sure you initdb with the right one :)
ok, I tried it and it works fine so far.
basically, I need to setup test harness, that would involve using few physically separate pg's, and wanted to make sure they won't bite each other's tail. 
I did it in the past, but every pg was running as different user, but for purpose of 'make test/check' type'o'thing, I can't create users, etc :)

thanks folks. 

--
GJ

Re: two or more pg installations running as the same user

От
"Mikko Partio"
Дата:


On Tue, Nov 25, 2008 at 12:37 PM, Grzegorz Jaśkiewicz <gryzman@gmail.com> wrote:
hey folks,

I am thinking about testing enviroment here, and gotta setup temporary instalation of postgres for that. More than one, because software operates on few different connections, to different databases.
I know I can do it under same user, just by changing PGDATA/PGPORT before initdb gets to run. But will it be safe otherwise ?

You know you don't need separate clusters (ie. installations) to have multiple databases?

Regards

Mikko

Re: two or more pg installations running as the same user

От
"Grzegorz Jaśkiewicz"
Дата:


2008/11/26 Mikko Partio <mpartio@gmail.com>
You know you don't need separate clusters (ie. installations) to have multiple databases?

obvioiusly.
so far I just do:

mkdir $INST
export PGDATA=$INST
export PGPORT=$INSTPORT

initdb
pg_ctl start

.. and that's it folks.

 

--
GJ