Re: Idea: Avoid JOINs by using path expressions to follow FKs

Поиск
Список
Период
Сортировка
От Joel Jacobson
Тема Re: Idea: Avoid JOINs by using path expressions to follow FKs
Дата
Msg-id 3062a31b-c13a-4fa1-bc35-e9c88953d8b4@www.fastmail.com
обсуждение исходный текст
Ответ на Re: Idea: Avoid JOINs by using path expressions to follow FKs  (Vik Fearing <vik@postgresfriends.org>)
Список pgsql-hackers
On Mon, Mar 29, 2021, at 16:17, Vik Fearing wrote:
If you write your schema like this, then it becomes standards compliant:
...
CREATE TABLE order_details (
    "order" REF(orders),
    product REF(products),
    quantity integer,
    PRIMARY KEY ("order", product)
);


And the query would be:

SELECT DISTINCT order_details."order"->customer->company_name
FROM order_details
WHERE order_details.product->product_name = 'Chocolade';


Postgres already supports most of that, but not all of it.

Thanks for making me aware of this.
I can see this is "4.9 Reference types" in ISO/IEC 9075-2:2016(E).

This looks awesome.

/Joel

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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Rename of triggers for partitioned tables
Следующее
От: Tomas Vondra
Дата:
Сообщение: Merging statistics from children instead of re-sampling everything