Re: Function with COPY command?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Warren <warren(at)clarksnutrition(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Function with COPY command?
Date: 2007-06-14 19:59:46
Message-ID: 19787.1181851186@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Warren <warren(at)clarksnutrition(dot)com> writes:
> Is there any way to make this function work?

> CREATE OR REPLACE FUNCTION import_text_file(char(255)) RETURNS void AS $$
> DECLARE
> filename ALIAS FOR $1;
> BEGIN
> COPY table FROM filename;
> END;
> $$ LANGUAGE plpgsql;

Use EXECUTE.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2007-06-14 20:02:08 Re: COPY Command and a non superuser user?
Previous Message Dániel Dénes 2007-06-14 19:55:34 UNION ALL with the same ORDER BY on the parts and the result