<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Functions on BenzHub</title><link>https://benzhub.github.io/tags/functions/</link><description>Recent content in Functions on BenzHub</description><generator>Hugo</generator><language>zh-TW</language><lastBuildDate>Sat, 26 Sep 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://benzhub.github.io/tags/functions/index.xml" rel="self" type="application/rss+xml"/><item><title>Database Functions 與 Triggers 實戰 | Supabase 完整教學</title><link>https://benzhub.github.io/post/supabase/007-functions-triggers/</link><pubDate>Sat, 26 Sep 2026 00:00:00 +0000</pubDate><guid>https://benzhub.github.io/post/supabase/007-functions-triggers/</guid><description>&lt;blockquote&gt;
&lt;p&gt;在 &lt;strong&gt;Supabase&lt;/strong&gt; 底層的 &lt;strong&gt;Postgres&lt;/strong&gt; 裡，資料庫不只是被動存放資料的倉庫，它還能「自己會思考、會反應」。用 &lt;strong&gt;Database Functions&lt;/strong&gt; 把商業邏輯封裝在資料庫層，用 &lt;strong&gt;Triggers&lt;/strong&gt; 在資料變更的瞬間自動執行動作——這篇帶你用 &lt;code&gt;plpgsql&lt;/code&gt; 寫出可執行的函式與觸發器，包含 &lt;code&gt;security definer&lt;/code&gt; 的資安要點、自動更新 &lt;code&gt;updated_at&lt;/code&gt;、註冊時自動建 profile 等經典模式。&lt;/p&gt;
&lt;/blockquote&gt;</description></item></channel></rss>