Re: Function with COPY command? - Mailing list pgsql-general

From Tom Lane
Subject Re: Function with COPY command?
Date
Msg-id 19787.1181851186@sss.pgh.pa.us
Whole thread Raw
In response to Function with COPY command?  (Warren <warren@clarksnutrition.com>)
Responses Re: Function with COPY command?  ("Shoaib Mir" <shoaibmir@gmail.com>)
List pgsql-general
Warren <warren@clarksnutrition.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

pgsql-general by date:

Previous
From: Dániel Dénes
Date:
Subject: UNION ALL with the same ORDER BY on the parts and the result
Next
From: Scott Marlowe
Date:
Subject: Re: COPY Command and a non superuser user?