Concatenating String Literals in pgsql
How does one concat string literals in pgsql ?
The compiler complains about the concat operator in the following code
fragment:
RAISE EXCEPTION
''SELECT DISTINCT "t1"."usesysid" '' ||
''INTO userID '' ||
''FROM "pg_user" AS "t1" '' ||
''WHERE "t1"."usename" = current_user '' ||
''NOT FOUND'';
Thanks in advance.
Raymond
Raymond <support@bigriverinfotech.com> writes:
The compiler complains about the concat operator in the following code
fragment:
RAISE EXCEPTION
''SELECT DISTINCT "t1"."usesysid" '' ||
''INTO userID '' ||
RAISE EXCEPTION doesn't support expressions in its arguments, IIRC.
The format has to be a simple string literal, and anything to be plugged
into it has to be a variable reference.
So, do the concatenation beforehand.
regards, tom lane