© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•3y ago•
10 replies
ninja11

trying to create db function which exclude non numeric values before insert&update

i have price field(data type = int) and i wanna create trigger (which i did) which will execute my function before insert&update .

main purpuse of my function is to run on every raw modification and exclude non numeric values from price field before store it .

my function looks like that :
BEGIN
NEW.price := REGEXP_REPLACE(NEW.price, '[^0-9]', '', 'g'); -- Remove non-numeric characters
NEW.price := NEW.price::int; -- Convert to integer
RETURN NEW;
END;
ps: whenever i try to insert something like 4,500 i get err,-"non intiger value"
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

DB Function to Insert New Users
SupabaseSSupabase / help-and-questions
4y ago
return numeric identity after insert?
SupabaseSSupabase / help-and-questions
4y ago
Edge function to fetch data and update DB
SupabaseSSupabase / help-and-questions
4y ago
Where do I insert a DB function to? getting syntax errors
SupabaseSSupabase / help-and-questions
4y ago