Database function gives error - Postgresql

I had some help here and got the following code:

-- Setup Solrid Function
CREATE OR REPLACE FUNCTION solrid(IN local_id INTEGER, OUT result TEXT) AS $$
DECLARE
  database_id TEXT := 'A';
BEGIN
  result := database_id || local_id::TEXT;
END;
$$ LANGUAGE PLPGSQL;

      

However, when I run it in sqlfiddle it says:

Failed to create schema: ERROR: Inexhaustible quoted string in dollars or so "$$ DECLARE database_id TEXT: = 'A'":

This error may seem pretty self-explanatory, but I can't figure out how to fix it. Can anyone shed some light on this please?

+3


source to share


1 answer


There is absolutely nothing wrong with this feature, it is 100% legitimate. I tested 8.4 and 9.1 on my installation.



There must be some misunderstanding. It may not be the exact same code that is causing the error message.

0


source







All Articles