From 0a3a20347b8c3961d1aa68aa17c39b78bfb59f51 Mon Sep 17 00:00:00 2001 From: Steve Chavez Date: Tue, 18 Apr 2023 17:13:40 -0500 Subject: [PATCH] snippet for computed rel overload --- docs/api.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/api.rst b/docs/api.rst index caaefa5c9..1e5e10c46 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -1168,6 +1168,12 @@ For example, to override the :ref:`many-to-one relationship ` betwe Taking advantage of overloaded functions, you can use the same function name for different parameters and thus define relationships from other tables/views to ``directors``. +.. code-block:: postgres + + create function directors(film_schools) returns setof directors as $$ + select * from directors where film_school_id = $1.id + $$ stable language sql; + Computed relationships have good performance as they follow the `Inlining conditions for table functions `_. .. _nested_embedding: