Files
supabase__supabase/apps/docs/content/troubleshooting/new-variable-is-null-in-a-trigger-function--l9AOZ.mdx
TheOtherBrian1 d87904961e Cleaning up troubleshooting guide categories (Edge Functions) (#43834)
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES/NO

## What kind of change does this PR introduce?

Docs update

## What is the current behavior?

Many troubleshooting guides referencing Postgres functions were placed
in the edge function category

## What is the new behavior?

Removed the "function" topic filter for guides that are unrelated to
edge functions
2026-03-17 21:36:53 -04:00

19 lines
798 B
Plaintext

---
title = "NEW variable is null in a trigger function."
github_url = "https://github.com/orgs/supabase/discussions/15934"
date_created = "2023-07-20T19:05:52+00:00"
topics = [ "database" ]
keywords = [ "trigger", "function", "statement", "row", "NEW", "OLD", "SQL" ]
database_id = "f5cabb97-aae3-4fb5-b597-4e7857821753"
---
When you create a function and call it from a trigger the NEW variable is only passed in if the trigger is on ROW operations
The UI currently defaults to STATEMENT which will not provide NEW or OLD variables to the function.
![image](/docs/img/troubleshooting/49e11154-296b-42b9-8036-8a7288e49b8a.png)
Also in SQL (reference: https://www.postgresql.org/docs/current/sql-createtrigger.html)
![image](/docs/img/troubleshooting/c7ac0f69-6fb9-4ff2-8aab-5cda6bada3f6.png)