pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
"copy from" in "create function"
2+ messages / 2 participants
[nested] [flat]

* "copy from" in "create function"
@ 2004-10-20 22:03  Gifford Hesketh <gifford.hesketh@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Gifford Hesketh @ 2004-10-20 22:03 UTC (permalink / raw)
  To: pgsql-sql

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;



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: "copy from" in "create function"
@ 2004-10-25 17:19  Jan Wieck <JanWieck@Yahoo.com>
  parent: Gifford Hesketh <gifford.hesketh@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Jan Wieck @ 2004-10-25 17:19 UTC (permalink / raw)
  To: Gifford Hesketh <gifford.hesketh@gmail.com>; +Cc: pgsql-sql

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 #



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2004-10-25 17:19 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-10-20 22:03 "copy from" in "create function" Gifford Hesketh <gifford.hesketh@gmail.com>
2004-10-25 17:19 ` Jan Wieck <JanWieck@Yahoo.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox