parse error at or near $1

Поиск
Список
Период
Сортировка
От Michael McDonnell
Тема parse error at or near $1
Дата
Msg-id 3ADB653D.DEB92055@winterstorm.ca
обсуждение исходный текст
Ответы Re: parse error at or near $1  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
I have created the following pl/pgsql function:

     CREATE FUNCTION contactable_name (integer) RETURNS text AS '
       DECLARE
         myid ALIAS FOR $1;
         contact_table text;
       BEGIN
         SELECT INTO contact_table t.table_name FROM contactable c,
     contactable_type t WHERE c.id = $1 AND c.type_id = t.id;
         RETURN EXECUTE contact_table || ''_name('' || myid ||
     '')'';
       END;
     ' LANGUAGE 'plpgsql';

And when I run "SELECT contactable_name(1);" I get the error message
"parse error at or near $1".

The purpose of this function is to return the output of another
function.  It dynamically builds the function name based on the name of
the table corresponding to the type of thing it is building the name
for.

--
MM


В списке pgsql-general по дате отправления:

Предыдущее
От: "Bob McCormick"
Дата:
Сообщение: Schema Import
Следующее
От: "Firestar"
Дата:
Сообщение: Inserting Unicode into Postgre