![]() nothing to do if updating the row currently enabled This is what I have: CREATE OR REPLACE FUNCTION public.ensure_only_one_default_address() The update part is working, however I'm getting a unique constraint error for insert. I'm trying to create a trigger where if the is_default column is set to true on an insert or update, it sets the rest of the rows to false and the current one to true. Please find below the steps to create the trigger in PostgreSQL.In my database schema an organization can have multiple addresses but only one default address. You can define the function in the following compatible languages:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |