Re: Shema functionality in 7.3

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: Shema functionality in 7.3
Дата
Msg-id 3DEABD05.5010804@joeconway.com
обсуждение исходный текст
Ответ на Shema functionality in 7.3  ("Mikael Carneholm" <SA9625@ida.utb.hb.se>)
Ответы Command editing with psql and OS X  (Eric B.Ridge <ebr@tcdi.com>)
Список pgsql-general
Mikael Carneholm wrote:
> Can someone who has experience from the new 7.3 version tell me
> if
>
> SELECT tableA.foo
> FROM shema1.tableA, shema2.tableB
> WHERE tableA.bar = tableB.bar
>
> is possible thanks to the new schema functionality?

Like this?

CREATE SCHEMA schema1;
CREATE SCHEMA schema2;
CREATE TABLE schema1.table_a(bar int, foo text);
INSERT INTO schema1.table_a VALUES(1,'a');
INSERT INTO schema1.table_a VALUES(2,'b');
CREATE TABLE schema2.table_b(bar int, foo text);
INSERT INTO schema2.table_b VALUES(1,'c');
INSERT INTO schema2.table_b VALUES(2,'d');

regression=# SELECT t1.foo, t2.foo FROM schema1.table_a t1, schema2.table_b t2
WHERE t1.bar = t2.bar;
  foo | foo
-----+-----
  a   | c
  b   | d
(2 rows)

> And is it possible to grant users permissions on whole schemas?

Not sure exactly what you mean, but see:

http://developer.postgresql.org/docs/postgres/sql-createschema.html
http://developer.postgresql.org/docs/postgres/sql-grant.html


> Queries like the one above is possible in Oracle, and I would really
> like to see this in PostgreSQL as well. (I guess we could call this
> feature "cross schema joins".)
>
> Note: I would not consider this as crossdb functionality, as tableA
> and tableB exist in the same database (using Oracle terms: the
> same instance), but in different shemas.
>

It's not the same as a cross db join, but the ability to use schemas is hoped
to reduce the need for that. You should look at contrib/dblink if you want to
join data across databases or servers.

HTH,

Joe


В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: how to make an 'UNLOCK'?
Следующее
От: Eric B.Ridge
Дата:
Сообщение: Command editing with psql and OS X