Error sending PostgreSQL to RAISE NOTICE with || operator

Getting the following error with the following line of code:

RAISE NOTICE '*** Rolling back job run id ' || CONVERT(varchar, v_job_run_id)
             || ' for table ' || v_table_name || '***';

Error:

ERROR: syntax error in or near "|" LINE 43: NOTIFICATION NOTIFICATIONS '*
Rollback job id' || CONVERT (var ...

+5
source share
1 answer

Message line in RAISE Operation XXXX must be constant - expression is not allowed there. It looks like a format string in printf types.

RAISE NOTICE 'my table has name %', tablename;

The second problem should be "CONVERT", which is not supported in Pg - use CAST instead or nothing, any parameter of the RAISE operator is automatically converted to text.

+7
source

All Articles