Обсуждение: "copy from" in "create function"

Поиск
Список
Период
Сортировка

"copy from" in "create function"

От
Gifford Hesketh
Дата:
Am I forgetting some limitation ?  I get "ERROR:  syntax error at or
near "$1" at character 22" with this:

CREATE FUNCTION public.fn_b_import( text ) RETURNS void AS 
'
COPY b_import FROM $1 ;
'
LANGUAGE 'sql' STABLE;


Re: "copy from" in "create function"

От
Jan Wieck
Дата:
On 10/20/2004 6:03 PM, Gifford Hesketh wrote:

> Am I forgetting some limitation ?  I get "ERROR:  syntax error at or
> near "$1" at character 22" with this:
> 
> CREATE FUNCTION public.fn_b_import( text ) RETURNS void AS 
> '
> COPY b_import FROM $1 ;
> '
> LANGUAGE 'sql' STABLE;

Utility statements don't accept parameters for arguments. Use the 
EXECUTE syntax of PL/pgSQL for this.


Jan

-- 
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #