```sql if new."category" is "rand_category" then...
# sql
m
Copy code
sql
if new."category" is "rand_category"
  then
    //Do somthing
  else
    //Do somthing else
  end if;
Is this the correct way of checking the value of a particular column in the newly added row?
g
Assuming this is a plpgsql trigger function.. new.category is fine if you are using lower case column names (you hopefully are). "is" is only for boolean test. You probably want = You use single quotes for text in Postgres so 'rand_category' You need semicolons after your //do somethings
m
This is indeed a Stored Procedure like you said. I am using lower case column names but its a habit (better safe than sorry) I tried = first but I got this error that said something like
column "rand_category" does not exist
Just now I tried with just single quotes and it worked like how i wanted it to work. I had no idea double and single quotes had different purposes.