Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

POSTGRES, column "row_count" does not exist when using ROW_COUNT

After running my function I am trying to display the amount of updated rows to the panel like so:

  RAISE NOTICE 'updated rows= %', ROW_COUNT;
  commit;
  RAISE NOTICE 'updated rows= %', ROW_COUNT;
  commit;
  END;

however I get an error of:

ERROR:  column "row_count" does not exist
LINE 1: SELECT ROW_COUNT

i'm pretty sure this is acceptable syntax, not sure why this is happening.

like image 382
dros Avatar asked May 13 '26 11:05

dros


1 Answers

There is not any automatics variable named ROW_COUNT. You should to use statement GET DIAGNOSTICS yourvar = ROW_COUNT.

like image 109
Pavel Stehule Avatar answered May 15 '26 07:05

Pavel Stehule