Home:ALL Converter>Why do I get a syntax error when creating a PostgreSQL function?

Why do I get a syntax error when creating a PostgreSQL function?

Ask Time:2019-08-03T02:33:13         Author:mipadi

Json Formatter

I am trying to create a function in PostgreSQL using this query:

create function cs.has_double_bridge(cs.nose_bridge_type) returns boolean as $$
  return $1 = 'double bridge';
$$ language plpgsql stable;

But I keep getting an error on the second line:

ERROR:  syntax error at or near "return"
LINE 2:   return $1 = 'keyhole';
          ^

I am not an expert in PostgreSQL, so I haven't been able to figure out the cause of the error. What am I doing wrong here?

Author:mipadi,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/57331820/why-do-i-get-a-syntax-error-when-creating-a-postgresql-function
yy