pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
execute a query in an other db
4+ messages / 3 participants
[nested] [flat]

* execute a query in an other db
@ 2002-11-09 16:51 LR <lr-NOSPAM-@sib.org>
  2002-11-12 14:18 ` Re: execute a query in an other db Bruno Wolff III <bruno@wolff.to>
  0 siblings, 1 reply; 4+ messages in thread

From: LR @ 2002-11-09 16:51 UTC (permalink / raw)
  To: pgsql-sql

Hi,

When I'm connected to a postgreSQL db ( e.g. myDB ), how could I execute
"select * from myTable;" in an other db (e.g. myOtherDB).

In other words, what is the postgreSQL equivalent of the MS SQL Server
statement "USE myOtherDB SELECT * FROM myTable" ?

Thanks
Lilian





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: execute a query in an other db
  2002-11-09 16:51 execute a query in an other db LR <lr-NOSPAM-@sib.org>
@ 2002-11-12 14:18 ` Bruno Wolff III <bruno@wolff.to>
  2002-11-16 10:43   ` Re: execute a query in an other db LR <lr-NOSPAM-@sib.org>
  0 siblings, 1 reply; 4+ messages in thread

From: Bruno Wolff III @ 2002-11-12 14:18 UTC (permalink / raw)
  To: LR <lr-NOSPAM-@sib.org>; +Cc: pgsql-sql

On Sat, Nov 09, 2002 at 17:51:40 +0100,
  LR <lr-NOSPAM-@sib.org> wrote:
> Hi,
> 
> When I'm connected to a postgreSQL db ( e.g. myDB ), how could I execute
> "select * from myTable;" in an other db (e.g. myOtherDB).
> 
> In other words, what is the postgreSQL equivalent of the MS SQL Server
> statement "USE myOtherDB SELECT * FROM myTable" ?

Stock postgresql doesn't support cross database queries.
There is a contrib package which does.

In the example you gave, you were combining information from two databases.
If it is the case that your application will be combining data from the
two databases, then you can open a separate connection to each database
and use the appropiate connection for your queries.



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: execute a query in an other db
  2002-11-09 16:51 execute a query in an other db LR <lr-NOSPAM-@sib.org>
  2002-11-12 14:18 ` Re: execute a query in an other db Bruno Wolff III <bruno@wolff.to>
@ 2002-11-16 10:43   ` LR <lr-NOSPAM-@sib.org>
  2002-11-16 20:48     ` Re: execute a query in an other db Joe Conway <mail@joeconway.com>
  0 siblings, 1 reply; 4+ messages in thread

From: LR @ 2002-11-16 10:43 UTC (permalink / raw)
  To: pgsql-sql

> > Hi,
> >
> > When I'm connected to a postgreSQL db ( e.g. myDB ), how could I execute
> > "select * from myTable;" in an other db (e.g. myOtherDB).
> >
> > In other words, what is the postgreSQL equivalent of the MS SQL Server
> > statement "USE myOtherDB SELECT * FROM myTable" ?
>
> Stock postgresql doesn't support cross database queries.
> There is a contrib package which does.
>
> In the example you gave, you were combining information from two
databases.
> If it is the case that your application will be combining data from the
> two databases, then you can open a separate connection to each database
> and use the appropiate connection for your queries.

Thank you for your answer.
Do you know the name of this package ?
Thx
Lilian





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: execute a query in an other db
  2002-11-09 16:51 execute a query in an other db LR <lr-NOSPAM-@sib.org>
  2002-11-12 14:18 ` Re: execute a query in an other db Bruno Wolff III <bruno@wolff.to>
  2002-11-16 10:43   ` Re: execute a query in an other db LR <lr-NOSPAM-@sib.org>
@ 2002-11-16 20:48     ` Joe Conway <mail@joeconway.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Joe Conway @ 2002-11-16 20:48 UTC (permalink / raw)
  To: LR <lr@sib.org>; +Cc: pgsql-sql

LR wrote:
> Thank you for your answer.
> Do you know the name of this package ?
> Thx
> Lilian
> 

see contrib/dblink.

I'd highly recommend using 7.3 (finishing beta, soon to be a release 
candidate) if you can. It is much better than the one in 7.2 and the syntax 
has changed some.

Joe




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2002-11-16 20:48 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-11-09 16:51 execute a query in an other db LR <lr-NOSPAM-@sib.org>
2002-11-12 14:18 ` Bruno Wolff III <bruno@wolff.to>
2002-11-16 10:43   ` LR <lr-NOSPAM-@sib.org>
2002-11-16 20:48     ` Joe Conway <mail@joeconway.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox