[SQL] Select between two databases

2000-09-24 Thread Indraneel Majumdar

Hi,

Does any one know how I may select between two databases running on same
machine or on different machines eg.

select colA1 from tableA1 where colA2 in (select colB1 from tableB1);

here tableA1 and tableB1 are in different databases. The two databases
might be under the same postmaster or on different machines under
different postmasters. How do I query both simultaneously? Is it possible?

Thanks,
Indraneel

/.
# Indraneel Majumdar  ¡  E-mail: [EMAIL PROTECTED]  #
# Bioinformatics Unit (EMBNET node),  ¡  URL: http://scorpius.iwarp.com  #
# Centre for DNA Fingerprinting and Diagnostics, #
# Hyderabad, India - 500076  #
`/




Re: [SQL] Select between two databases

2000-09-24 Thread Fredrick Bartlett

Not sure if same can be accomplished with different servers.
Try the following for database's on one server,  use alias & dot notation...

select a1.colA1 from
myDatabase1.tableA1 a1
where a1.A2 in (select b1.colB1 from myDatabase2.tableB1 b1)

Indraneel Majumdar wrote:

> Hi,
>
> Does any one know how I may select between two databases running on same
> machine or on different machines eg.
>
> select colA1 from tableA1 where colA2 in (select colB1 from tableB1);
>
> here tableA1 and tableB1 are in different databases. The two databases
> might be under the same postmaster or on different machines under
> different postmasters. How do I query both simultaneously? Is it possible?
>
> Thanks,
> Indraneel
>
> /.
> # Indraneel Majumdar  ¡  E-mail: [EMAIL PROTECTED]  #
> # Bioinformatics Unit (EMBNET node),  ¡  URL: http://scorpius.iwarp.com  #
> # Centre for DNA Fingerprinting and Diagnostics, #
> # Hyderabad, India - 500076  #
> `/




Re: [SQL] Select between two databases

2000-09-24 Thread Indraneel Majumdar

Not working, but thanks anyway. Can anyone point out the relevant area of
the source where queries are handled?

Thanks,
Indraneel 

On Sun, 24 Sep 2000, Fredrick Bartlett wrote:

> Not sure if same can be accomplished with different servers.
> Try the following for database's on one server,  use alias & dot notation...
> 
> select a1.colA1 from
> myDatabase1.tableA1 a1
> where a1.A2 in (select b1.colB1 from myDatabase2.tableB1 b1)
> 

/.
# Indraneel Majumdar  ¡  E-mail: [EMAIL PROTECTED]  #
# Bioinformatics Unit (EMBNET node),  ¡  URL: http://scorpius.iwarp.com  #
# Centre for DNA Fingerprinting and Diagnostics, #
# Hyderabad, India - 500076  #
`/




Re: [SQL] Select between two databases

2000-09-24 Thread Stephan Szabo

On Sun, 24 Sep 2000, Indraneel Majumdar wrote:

> Does any one know how I may select between two databases running on same
> machine or on different machines eg.
> 
> select colA1 from tableA1 where colA2 in (select colB1 from tableB1);
> 
> here tableA1 and tableB1 are in different databases. The two databases
> might be under the same postmaster or on different machines under
> different postmasters. How do I query both simultaneously? Is it possible?

Currently postgres databases may not be spanned in queries.




[SQL] Re: [HACKERS] RFC - change of behaviour of pg_get_userbyid & pg_get_viewdef?

2000-09-24 Thread Tom Lane

Philip Warner <[EMAIL PROTECTED]> writes:
> pg_get_viewdef

> returns 'Not a view' when passed a non-existant or non-view table
> it also signals errors when the underlying metadata can not be found.

> The proposal is to return NULL in the above cases - in the final case,
> probably also generate a NOTICE.

I don't believe it's practical to trap errors and return a NULL for
broken views.  Moreover, I do not think it's a good idea to respond
to client errors (invalid view name) the same as database problems
(broken views).  So, I agree with the part of the proposal that says
to return NULL instead of 'Not a view' when there is no view by the
given name, but I do not agree with trying to suppress errors due to
metadata problems.

regards, tom lane



[SQL] Re: [HACKERS] RFC - change of behaviour of pg_get_userbyid & pg_get_viewdef?

2000-09-24 Thread Philip Warner

At 19:22 24/09/00 -0500, Dominic J. Eidson wrote:
>
>In these cases, is NULL = 0? - What if it returns the UID for "root"
>(typically UID 0)... I think an error message should/would be better in
>this case.
>

No NULL is NULL, a special value that usually means 'nothing found'.



Philip Warner| __---_
Albatross Consulting Pty. Ltd.   |/   -  \
(A.B.N. 75 008 659 498)  |  /(@)   __---_
Tel: (+61) 0500 83 82 81 | _  \
Fax: (+61) 0500 83 82 82 | ___ |
Http://www.rhyme.com.au  |/   \|
 |----
PGP key available upon request,  |  /
and from pgp5.ai.mit.edu:11371   |/



pgsql-sql@postgresql.org

2000-09-24 Thread Dominic J. Eidson

On Sun, 24 Sep 2000, Philip Warner wrote:

> Two routines do eccentric things when they can't find required supporting
> data:
> 
> pg_get_userbyid
> 
> returns 'unknown (UID=)' when the UID does not exist.

[Snip]

> The proposal is to return NULL in the above cases - in the final case,
> probably also generate a NOTICE.

In these cases, is NULL = 0? - What if it returns the UID for "root"
(typically UID 0)... I think an error message should/would be better in
this case.

Just my $.02.


-- 
Dominic J. Eidson
"Baruk Khazad! Khazad ai-menu!" - Gimli
---
http://www.the-infinite.org/  http://www.the-infinite.org/~dominic/