Postgre connect on Postgre

Started by Anderson dos Santos Dondaover 17 years ago7 messagesgeneral
Jump to latest
#1Anderson dos Santos Donda
andersondonda@gmail.com

Hi All

How I can connect a postgre database on another postgre database, and
manipulate the datas on both database?

Thanks!!

#2Christophe Pettus
xof@thebuild.com
In reply to: Anderson dos Santos Donda (#1)
Re: Postgre connect on Postgre

On Aug 26, 2008, at 7:10 PM, Anderson dos Santos Donda wrote:

How I can connect a postgre database on another postgre database,
and manipulate the datas on both database?

There is a module in contrib just for such a purpose:

http://www.postgresql.org/docs/8.3/interactive/dblink.html

#3Anderson dos Santos Donda
andersondonda@gmail.com
In reply to: Christophe Pettus (#2)
Re: Postgre connect on Postgre

Thanks man!!

I'll study this module!!

On Tue, Aug 26, 2008 at 11:19 PM, Christophe <xof@thebuild.com> wrote:

Show quoted text

On Aug 26, 2008, at 7:10 PM, Anderson dos Santos Donda wrote:

How I can connect a postgre database on another postgre database, and
manipulate the datas on both database?

There is a module in contrib just for such a purpose:

http://www.postgresql.org/docs/8.3/interactive/dblink.html

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#4Adam Rich
adam.r@sbcglobal.net
In reply to: Anderson dos Santos Donda (#1)
time math - Bug or expected behavior?

I traced a bug in our application down to this basic operation:

set timezone to 'US/Eastern';

select '11/02/2008'::timestamptz, '12:10'::time,
'11/02/2008'::timestamptz + '12:10'::time;

I have a date and a time stored separately and I want to combine them,
and use them in some timezone-aware calculations. When I add the time
12:10 to the date 11/2/08, I expect the timestamp "11/2/08 12:10" but
instead, I get "11/2/08 11:10".

It's probably not coincidence that daylight saving time rolls back one hour
on the morning of 11/2. Still, I would have expected the above behavior
when adding an interval to a timestamp, but not a time. Is the time being
cast to an interval before the add? Is there a better way to combine a
date with a time and get a timestamptz ? (the values are stored in the database, and are not literals as in my example)

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Adam Rich (#4)
Re: time math - Bug or expected behavior?

Adam Rich <adam.r@sbcglobal.net> writes:

I traced a bug in our application down to this basic operation:
set timezone to 'US/Eastern';

select '11/02/2008'::timestamptz, '12:10'::time,
'11/02/2008'::timestamptz + '12:10'::time;

I have a date and a time stored separately and I want to combine them,
and use them in some timezone-aware calculations. When I add the time
12:10 to the date 11/2/08, I expect the timestamp "11/2/08 12:10" but
instead, I get "11/2/08 11:10".

I don't see why that surprises you in the least.
'11/02/2008'::timestamptz means 11/02/2008 00:00 local time, and (given
US DST rules) 11/2/08 11:10 is what the time will be 12 hours and 10
minutes later.

If you want non-DST-aware timekeeping, use timestamp without time zone.

Still, I would have expected the above behavior
when adding an interval to a timestamp, but not a time.

How could a time work differently from an interval in this context?

regards, tom lane

#6Tino Wildenhain
tino@wildenhain.de
In reply to: Anderson dos Santos Donda (#3)
Re: Postgre connect on Postgre

Hi,

Anderson dos Santos Donda wrote:

Thanks man!!

I'll study this module!!

You should also be aware that sometimes instead of
connecting two separate databases via dblink or similar,
two schemas in one database can be used instead.

It really depends on what you are really doing if
there are even more solutions (like slony for example).

Regards
Tino

PS: the database likes to be called Postgresql or Postgres :-)

Show quoted text

On Tue, Aug 26, 2008 at 11:19 PM, Christophe <xof@thebuild.com
<mailto:xof@thebuild.com>> wrote:

On Aug 26, 2008, at 7:10 PM, Anderson dos Santos Donda wrote:

How I can connect a postgre database on another postgre
database, and manipulate the datas on both database?

There is a module in contrib just for such a purpose:

http://www.postgresql.org/docs/8.3/interactive/dblink.html

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org
<mailto:pgsql-general@postgresql.org>)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#7Asko Oja
ascoja@gmail.com
In reply to: Tino Wildenhain (#6)
Re: Postgre connect on Postgre

If you are using functions take a look at plProxy. We created it after
finding out that dblink wasn't good enough for us in oltp environments.
There are also some security issues related to dblink that should be given
serious consideration.

As for replication SkyTools and Londiste are alternatives to Slony. SkyTools
should provide less management headaches.

http://kaiv.wordpress.com/2007/09/02/postgresql-cluster-partitioning-with-plproxy-part-ii/

regards
Asko

On Wed, Aug 27, 2008 at 8:09 AM, Tino Wildenhain <tino@wildenhain.de> wrote:

Show quoted text

Hi,

Anderson dos Santos Donda wrote:

Thanks man!!

I'll study this module!!

You should also be aware that sometimes instead of
connecting two separate databases via dblink or similar,
two schemas in one database can be used instead.

It really depends on what you are really doing if
there are even more solutions (like slony for example).

Regards
Tino

PS: the database likes to be called Postgresql or Postgres :-)

On Tue, Aug 26, 2008 at 11:19 PM, Christophe <xof@thebuild.com <mailto:

xof@thebuild.com>> wrote:

On Aug 26, 2008, at 7:10 PM, Anderson dos Santos Donda wrote:

How I can connect a postgre database on another postgre
database, and manipulate the datas on both database?

There is a module in contrib just for such a purpose:

http://www.postgresql.org/docs/8.3/interactive/dblink.html

-- Sent via pgsql-general mailing list (
pgsql-general@postgresql.org
<mailto:pgsql-general@postgresql.org>)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general